Skip to content

Commit

Permalink
chore: [pre-commit.ci] pre-commit autoupdate (#2314)
Browse files Browse the repository at this point in the history
* Update pre-commit hooks:
   - github.com/astral-sh/ruff-pre-commit: v0.0.281 → v0.0.287
   - github.com/adamchainz/blacken-docs: 1.15.0 → 1.16.0
   - github.com/pre-commit/mirrors-mypy: v1.4.1 → v1.5.1
* Apply requested Ruff changes to src/pyhf/parameters/paramsets.py
  for 'E721 Do not compare types, use `isinstance()`' and
  refactor logic.
* Apply requested mypy changes to src/pyhf/readxml.py to remove
  unused "type: ignore" comment [unused-ignore].

Co-authored-by: Matthew Feickert <matthew.feickert@cern.ch>
  • Loading branch information
pre-commit-ci[bot] and matthewfeickert authored Sep 5, 2023
1 parent 17e80c2 commit 2325b05
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand All @@ -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
Expand All @@ -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
Expand Down
8 changes: 3 additions & 5 deletions src/pyhf/parameters/paramsets.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -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):
Expand Down
4 changes: 3 additions & 1 deletion src/pyhf/readxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'])

Expand Down

0 comments on commit 2325b05

Please sign in to comment.