From a2b670497038ba5f0123ad07eeb728333ff55d7a Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 5 Sep 2023 03:52:07 +0000 Subject: [PATCH 1/4] chore: [pre-commit.ci] pre-commit autoupdate MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit updates: - [github.com/astral-sh/ruff-pre-commit: v0.0.281 → v0.0.287](https://github.com/astral-sh/ruff-pre-commit/compare/v0.0.281...v0.0.287) - [github.com/adamchainz/blacken-docs: 1.15.0 → 1.16.0](https://github.com/adamchainz/blacken-docs/compare/1.15.0...1.16.0) - [github.com/pre-commit/mirrors-mypy: v1.4.1 → v1.5.1](https://github.com/pre-commit/mirrors-mypy/compare/v1.4.1...v1.5.1) --- .pre-commit-config.yaml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7359a989c0..8c4e2aee07 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -27,7 +27,7 @@ repos: exclude: ^validation/|\.dtd$|\.xml$ - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.0.281" + rev: "v0.0.287" hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -38,13 +38,13 @@ repos: - id: black-jupyter - repo: https://github.com/adamchainz/blacken-docs - rev: 1.15.0 + rev: 1.16.0 hooks: - id: blacken-docs additional_dependencies: [black==23.7.0] - repo: https://github.com/pre-commit/mirrors-mypy - rev: v1.4.1 + rev: v1.5.1 # check the oldest and newest supported Pythons hooks: - &mypy From 28892c1db2793cf45a858c4d5d60f3913b64f7ff Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Mon, 4 Sep 2023 23:09:26 -0500 Subject: [PATCH 2/4] Update additional_dependencies --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8c4e2aee07..0fe147c346 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -62,7 +62,7 @@ repos: rev: 1.7.0 hooks: - id: nbqa-ruff - additional_dependencies: [ruff==0.0.281] + additional_dependencies: [ruff==0.0.287] args: ["--extend-ignore=F821,F401,F841,F811"] - repo: https://github.com/codespell-project/codespell From 2e0f2ab012a5c1ac2faf798a6d4543ecdfb18935 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Mon, 4 Sep 2023 23:14:33 -0500 Subject: [PATCH 3/4] ruff: E721 Do not compare types, use isinstance() --- src/pyhf/parameters/paramsets.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/src/pyhf/parameters/paramsets.py b/src/pyhf/parameters/paramsets.py index c5daebf034..2562c89305 100644 --- a/src/pyhf/parameters/paramsets.py +++ b/src/pyhf/parameters/paramsets.py @@ -30,7 +30,7 @@ def __init__(self, **kwargs): @property def suggested_fixed(self) -> List[bool]: - if type(self._suggested_fixed) == bool: + if isinstance(self._suggested_fixed, bool): return [self._suggested_fixed] * self.n_parameters return self._suggested_fixed @@ -47,11 +47,9 @@ def suggested_fixed_as_bool(self) -> bool: @suggested_fixed.setter def suggested_fixed(self, value): - if type(value) == bool: - self._suggested_fixed = value - else: + if not isinstance(value, bool): assert len(value) == self.n_parameters - self._suggested_fixed = value + self._suggested_fixed = value class unconstrained(paramset): From 836fbd9f2043652aa572bac204c6824a49682a54 Mon Sep 17 00:00:00 2001 From: Matthew Feickert Date: Mon, 4 Sep 2023 23:15:56 -0500 Subject: [PATCH 4/4] mypy: Unused "type: ignore" comment [unused-ignore] --- src/pyhf/readxml.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/pyhf/readxml.py b/src/pyhf/readxml.py index d1942bfe4e..a694dab292 100644 --- a/src/pyhf/readxml.py +++ b/src/pyhf/readxml.py @@ -340,7 +340,9 @@ def process_measurements( other_parameter_configs = other_parameter_configs if other_parameter_configs else [] for x in toplvl.findall('Measurement'): - parameter_configs_map: MutableMapping[str, Parameter] = {k['name']: dict(**k) for k in other_parameter_configs} # type: ignore[misc] + parameter_configs_map: MutableMapping[str, Parameter] = { + k['name']: dict(**k) for k in other_parameter_configs + } lumi = float(x.attrib['Lumi']) lumierr = lumi * float(x.attrib['LumiRelErr'])