Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: [pre-commit.ci] pre-commit autoupdate #2535

Merged
merged 2 commits into from
Nov 1, 2024

Conversation

pre-commit-ci[bot]
Copy link
Contributor

@pre-commit-ci pre-commit-ci bot commented Aug 5, 2024

updates:

* Update pre-commit hooks:
   - github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0
   - github.com/astral-sh/ruff-pre-commit: v0.5.0 → v0.6.9
   - github.com/psf/black-pre-commit-mirror: 24.4.2 → 24.10.0
   - github.com/pre-commit/mirrors-mypy: v1.10.1 → v1.11.2
   - github.com/python-jsonschema/check-jsonschema: 0.28.6 → 0.29.3

@matthewfeickert matthewfeickert force-pushed the pre-commit-ci-update-config branch from 367b6b1 to 13ace72 Compare August 5, 2024 23:29
@matthewfeickert matthewfeickert self-assigned this Aug 5, 2024
@matthewfeickert matthewfeickert added chore Other changes that don't modify src or test files need-to-backport tmp label until can be backported to patch release branch labels Aug 5, 2024
Copy link

codecov bot commented Aug 5, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.21%. Comparing base (3d26434) to head (189be40).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2535   +/-   ##
=======================================
  Coverage   98.21%   98.21%           
=======================================
  Files          69       69           
  Lines        4543     4543           
  Branches      804      804           
=======================================
  Hits         4462     4462           
  Misses         48       48           
  Partials       33       33           
Flag Coverage Δ
contrib 97.79% <ø> (ø)
doctest 98.08% <ø> (ø)
unittests-3.10 96.23% <ø> (ø)
unittests-3.11 96.23% <ø> (ø)
unittests-3.12 96.23% <ø> (ø)
unittests-3.8 96.25% <ø> (ø)
unittests-3.9 96.27% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@matthewfeickert matthewfeickert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

pre-commit is failing on mypy now with

mypy with Python 3.8.....................................................Failed
- hook id: mypy
- exit code: 1

src/pyhf/tensor/numpy_backend.py:38: error: Argument 2 to "poisson_logpdf" of "numpy_backend" has incompatible type "Union[ndarray[Any, dtype[number[T@__init__]]], ndarray[Any, dtype[bool]]]"; expected "Union[ndarray[Any, dtype[number[T@log_prob]]], ndarray[Any, dtype[bool]]]"  [arg-type]
src/pyhf/tensor/numpy_backend.py:51: error: Argument 2 to "normal_logpdf" of "numpy_backend" has incompatible type "Union[ndarray[Any, dtype[number[T@__init__]]], ndarray[Any, dtype[bool]]]"; expected "Union[ndarray[Any, dtype[number[T@log_prob]]], ndarray[Any, dtype[bool]]]"  [arg-type]
src/pyhf/tensor/numpy_backend.py:51: error: Argument 3 to "normal_logpdf" of "numpy_backend" has incompatible type "Union[ndarray[Any, dtype[number[T@__init__]]], ndarray[Any, dtype[bool]]]"; expected "Union[ndarray[Any, dtype[number[T@log_prob]]], ndarray[Any, dtype[bool]]]"  [arg-type]
Found 3 errors in 1 file (checked 72 source files)

mypy with Python 3.12....................................................Failed
- hook id: mypy
- exit code: 1

src/pyhf/tensor/numpy_backend.py:38: error: Argument 2 to "poisson_logpdf" of "numpy_backend" has incompatible type "ndarray[Any, dtype[number[T@__init__]]] | ndarray[Any, dtype[bool]]"; expected "ndarray[Any, dtype[number[T@log_prob]]] | ndarray[Any, dtype[bool]]"  [arg-type]
src/pyhf/tensor/numpy_backend.py:51: error: Argument 2 to "normal_logpdf" of "numpy_backend" has incompatible type "ndarray[Any, dtype[number[T@__init__]]] | ndarray[Any, dtype[bool]]"; expected "ndarray[Any, dtype[number[T@log_prob]]] | ndarray[Any, dtype[bool]]"  [arg-type]
src/pyhf/tensor/numpy_backend.py:51: error: Argument 3 to "normal_logpdf" of "numpy_backend" has incompatible type "ndarray[Any, dtype[number[T@__init__]]] | ndarray[Any, dtype[bool]]"; expected "ndarray[Any, dtype[number[T@log_prob]]] | ndarray[Any, dtype[bool]]"  [arg-type]
Found 3 errors in 1 file (checked 72 source files)

@kratsg
Copy link
Contributor

kratsg commented Aug 6, 2024

Looks like there's a slightly different type coercion needed here (taking one as an example0

src/pyhf/tensor/numpy_backend.py:38: error: Argument 2 to "poisson_logpdf" of "numpy_backend" has incompatible type

got:
"Union[ndarray[Any, dtype[number[T@__init__]]], ndarray[Any, dtype[bool]]]"

expected:
"Union[ndarray[Any, dtype[number[T@log_prob]]], ndarray[Any, dtype[bool]]]"

so need to dig into why. The @ notation is throwing me off a little (must be related to the generics). /cc @henryiii or @alexander-held if they've seen this before.

with this code

class _BasicPoisson:
    def __init__(self, rate: Tensor[T]):
        self.rate = rate

    def sample(self, sample_shape: Shape) -> ArrayLike:
        return poisson(self.rate).rvs(size=sample_shape + self.rate.shape)  # type: ignore[no-any-return]

    def log_prob(self, value: NDArray[np.number[T]]) -> ArrayLike:
        tensorlib: numpy_backend[T] = numpy_backend()
        return tensorlib.poisson_logpdf(value, self.rate)

here, it seems to complain about self.rate which is typed as Tensor[T].

@pre-commit-ci pre-commit-ci bot force-pushed the pre-commit-ci-update-config branch from 13ace72 to 373eaae Compare September 2, 2024 21:03
@matthewfeickert matthewfeickert force-pushed the pre-commit-ci-update-config branch from 373eaae to 1f451bd Compare September 19, 2024 13:45
@pre-commit-ci pre-commit-ci bot force-pushed the pre-commit-ci-update-config branch from 1f451bd to 189be40 Compare October 7, 2024 22:33
updates:
- [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v5.0.0](pre-commit/pre-commit-hooks@v4.6.0...v5.0.0)
- [github.com/astral-sh/ruff-pre-commit: v0.5.0 → v0.6.9](astral-sh/ruff-pre-commit@v0.5.0...v0.6.9)
- [github.com/psf/black-pre-commit-mirror: 24.4.2 → 24.10.0](psf/black-pre-commit-mirror@24.4.2...24.10.0)
- [github.com/pre-commit/mirrors-mypy: v1.10.1 → v1.11.2](pre-commit/mirrors-mypy@v1.10.1...v1.11.2)
- [github.com/python-jsonschema/check-jsonschema: 0.28.6 → 0.29.3](python-jsonschema/check-jsonschema@0.28.6...0.29.3)
@matthewfeickert
Copy link
Member

I'm going to merge this even though the CI is broken, as the other components are fine. We can follow up in #2553.

@matthewfeickert matthewfeickert merged commit f73dbc4 into main Nov 1, 2024
11 of 20 checks passed
@matthewfeickert matthewfeickert deleted the pre-commit-ci-update-config branch November 1, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Other changes that don't modify src or test files need-to-backport tmp label until can be backported to patch release branch
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

2 participants