From ddf306c2dcc2cea5b3d422a3315c489b9593e4a3 Mon Sep 17 00:00:00 2001 From: Simon Brugman Date: Mon, 4 Jul 2022 23:00:39 +0200 Subject: [PATCH] style: lint --- popmon/notebooks/popmon_tutorial_advanced.ipynb | 12 ++++++++++-- popmon/resources.py | 14 +++++--------- popmon/visualization/utils.py | 14 ++++++++++++-- 3 files changed, 27 insertions(+), 13 deletions(-) diff --git a/popmon/notebooks/popmon_tutorial_advanced.ipynb b/popmon/notebooks/popmon_tutorial_advanced.ipynb index 96c198fa..c3168652 100644 --- a/popmon/notebooks/popmon_tutorial_advanced.ipynb +++ b/popmon/notebooks/popmon_tutorial_advanced.ipynb @@ -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", @@ -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", diff --git a/popmon/resources.py b/popmon/resources.py index 8d3a46d9..b1e10fc5 100644 --- a/popmon/resources.py +++ b/popmon/resources.py @@ -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) + "}" @@ -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: diff --git a/popmon/visualization/utils.py b/popmon/visualization/utils.py index 72b60091..72ac3dc2 100644 --- a/popmon/visualization/utils.py +++ b/popmon/visualization/utils.py @@ -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: @@ -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):