diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index c74c4f82..2d77438c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -29,19 +29,19 @@ repos: additional_dependencies: [pyyaml] - repo: https://github.com/asottile/setup-cfg-fmt - rev: v2.3.0 + rev: v2.4.0 hooks: - id: setup-cfg-fmt - args: [--include-version-classifiers, --max-py-version=3.11] + args: [--include-version-classifiers, --min-py3-version=3.7, --max-py-version=3.11] - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.0.272" + rev: "v0.0.276" hooks: - id: ruff args: ["--fix", "--show-fixes"] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.3.0 + rev: v1.4.1 hooks: - id: mypy files: ^src diff --git a/src/boost_histogram/_internal/axestuple.py b/src/boost_histogram/_internal/axestuple.py index b68c4bf2..3247836e 100644 --- a/src/boost_histogram/_internal/axestuple.py +++ b/src/boost_histogram/_internal/axestuple.py @@ -1,7 +1,7 @@ from __future__ import annotations from functools import partial -from typing import Any, Iterable, TypeVar +from typing import Any, ClassVar, Iterable, TypeVar import numpy as np @@ -21,7 +21,7 @@ class MGridOpts(TypedDict): class ArrayTuple(tuple): # type: ignore[type-arg] __slots__ = () # This is an exhaustive list as of NumPy 1.19 - _REDUCTIONS = {"sum", "any", "all", "min", "max", "prod"} + _REDUCTIONS = frozenset(("sum", "any", "all", "min", "max", "prod")) def __getattr__(self, name: str) -> Any: if name in self._REDUCTIONS: @@ -51,7 +51,7 @@ def broadcast(self: A) -> A: @set_module("boost_histogram.axis") class AxesTuple(tuple): # type: ignore[type-arg] __slots__ = () - _MGRIDOPTS: MGridOpts = {"sparse": True, "indexing": "ij"} + _MGRIDOPTS: ClassVar[MGridOpts] = {"sparse": True, "indexing": "ij"} def __init__(self, __iterable: Iterable[Axis]) -> None: for item in self: