From bc1af47ff47a2569c5b8be8393b2ec8ad724974a Mon Sep 17 00:00:00 2001 From: SiQube Date: Fri, 15 Sep 2023 13:09:07 -0400 Subject: [PATCH] always test 3.8 and 3.11, typealias not a thing yet --- .pre-commit-config.yaml | 2 +- pyproject.toml | 1 - src/pymovements/plotting/main_sequence_plot.py | 2 +- src/pymovements/plotting/traceplot.py | 15 ++++++++++----- 4 files changed, 12 insertions(+), 8 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 90b65b910..12d595fc6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -67,7 +67,7 @@ repos: rev: v1.5.1 hooks: - id: mypy - additional_dependencies: [types-all] + additional_dependencies: [types-all, pandas-stubs, types-tqdm] - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 hooks: diff --git a/pyproject.toml b/pyproject.toml index d50f1b34e..fd6960e23 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -110,7 +110,6 @@ check_untyped_defs = true disallow_incomplete_defs = true disallow_untyped_defs = true warn_redundant_casts = true -warn_unused_ignores = true [[tool.mypy.overrides]] module = "scipy.*" diff --git a/src/pymovements/plotting/main_sequence_plot.py b/src/pymovements/plotting/main_sequence_plot.py index f0f05f09e..7edc7238b 100644 --- a/src/pymovements/plotting/main_sequence_plot.py +++ b/src/pymovements/plotting/main_sequence_plot.py @@ -110,7 +110,7 @@ def main_sequence_plot( alpha=alpha, s=marker_size, marker=marker, - # XXX to handle after https://github.com/pydata/xarray/pull/8030 is merged + # to handle after https://github.com/pydata/xarray/pull/8030 is merged **kwargs, # type: ignore ) diff --git a/src/pymovements/plotting/traceplot.py b/src/pymovements/plotting/traceplot.py index 84156bcbb..eff433e3f 100644 --- a/src/pymovements/plotting/traceplot.py +++ b/src/pymovements/plotting/traceplot.py @@ -21,9 +21,8 @@ from __future__ import annotations import sys +from collections.abc import Sequence from typing import Literal -from typing import Sequence -from typing import TypeAlias import matplotlib.colors import matplotlib.pyplot as plt @@ -40,8 +39,11 @@ if 'pytest' in sys.modules: # pragma: no cover matplotlib.use('Agg') -LinearSegmentedColormapType: TypeAlias = dict[ - Literal['red', 'green', 'blue', 'alpha'], Sequence[tuple[float, ...]], +LinearSegmentedColormapType = dict[ + Literal[ + 'red', 'green', + 'blue', 'alpha', + ], Sequence[tuple[float, ...]], ] DEFAULT_SEGMENTDATA: LinearSegmentedColormapType = { @@ -201,7 +203,10 @@ def traceplot( elif isinstance(cmap_norm, str): # pylint: disable=protected-access - if (scale_class := matplotlib.scale._scale_mapping.get(cmap_norm, None)) is None: + # to handle after https://github.com/pydata/xarray/pull/8030 is merged + if ( + scale_class := matplotlib.scale._scale_mapping.get(cmap_norm, None) # type: ignore + ) is None: raise ValueError(f'cmap_norm string {cmap_norm} is not supported') norm_class = matplotlib.colors.make_norm_from_scale(scale_class)