diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 80280f70..bb56f2c1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -43,7 +43,7 @@ repos: args: ["--extend-ignore=B008,T20,I002,E402", "--fix", "--show-fixes"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.5.1 + rev: v1.6.0 hooks: - id: mypy files: ^src diff --git a/src/hist/axis/__init__.py b/src/hist/axis/__init__.py index 4b200338..4a3b7598 100644 --- a/src/hist/axis/__init__.py +++ b/src/hist/axis/__init__.py @@ -1,6 +1,8 @@ from __future__ import annotations -from typing import Any, Iterable +import typing +from collections.abc import Iterable +from typing import Any import boost_histogram as bh import boost_histogram.axis as bha @@ -57,7 +59,7 @@ def name(self: AxisProtocol) -> str: """ Get the name for the Regular axis """ - return self._ax.metadata.get("name", "") + return typing.cast(str, self._ax.metadata.get("name", "")) @property def label(self: AxisProtocol) -> str: diff --git a/src/hist/plot.py b/src/hist/plot.py index d69c7ebc..f080ab36 100644 --- a/src/hist/plot.py +++ b/src/hist/plot.py @@ -193,7 +193,7 @@ def _plot_keywords_wrapper(ax: matplotlib.axes.Axes, legend: bool | None) -> Non # Todo: more keywords here if legend: if ax.get_legend_handles_labels()[0]: - legend = ax.legend() + ax.legend() else: raise ValueError("No labels to legend") @@ -517,7 +517,8 @@ def plot_pull_array( downRect_startpoint, patch_width, patch_height, **pp_kwargs ) ax.add_patch(downRect) - patch_artists.append((downRect, upRect)) + patch_artists.append(downRect) + patch_artists.append(upRect) ax.set_xlim(left_edge, right_edge)