Skip to content

Commit

Permalink
always test 3.8 and 3.11, typealias not a thing yet
Browse files Browse the repository at this point in the history
  • Loading branch information
SiQube committed Sep 15, 2023
1 parent 68a15e7 commit 90bc557
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ test = [
"pybtex",
"pytest>=6.0.0",
"pytest-cov>=4.0.0",
"types-tqdm"
"types-tqdm",
"typing_extensions"
]

[project.urls]
Expand Down Expand Up @@ -110,7 +111,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.*"
Expand Down
2 changes: 1 addition & 1 deletion src/pymovements/plotting/main_sequence_plot.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
)

Expand Down
13 changes: 9 additions & 4 deletions src/pymovements/plotting/traceplot.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,17 @@
from __future__ import annotations

import sys
from typing import Dict
from typing import Literal
from typing import Sequence
from typing import TypeAlias
from typing import Tuple

import matplotlib.colors
import matplotlib.pyplot as plt
import matplotlib.scale
import numpy as np
from matplotlib.collections import LineCollection
from typing_extensions import TypeAlias

from pymovements.gaze.gaze_dataframe import GazeDataFrame

Expand All @@ -40,8 +42,8 @@
if 'pytest' in sys.modules: # pragma: no cover
matplotlib.use('Agg')

LinearSegmentedColormapType: TypeAlias = dict[
Literal['red', 'green', 'blue', 'alpha'], Sequence[tuple[float, ...]],
LinearSegmentedColormapType: TypeAlias = Dict[
Literal['red', 'green', 'blue', 'alpha'], Sequence[Tuple[float, ...]],
]

DEFAULT_SEGMENTDATA: LinearSegmentedColormapType = {
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 90bc557

Please sign in to comment.