From c943a8fa9f20db3c6e3a2464abeb8667e4e74ccc Mon Sep 17 00:00:00 2001 From: Simon Brugman Date: Thu, 6 Jul 2023 15:44:12 +0200 Subject: [PATCH] chore: rebase --- popmon/analysis/hist_numpy.py | 4 ++-- popmon/base/registry.py | 12 ++++++------ popmon/extensions/utils.py | 0 popmon/pipeline/metrics.py | 3 +-- popmon/pipeline/report.py | 4 ++-- popmon/visualization/utils.py | 5 ++--- 6 files changed, 13 insertions(+), 15 deletions(-) delete mode 100644 popmon/extensions/utils.py diff --git a/popmon/analysis/hist_numpy.py b/popmon/analysis/hist_numpy.py index bbe3a1c0..edcfc6d4 100644 --- a/popmon/analysis/hist_numpy.py +++ b/popmon/analysis/hist_numpy.py @@ -17,9 +17,9 @@ # IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN # CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +from __future__ import annotations import warnings -from typing import List import histogrammar import numpy as np @@ -187,7 +187,7 @@ def get_consistent_numpy_ndgrids( ) assert_similar_hists(hist_list) - keys: List[set] = [set() for _ in range(dim)] + keys: list[set] = [set() for _ in range(dim)] for hist in hist_list: hist_keys = prepare_ndgrid(hist, n_dim=dim) for i, h_keys in enumerate(hist_keys): diff --git a/popmon/base/registry.py b/popmon/base/registry.py index 96f14e09..94caba4d 100644 --- a/popmon/base/registry.py +++ b/popmon/base/registry.py @@ -19,19 +19,19 @@ from __future__ import annotations from collections import defaultdict -from typing import Any, Callable, DefaultDict, Dict, List, Optional, Tuple, Union +from typing import Any, Callable class Registry: _properties = ("dim", "htype") def __init__(self) -> None: - self._keys: List[str] = [] - self._descriptions: Dict[str, str] = {} - self._properties_to_func: DefaultDict[ - str, DefaultDict[str, Dict[Any, Any]] + self._keys: list[str] = [] + self._descriptions: dict[str, str] = {} + self._properties_to_func: defaultdict[ + str, defaultdict[str, dict[Any, Any]] ] = defaultdict(lambda: defaultdict(dict)) - self._func_name_to_properties: Dict[Any, Any] = {} + self._func_name_to_properties: dict[Any, Any] = {} def register( self, diff --git a/popmon/extensions/utils.py b/popmon/extensions/utils.py deleted file mode 100644 index e69de29b..00000000 diff --git a/popmon/pipeline/metrics.py b/popmon/pipeline/metrics.py index 7e3b0162..33e767be 100644 --- a/popmon/pipeline/metrics.py +++ b/popmon/pipeline/metrics.py @@ -20,7 +20,6 @@ from __future__ import annotations import logging -from typing import Optional from histogrammar.dfinterface.make_histograms import get_bin_specs, make_histograms @@ -75,7 +74,7 @@ def stability_metrics( def df_stability_metrics( df, - settings: Optional[Settings] = None, + settings: Settings | None = None, time_width=None, time_offset: int = 0, var_dtype=None, diff --git a/popmon/pipeline/report.py b/popmon/pipeline/report.py index 8ce524eb..fe29b925 100644 --- a/popmon/pipeline/report.py +++ b/popmon/pipeline/report.py @@ -80,7 +80,7 @@ def stability_report( def df_stability_report( df, - settings: Optional[Settings] = None, + settings: Settings | None | None = None, time_width=None, time_offset: int = 0, var_dtype=None, @@ -280,7 +280,7 @@ def regenerate( self, store_key: str = "html_report", sections_key: str = "report_sections", - settings: Optional[Settings] = None, + settings: Settings | None = None, ): """Regenerate HTML report with different plot settings :param str sections_key: key to store sections data in the datastore. default is 'report_sections'. diff --git a/popmon/visualization/utils.py b/popmon/visualization/utils.py index 01e4394a..06b05e1c 100644 --- a/popmon/visualization/utils.py +++ b/popmon/visualization/utils.py @@ -25,7 +25,6 @@ import math import warnings from collections import defaultdict -from typing import DefaultDict, Dict, List, Union import numpy as np import pandas as pd @@ -325,7 +324,7 @@ def plot_bars( def plot_traffic_lights_overview(feature, data, metrics: list[str], labels: list[str]): - colors: DefaultDict[str, Dict[str, List[str]]] = defaultdict(dict) + colors: defaultdict[str, dict[str, list[str]]] = defaultdict(dict) color_map = ["g", "y", "r"] for c1, metric in enumerate(metrics): for c2, label in enumerate(labels): @@ -366,7 +365,7 @@ def plot_traffic_lights_alerts_aggregate( yellow = hex_to_rgb(tl_colors["yellow"]) red = hex_to_rgb(tl_colors["red"]) - colors: DefaultDict[str, Dict[str, List[str]]] = defaultdict(dict) + colors: defaultdict[str, dict[str, list[str]]] = defaultdict(dict) for c1, metric in enumerate(metrics): row_max = np.max(data[c1]) for c2, label in enumerate(labels):