diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 136eec3..a83373a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -1,11 +1,11 @@ repos: - repo: https://github.com/psf/black - rev: 22.10.0 + rev: 22.12.0 hooks: - id: black - repo: https://github.com/pre-commit/pre-commit-hooks - rev: v4.3.0 + rev: v4.4.0 hooks: - id: check-added-large-files - id: check-case-conflict @@ -19,25 +19,25 @@ repos: - id: trailing-whitespace - repo: https://github.com/PyCQA/isort - rev: 5.10.1 + rev: 5.11.4 hooks: - id: isort - repo: https://github.com/asottile/pyupgrade - rev: v3.2.0 + rev: v3.3.1 hooks: - id: pyupgrade args: ["--py36-plus"] - repo: https://github.com/pycqa/flake8 - rev: 5.0.4 + rev: 6.0.0 hooks: - id: flake8 exclude: docs/conf.py additional_dependencies: [flake8-bugbear, flake8-print] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v0.982 + rev: v0.991 hooks: - id: mypy files: ^(src|tests) diff --git a/src/uhi/numpy_plottable.py b/src/uhi/numpy_plottable.py index ea05625..19083b7 100644 --- a/src/uhi/numpy_plottable.py +++ b/src/uhi/numpy_plottable.py @@ -12,6 +12,7 @@ hist. """ +import abc import enum from typing import TYPE_CHECKING, Any, Iterator, Optional, Sequence, Tuple, Union, cast @@ -179,13 +180,14 @@ def _roottarray_asnumpy( return arr -class ROOTAxis: +class ROOTAxis(abc.ABC): def __init__(self, tAxis: Any) -> None: self.tAx = tAxis def __len__(self) -> int: return self.tAx.GetNbins() # type: ignore[no-any-return] + @abc.abstractmethod def __getitem__(self, index: int) -> Any: pass @@ -196,6 +198,7 @@ def __eq__(self, other: Any) -> bool: aEdges == bEdges for aEdges, bEdges in zip(self, other) ) + @abc.abstractmethod def __iter__(self) -> Union[Iterator[Tuple[float, float]], Iterator[str]]: pass