Skip to content

Commit

Permalink
[pre-commit.ci] auto fixes from pre-commit.com hooks
Browse files Browse the repository at this point in the history
for more information, see https://pre-commit.ci
  • Loading branch information
pre-commit-ci[bot] committed Aug 1, 2023
1 parent 8b1d991 commit d0ad10d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
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()))

Check warning on line 118 in src/pyhf/contrib/utils.py

View check run for this annotation

Codecov / codecov/patch

src/pyhf/contrib/utils.py#L118

Added line #L118 was not covered by tests
_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 d0ad10d

Please sign in to comment.