Skip to content

Commit f330654

Browse files
henryiiiandrzejnovak
authored andcommitted
style: add some grep checks
1 parent ecf61eb commit f330654

File tree

3 files changed

+19
-5
lines changed

3 files changed

+19
-5
lines changed

.pre-commit-config.yaml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,3 +65,15 @@ repos:
6565
- id: codespell
6666
args: ["-L", "hist,heros"]
6767
exclude: "^examples/Examples.ipynb$"
68+
69+
- repo: https://github.com/pre-commit/pygrep-hooks
70+
rev: "v1.9.0"
71+
hooks:
72+
- id: python-check-blanket-noqa
73+
- id: python-check-blanket-type-ignore
74+
- id: python-no-log-warn
75+
- id: python-no-eval
76+
- id: python-use-type-annotations
77+
- id: rst-backticks
78+
- id: rst-directive-colons
79+
- id: rst-inline-touching-normal

docs/source/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
.. mplhep documentation master file, created by
22
sphinx-quickstart on Sun Apr 12 14:08:38 2020.
33
You can adapt this file completely to your liking, but it should at least
4-
contain the root `toctree` directive.
4+
contain the root ``toctree`` directive.
55
66
77
======

src/mplhep/utils.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ def get_plottable_protocol_bins(
2727
out = np.arange(len(axis) + 1).astype(float)
2828
if isinstance(axis[0], tuple): # Regular axis
2929
out[0] = axis[0][0]
30-
out[1:] = [axis[i][1] for i in range(len(axis))] # type: ignore
30+
out[1:] = [axis[i][1] for i in range(len(axis))] # type: ignore[index]
3131
labels = None
3232
else: # Categorical axis
3333
labels = np.array([axis[i] for i in range(len(axis))])
@@ -95,18 +95,20 @@ def process_histogram_parts(
9595
):
9696
return _process_histogram_parts_iter(H, *bins)
9797
else:
98-
return _process_histogram_parts_iter((H,), *bins) # type: ignore
98+
return _process_histogram_parts_iter((H,), *bins) # type: ignore[arg-type]
9999

100100

101101
def _process_histogram_parts_iter(
102102
hists: Iterable[ArrayLike] | Iterable[PlottableHistogram],
103103
*bins: Sequence[float | None],
104104
) -> Iterable[PlottableHistogram]:
105-
original_bins: tuple[Sequence[float], ...] = bins # type: ignore
105+
original_bins: tuple[Sequence[float], ...] = bins # type: ignore[assignment]
106106

107107
for hist in hists:
108108
h = hist_object_handler(hist, *bins)
109-
current_bins: tuple[Sequence[float], ...] = tuple(get_plottable_protocol_bins(a)[0] for a in h.axes) # type: ignore
109+
current_bins: tuple[Sequence[float], ...] = tuple(
110+
get_plottable_protocol_bins(a)[0] for a in h.axes # type: ignore[misc]
111+
)
110112
if any(b is None for b in original_bins):
111113
original_bins = current_bins
112114
if len(current_bins) != len(original_bins):

0 commit comments

Comments
 (0)