Skip to content

Commit

Permalink
chore(backport): Update pre-commit hooks (#2317)
Browse files Browse the repository at this point in the history
* Backport:
   - PR #2305
   - PR #2314
  • Loading branch information
matthewfeickert committed Sep 6, 2023
1 parent 6b93898 commit db7cad0
Show file tree
Hide file tree
Showing 3 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,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 @@ -37,14 +37,14 @@ repos:
hooks:
- id: black-jupyter

- repo: https://github.com/asottile/blacken-docs
rev: 1.15.0
- repo: https://github.com/adamchainz/blacken-docs
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
# Though use Python 3.8 as the oldest Python to run mypy
# to avoid positional-only errors from NumPy in Python 3.11
Expand All @@ -65,7 +65,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 db7cad0

Please sign in to comment.