Skip to content

Commit

Permalink
chore: [pre-commit.ci] pre-commit autoupdate (#2264)
Browse files Browse the repository at this point in the history
* Update pre-commit hooks:
   - github.com/astral-sh/ruff-pre-commit: v0.0.276 → v0.0.281
   - github.com/psf/black-pre-commit-mirror: 23.3.0 → 23.7.0
   - github.com/asottile/blacken-docs: 1.14.0 → 1.15.0
* Apply Ruff's fix of using `next` on a iterator over building a
  list and then getting the 0th item.
  • Loading branch information
pre-commit-ci[bot] authored Aug 10, 2023
1 parent 6c35247 commit 6f8ad2e
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,21 +27,21 @@ repos:
exclude: ^validation/|\.dtd$|\.xml$

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.0.276"
rev: "v0.0.281"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]

- repo: https://github.com/psf/black-pre-commit-mirror
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black-jupyter

- repo: https://github.com/asottile/blacken-docs
rev: 1.14.0
rev: 1.15.0
hooks:
- id: blacken-docs
additional_dependencies: [black==23.3.0]
additional_dependencies: [black==23.7.0]

- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.4.1
Expand All @@ -62,7 +62,7 @@ repos:
rev: 1.7.0
hooks:
- id: nbqa-ruff
additional_dependencies: [ruff==0.0.276]
additional_dependencies: [ruff==0.0.281]
args: ["--extend-ignore=F821,F401,F841,F811"]

- repo: https://github.com/codespell-project/codespell
Expand Down
2 changes: 1 addition & 1 deletion src/pyhf/contrib/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ def download(archive_url, output_directory, force=False, compress=False):
# directory up and then renamed as the name of the
# zipfile directory is set at zipfile creation time and
# isn't knowable in advance.
child_path = [child for child in output_directory.iterdir()][0]
child_path = next(iter(output_directory.iterdir()))
_tmp_path = output_directory.parent.joinpath(
Path(output_directory.name + "__tmp__")
)
Expand Down
4 changes: 2 additions & 2 deletions src/pyhf/contrib/viz/brazil.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,9 +361,9 @@ def plot_results(test_pois, tests, test_size=0.05, ax=None, **kwargs):
handles, labels = ax.get_legend_handles_labels()
if not no_cls:
for label_part in ["exp", "pm1", "pm2", "alpha"]:
label_idx = [
label_idx = next(
idx for idx, label in enumerate(labels) if label_part in label
][0]
)
handles.append(handles.pop(label_idx))
labels.append(labels.pop(label_idx))

Expand Down
6 changes: 3 additions & 3 deletions tests/test_workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ def test_join_items_outer_deep(join_items):
joined = pyhf.workspace._join_items(
'outer', left_items, right_items, key='name', deep_merge_key='deep'
)
assert [k['deep'] for k in joined if k['name'] == 'common'][0] == [
assert next(k['deep'] for k in joined if k['name'] == 'common') == [
{'name': 1},
{'name': 2},
]
Expand All @@ -389,7 +389,7 @@ def test_join_items_left_outer_deep(join_items):
joined = pyhf.workspace._join_items(
'left outer', left_items, right_items, key='name', deep_merge_key='deep'
)
assert [k['deep'] for k in joined if k['name'] == 'common'][0] == [
assert next(k['deep'] for k in joined if k['name'] == 'common') == [
{'name': 1},
{'name': 2},
]
Expand All @@ -400,7 +400,7 @@ def test_join_items_right_outer_deep(join_items):
joined = pyhf.workspace._join_items(
'right outer', left_items, right_items, key='name', deep_merge_key='deep'
)
assert [k['deep'] for k in joined if k['name'] == 'common'][0] == [
assert next(k['deep'] for k in joined if k['name'] == 'common') == [
{'name': 2},
{'name': 1},
]
Expand Down

0 comments on commit 6f8ad2e

Please sign in to comment.