From 17e80c2b84a4957035584671de89e04f6e8a229b Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 4 Sep 2023 18:08:03 -0500 Subject: [PATCH 1/2] build(deps): bump actions/checkout from 3 to 4 (#2313) Bumps [actions/checkout](https://github.com/actions/checkout) from 3 to 4. - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v3...v4) --- updated-dependencies: - dependency-name: actions/checkout dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- .github/workflows/bump-version.yml | 2 +- .github/workflows/ci.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/dependencies-head.yml | 12 ++++++------ .github/workflows/docker.yml | 2 +- .github/workflows/docs.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/lower-bound-requirements.yml | 2 +- .github/workflows/merged.yml | 2 +- .github/workflows/notebooks.yml | 2 +- .github/workflows/publish-package.yml | 2 +- .github/workflows/release_tests.yml | 2 +- 12 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/bump-version.yml b/.github/workflows/bump-version.yml index eb171387a0..607db63612 100644 --- a/.github/workflows/bump-version.yml +++ b/.github/workflows/bump-version.yml @@ -47,7 +47,7 @@ jobs: steps: # Use GitHub PAT to authenticate so other workflows trigger - name: Checkout code - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: ref: ${{ github.event.inputs.target_branch }} fetch-depth: 0 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7d3a83cbdd..81324f2884 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,7 +33,7 @@ jobs: python-version: '3.11' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 110ca0eb2a..8319caaeb3 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -22,7 +22,7 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL diff --git a/.github/workflows/dependencies-head.yml b/.github/workflows/dependencies-head.yml index 5fe1e19eba..ab2e8e8de2 100644 --- a/.github/workflows/dependencies-head.yml +++ b/.github/workflows/dependencies-head.yml @@ -20,7 +20,7 @@ jobs: python-version: ['3.11'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 @@ -50,7 +50,7 @@ jobs: python-version: ['3.11'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 @@ -80,7 +80,7 @@ jobs: python-version: ['3.11'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -106,7 +106,7 @@ jobs: python-version: ['3.11'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: @@ -131,7 +131,7 @@ jobs: python-version: ['3.11'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 @@ -168,7 +168,7 @@ jobs: python-version: ['3.11'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 with: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 379c4794e5..8fc22f4621 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -26,7 +26,7 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 - name: Prepare diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index 73ff09d5c1..99540eb67b 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e84cf76ff1..fdce2d7b28 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Lint Dockerfile uses: hadolint/hadolint-action@v3.1.0 diff --git a/.github/workflows/lower-bound-requirements.yml b/.github/workflows/lower-bound-requirements.yml index df569f31c2..27e9a9cf4c 100644 --- a/.github/workflows/lower-bound-requirements.yml +++ b/.github/workflows/lower-bound-requirements.yml @@ -17,7 +17,7 @@ jobs: python-version: ['3.8'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 diff --git a/.github/workflows/merged.yml b/.github/workflows/merged.yml index 3ea8a5cc4d..3923caaffe 100644 --- a/.github/workflows/merged.yml +++ b/.github/workflows/merged.yml @@ -11,7 +11,7 @@ jobs: runs-on: ubuntu-latest if: github.event.pull_request.merged steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Trigger Binder build run: | # Use Binder build API to trigger repo2docker to build image on Google Cloud and Turing Institute Binder Federation clusters diff --git a/.github/workflows/notebooks.yml b/.github/workflows/notebooks.yml index baaceeba92..47c6acaff0 100644 --- a/.github/workflows/notebooks.yml +++ b/.github/workflows/notebooks.yml @@ -19,7 +19,7 @@ jobs: python-version: ['3.11'] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v4 diff --git a/.github/workflows/publish-package.yml b/.github/workflows/publish-package.yml index 51a009e2ce..eb956eb506 100644 --- a/.github/workflows/publish-package.yml +++ b/.github/workflows/publish-package.yml @@ -29,7 +29,7 @@ jobs: name: Build Python distribution runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 diff --git a/.github/workflows/release_tests.yml b/.github/workflows/release_tests.yml index 411645c18d..7fbbe46828 100644 --- a/.github/workflows/release_tests.yml +++ b/.github/workflows/release_tests.yml @@ -24,7 +24,7 @@ jobs: python-version: '3.11' steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} uses: actions/setup-python@v4 From 2325b05e1f67ee4d1db87002ba1ced428c8746a4 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 08:40:52 -0500 Subject: [PATCH 2/2] chore: [pre-commit.ci] pre-commit autoupdate (#2314) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 --- .pre-commit-config.yaml | 8 ++++---- src/pyhf/parameters/paramsets.py | 8 +++----- src/pyhf/readxml.py | 4 +++- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 7359a989c0..0fe147c346 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 @@ -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 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): 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'])