Skip to content

Commit

Permalink
style: lint
Browse files Browse the repository at this point in the history
  • Loading branch information
sbrugman committed Jul 4, 2022
1 parent 122d36a commit ddf306c
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 13 deletions.
12 changes: 10 additions & 2 deletions popmon/notebooks/popmon_tutorial_advanced.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -470,7 +470,11 @@
" store_key=\"report_sections\",\n",
" settings=report_settings,\n",
" ),\n",
" ReportGenerator(read_key=\"report_sections\", store_key=\"html_report\", settings=report_settings),\n",
" ReportGenerator(\n",
" read_key=\"report_sections\",\n",
" store_key=\"html_report\",\n",
" settings=report_settings,\n",
" ),\n",
" ]\n",
" super().__init__(modules)\n",
"\n",
Expand Down Expand Up @@ -528,7 +532,11 @@
" store_key=\"report_sections\",\n",
" settings=report_settings,\n",
" ),\n",
" ReportGenerator(read_key=\"report_sections\", store_key=\"html_report\", settings=report_settings),\n",
" ReportGenerator(\n",
" read_key=\"report_sections\",\n",
" store_key=\"html_report\",\n",
" settings=report_settings,\n",
" ),\n",
" ]\n",
" super().__init__(modules)\n",
"\n",
Expand Down
14 changes: 5 additions & 9 deletions popmon/resources.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,18 +54,12 @@


def js_list(encoder, data):
pairs = [
js_val(encoder, v)
for v in data
]
pairs = [js_val(encoder, v) for v in data]
return "[" + ", ".join(pairs) + "]"


def js_dict(encoder, data):
pairs = [
k + ": " + js_val(encoder, v)
for k, v in data.items()
]
pairs = [k + ": " + js_val(encoder, v) for k, v in data.items()]
return "{" + ", ".join(pairs) + "}"


Expand All @@ -79,7 +73,9 @@ def js_val(encoder, data):
return val


_TEMPLATES_ENV.filters["json_plot"] = lambda x: js_val(json.JSONEncoder(ensure_ascii=False), x)
_TEMPLATES_ENV.filters["json_plot"] = lambda x: js_val(
json.JSONEncoder(ensure_ascii=False), x
)


def _resource(resource_type, name: str) -> str:
Expand Down
14 changes: 12 additions & 2 deletions popmon/visualization/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,17 @@ def plot_bars(
return ""

# plot bar
fig = go.Figure([go.Bar(x=labels, y=data, hovertemplate="%{y:.4f}", name=metric, marker_color=primary_color)])
fig = go.Figure(
[
go.Bar(
x=labels,
y=data,
hovertemplate="%{y:.4f}",
name=metric,
marker_color=primary_color,
)
]
)

# set label granularity
if len(labels) > 0:
Expand Down Expand Up @@ -154,7 +164,7 @@ def plot_bars(
return plot


def plot_traffic_lights_overview(feature, data, metrics :List[str], labels: List[str]):
def plot_traffic_lights_overview(feature, data, metrics: List[str], labels: List[str]):
colors = defaultdict(dict)
color_map = ["g", "y", "r"]
for c1, metric in enumerate(metrics):
Expand Down

0 comments on commit ddf306c

Please sign in to comment.