Repository navigation
Conversation
Contributor
|
Diff from mypy_primer, showing the effect of this PR on open source code: pytensor (https://github.com/pymc-devs/pytensor)
- pytensor/tensor/random/basic.py:632: error: Signature of "__call__" incompatible with supertype "pytensor.tensor.random.op.RandomVariable" [override]
- pytensor/tensor/random/basic.py:632: note: Superclass:
- pytensor/tensor/random/basic.py:632: note: def __call__(self, *args: Any, size: Any = ..., name: Any = ..., rng: Any = ..., dtype: Any = ..., return_next_rng: bool = ..., **kwargs: Any) -> Any
- pytensor/tensor/random/basic.py:632: note: Subclass:
- pytensor/tensor/random/basic.py:632: note: def __call__(self, loc: ndarray[tuple[Any, ...], dtype[Any]] | float, scale: ndarray[tuple[Any, ...], dtype[Any]] | float = ..., size: list[int] | int | None = ..., **kwargs: Any) -> RandomVariable
jax (https://github.com/google/jax)
- jax/_src/pallas/mosaic/random.py:160: error: Argument 1 to "_make_stateful_sampler" has incompatible type overloaded function; expected "SampleFn" [arg-type]
- jax/_src/pallas/mosaic/random.py:160: note: "SampleFn.__call__" has type "def __call__(self, key: Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | number[Any, Any] | builtins.bool | int | float | complex, *args: Any, shape: Sequence[int], **kwargs: Any) -> Array"
- jax/_src/pallas/mosaic/random.py:161: error: Argument 1 to "_make_stateful_sampler" has incompatible type "def uniform(key: Key | Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | number[Any, Any] | builtins.bool | int | float | complex, shape: Sequence[int] = ..., dtype: str | type[Any] | dtype[Any] | SupportsDType | None = ..., minval: Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | number[Any, Any] | builtins.bool | int | float | complex = ..., maxval: Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | number[Any, Any] | builtins.bool | int | float | complex = ..., *, out_sharding: NamedSharding | P | None = ...) -> Array"; expected "SampleFn" [arg-type]
- jax/_src/pallas/mosaic/random.py:161: note: "SampleFn.__call__" has type "def __call__(self, key: Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | number[Any, Any] | builtins.bool | int | float | complex, *args: Any, shape: Sequence[int], **kwargs: Any) -> Array"
- jax/_src/pallas/mosaic/random.py:162: error: Argument 1 to "_make_stateful_sampler" has incompatible type "def bernoulli(key: Key | Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | number[Any, Any] | builtins.bool | int | float | complex, p: Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | number[Any, Any] | builtins.bool | int | float | complex = ..., shape: Sequence[int] | None = ..., mode: str = ..., *, out_sharding: NamedSharding | P | None = ...) -> Array"; expected "SampleFn" [arg-type]
- jax/_src/pallas/mosaic/random.py:162: note: "SampleFn.__call__" has type "def __call__(self, key: Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | number[Any, Any] | builtins.bool | int | float | complex, *args: Any, shape: Sequence[int], **kwargs: Any) -> Array"
- jax/_src/pallas/mosaic/random.py:163: error: Argument 1 to "_make_stateful_sampler" has incompatible type "def normal(key: Key | Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | number[Any, Any] | builtins.bool | int | float | complex, shape: Sequence[int] = ..., dtype: str | type[Any] | dtype[Any] | SupportsDType | None = ..., *, mode: str | None = ..., out_sharding: NamedSharding | P | None = ...) -> Array"; expected "SampleFn" [arg-type]
- jax/_src/pallas/mosaic/random.py:163: note: "SampleFn.__call__" has type "def __call__(self, key: Array | ndarray[tuple[Any, ...], dtype[Any]] | numpy.bool[builtins.bool] | number[Any, Any] | builtins.bool | int | float | complex, *args: Any, shape: Sequence[int], **kwargs: Any) -> Array"
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Callback protocols with
*args: Any, an explicit keyword-only parameter, and**kwargs: Anyreject callbacks that implement the explicit parameter but omit arbitrary varargs. Treat the Any-typed vararg pair as a callable ellipsis while continuing to check explicitly declared parameters, and cover both matching and missing required keywords with a regression test.Verified with the focused callback protocol test and the full
check-protocols.testsuite (204 passed, 1 skipped).Fixes #22460