From 6790acec85f9c7c1dfe5bb71c3de2466a13852ba Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 1 Aug 2023 04:10:57 +0000 Subject: [PATCH] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/pyhf/contrib/utils.py | 2 +- src/pyhf/contrib/viz/brazil.py | 4 ++-- tests/test_workspace.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/pyhf/contrib/utils.py b/src/pyhf/contrib/utils.py index 87ca46d33e..02c9ffb5f2 100644 --- a/src/pyhf/contrib/utils.py +++ b/src/pyhf/contrib/utils.py @@ -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__") ) diff --git a/src/pyhf/contrib/viz/brazil.py b/src/pyhf/contrib/viz/brazil.py index da492485d2..4e25a63c1b 100644 --- a/src/pyhf/contrib/viz/brazil.py +++ b/src/pyhf/contrib/viz/brazil.py @@ -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)) diff --git a/tests/test_workspace.py b/tests/test_workspace.py index 737e77021c..55ee0df046 100644 --- a/tests/test_workspace.py +++ b/tests/test_workspace.py @@ -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}, ] @@ -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}, ] @@ -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}, ]