Skip to content

Commit

Permalink
chore(deps): update pre-commit hooks (#946)
Browse files Browse the repository at this point in the history
* chore(deps): update pre-commit hooks

updates:
- [github.com/adamchainz/blacken-docs: 1.16.0 → 1.18.0](adamchainz/blacken-docs@1.16.0...1.18.0)
- [github.com/astral-sh/ruff-pre-commit: v0.4.7 → v0.5.6](astral-sh/ruff-pre-commit@v0.4.7...v0.5.6)
- [github.com/pre-commit/mirrors-mypy: v1.10.0 → v1.11.1](pre-commit/mirrors-mypy@v1.10.0...v1.11.1)
- [github.com/pre-commit/mirrors-clang-format: v18.1.5 → v18.1.8](pre-commit/mirrors-clang-format@v18.1.5...v18.1.8)
- [github.com/python-jsonschema/check-jsonschema: 0.28.4 → 0.29.1](python-jsonschema/check-jsonschema@0.28.4...0.29.1)
- [github.com/henryiii/validate-pyproject-schema-store: 2024.06.10 → 2024.07.29](henryiii/validate-pyproject-schema-store@2024.06.10...2024.07.29)

* style: apply suggestions

Signed-off-by: Henry Schreiner <[email protected]>

---------

Signed-off-by: Henry Schreiner <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Co-authored-by: Henry Schreiner <[email protected]>
  • Loading branch information
pre-commit-ci[bot] and henryiii authored Aug 7, 2024
1 parent 6de83ee commit 4bb688d
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 23 deletions.
12 changes: 6 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ci:

repos:
- repo: https://github.com/adamchainz/blacken-docs
rev: "1.16.0"
rev: "1.18.0"
hooks:
- id: blacken-docs
additional_dependencies: [black==23.*]
Expand Down Expand Up @@ -48,7 +48,7 @@ repos:
]

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.4.7"
rev: "v0.5.6"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
Expand All @@ -57,7 +57,7 @@ repos:
types_or: [python, pyi, jupyter]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.10.0
rev: v1.11.1
hooks:
- id: mypy
files: ^src
Expand All @@ -79,7 +79,7 @@ repos:
exclude: .pre-commit-config.yaml

- repo: https://github.com/pre-commit/mirrors-clang-format
rev: v18.1.5
rev: v18.1.8
hooks:
- id: clang-format
types_or: [c++]
Expand All @@ -92,12 +92,12 @@ repos:
- id: rst-inline-touching-normal

- repo: https://github.com/python-jsonschema/check-jsonschema
rev: 0.28.4
rev: 0.29.1
hooks:
- id: check-readthedocs
- id: check-github-workflows

- repo: https://github.com/henryiii/validate-pyproject-schema-store
rev: 2024.06.10
rev: 2024.07.29
hooks:
- id: validate-pyproject
8 changes: 2 additions & 6 deletions src/boost_histogram/_internal/hist.py
Original file line number Diff line number Diff line change
Expand Up @@ -377,9 +377,7 @@ def __iadd__(self: H, other: Histogram | np.typing.NDArray[Any] | float) -> H:

return self

def __radd__( # type: ignore[misc]
self: H, other: np.typing.NDArray[Any] | float
) -> H:
def __radd__(self: H, other: np.typing.NDArray[Any] | float) -> H:
return self + other

def __sub__(self: H, other: Histogram | np.typing.NDArray[Any] | float) -> H:
Expand All @@ -400,9 +398,7 @@ def __mul__(self: H, other: Histogram | np.typing.NDArray[Any] | float) -> H:
result = self.copy(deep=False)
return result._compute_inplace_op("__imul__", other)

def __rmul__( # type: ignore[misc]
self: H, other: np.typing.NDArray[Any] | float
) -> H:
def __rmul__(self: H, other: np.typing.NDArray[Any] | float) -> H:
return self * other

def __truediv__(self: H, other: Histogram | np.typing.NDArray[Any] | float) -> H:
Expand Down
12 changes: 6 additions & 6 deletions tests/test_minihist_title.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,23 +124,23 @@ def test_hist_convert():
hist_1 = CustomHist(Regular(10, 0, 1, name="a"), Integer(0, 4, name="b"))
hist_bh = bh.Histogram(hist_1)

assert type(hist_bh.axes[0]) == bh.axis.Regular
assert type(hist_bh.axes[1]) == bh.axis.Integer
assert type(hist_bh.axes[0]) is bh.axis.Regular
assert type(hist_bh.axes[1]) is bh.axis.Integer
assert hist_bh.axes[0].name == "a"
assert hist_bh.axes[1].name == "b"

hist_2 = CustomHist(hist_bh)

assert type(hist_2.axes[0]) == Regular
assert type(hist_2.axes[1]) == Integer
assert type(hist_2.axes[0]) is Regular
assert type(hist_2.axes[1]) is Integer
assert hist_2.axes[0].name == "a"
assert hist_2.axes[1].name == "b"

# Just verify no-op status
hist_3 = CustomHist(hist_1)

assert type(hist_3.axes[0]) == Regular
assert type(hist_3.axes[1]) == Integer
assert type(hist_3.axes[0]) is Regular
assert type(hist_3.axes[1]) is Integer
assert hist_3.axes[0].name == "a"
assert hist_3.axes[1].name == "b"

Expand Down
10 changes: 5 additions & 5 deletions tests/test_subclassing.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ class MyPowTransform(bh.axis.transform.Pow, family=NEW_FAMILY):

h = MyHist(MyRegular(10, 0, 2, transform=MyPowTransform(2)), storage=MyIntStorage())

assert type(h) == MyHist
assert type(h) is MyHist
assert h.storage_type == MyIntStorage
assert type(h.axes[0]) == MyRegular
assert type(h.axes[0].transform) == MyPowTransform
assert type(h.axes[0]) is MyRegular
assert type(h.axes[0].transform) is MyPowTransform


def test_subclass_hist_only():
Expand All @@ -32,8 +32,8 @@ class MyHist(bh.Histogram):

h = MyHist(bh.axis.Regular(10, 0, 2))

assert type(h) == MyHist
assert type(h.axes[0]) == bh.axis.Regular
assert type(h) is MyHist
assert type(h.axes[0]) is bh.axis.Regular


def test_copy():
Expand Down

0 comments on commit 4bb688d

Please sign in to comment.