From 2698ef94837171086993474a89043cd7e1c1783a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 4 Jan 2023 09:49:19 -0500 Subject: [PATCH] [pre-commit.ci] pre-commit autoupdate (#79) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [pre-commit.ci] pre-commit autoupdate updates: - [github.com/psf/black: 22.10.0 → 22.12.0](https://github.com/psf/black/compare/22.10.0...22.12.0) - [github.com/pre-commit/pre-commit-hooks: v4.3.0 → v4.4.0](https://github.com/pre-commit/pre-commit-hooks/compare/v4.3.0...v4.4.0) - [github.com/PyCQA/isort: 5.10.1 → 5.11.4](https://github.com/PyCQA/isort/compare/5.10.1...5.11.4) - [github.com/asottile/pyupgrade: v3.2.0 → v3.3.1](https://github.com/asottile/pyupgrade/compare/v3.2.0...v3.3.1) - [github.com/pycqa/flake8: 5.0.4 → 6.0.0](https://github.com/pycqa/flake8/compare/5.0.4...6.0.0) - [github.com/pre-commit/mirrors-mypy: v0.982 → v0.991](https://github.com/pre-commit/mirrors-mypy/compare/v0.982...v0.991) * fix: use abc Signed-off-by: Henry Schreiner Signed-off-by: Henry Schreiner Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Henry Schreiner --- .pre-commit-config.yaml | 12 ++++++------ src/uhi/numpy_plottable.py | 5 ++++- 2 files changed, 10 insertions(+), 7 deletions(-) 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