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

Add mypy dependency and instructions when test fails #6195

Merged
merged 2 commits into from
Oct 9, 2022

Conversation

ricardoV94
Copy link
Member

@ricardoV94 ricardoV94 commented Oct 9, 2022

Major / Breaking Changes

  • None

Bugfixes / New features

  • None

Docs / Maintenance

  • Add mypy dependency and instructions when test fails

@ricardoV94 ricardoV94 added Github CI/CD no releasenotes Skipped in automatic release notes generation labels Oct 9, 2022
@ricardoV94 ricardoV94 force-pushed the improve_mypy_instructions branch from 4043307 to 543c69b Compare October 9, 2022 15:44
@codecov
Copy link

codecov bot commented Oct 9, 2022

Codecov Report

Merging #6195 (543c69b) into main (a574ed5) will increase coverage by 11.61%.
The diff coverage is n/a.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff             @@
##             main    #6195       +/-   ##
===========================================
+ Coverage   81.62%   93.24%   +11.61%     
===========================================
  Files         101      101               
  Lines       22093    22093               
===========================================
+ Hits        18034    20601     +2567     
+ Misses       4059     1492     -2567     
Impacted Files Coverage Δ
pymc/tests/step_methods/test_compound.py 0.00% <0.00%> (-100.00%) ⬇️
pymc/distributions/multivariate.py 92.24% <0.00%> (+0.11%) ⬆️
pymc/backends/arviz.py 90.61% <0.00%> (+0.81%) ⬆️
pymc/distributions/distribution.py 95.90% <0.00%> (+2.72%) ⬆️
pymc/aesaraf.py 93.54% <0.00%> (+3.35%) ⬆️
pymc/variational/updates.py 92.11% <0.00%> (+3.44%) ⬆️
pymc/distributions/logprob.py 97.26% <0.00%> (+4.10%) ⬆️
pymc/initial_point.py 100.00% <0.00%> (+5.88%) ⬆️
pymc/backends/ndarray.py 79.46% <0.00%> (+6.25%) ⬆️
pymc/variational/opvi.py 87.04% <0.00%> (+11.84%) ⬆️
... and 21 more

@maresb
Copy link
Contributor

maresb commented Oct 9, 2022

Hey there, just got the review request, and I'm trying to catch up on context. I managed to find #5907, and I was myself also frustrated by the slow mypy in pre-commit.

If I'm understanding correctly, @michaelosthege transferred mypy to run only in the workflow. This has the disadvantage that you don't notice the mypy failure until the workflow runs. This PR addresses this by configuring the local dev environment and giving a message clarifying how to run locally.

Am I understanding correctly? If so, this looks excellent. I haven't tested it locally yet, but I'll give it a shot momentarily...

@maresb
Copy link
Contributor

maresb commented Oct 9, 2022

I'm traveling with my laptop and set up a fresh pymc dev environment, and ran the command. Looks like there are a bunch of errors:

output:
$ python scripts/run_mypy.py --verbose


[pymc/aesaraf.py]
pymc/aesaraf.py:205: error: Incompatible types in "yield from" (actual type "Union[TensorVariable[Any, Any], Tuple[Any, Optional[Iterable[Any]]]]", expected type "TensorVariable[Any, Any]")
pymc/aesaraf.py:248: error: Incompatible types in assignment (expression has type "Dict[Union[Apply[Any], Variable[Any, Any], Op], Union[Apply[Any], Variable[Any, Any], Op]]", variable has type "Dict[TensorVariable[Any, Any], TensorVariable[Any, Any]]")
pymc/aesaraf.py:248: error: Argument 2 to "clone_get_equiv" has incompatible type "Iterable[TensorVariable[Any, Any]]"; expected "Sequence[Variable[Any, Any]]"
pymc/aesaraf.py:248: error: Argument 5 to "clone_get_equiv" has incompatible type "Dict[TensorVariable[Any, Any], TensorVariable[Any, Any]]"; expected "Optional[Dict[Union[Apply[Any], Variable[Any, Any], Op], Union[Apply[Any], Variable[Any, Any], Op]]]"
pymc/aesaraf.py:251: error: Invalid index type "Variable[Any, Any]" for "Dict[TensorVariable[Any, Any], TensorVariable[Any, Any]]"; expected type "TensorVariable[Any, Any]"
pymc/aesaraf.py:258: error: Argument 1 to "list" has incompatible type "List[Variable[Any, Any]]"; expected "Iterable[TensorVariable[Any, Any]]"
pymc/aesaraf.py:260: error: Incompatible return value type (got "Tuple[Iterable[TensorVariable[Any, Any]], Dict[TensorVariable[Any, Any], TensorVariable[Any, Any]]]", expected "Tuple[TensorVariable[Any, Any], Dict[TensorVariable[Any, Any], TensorVariable[Any, Any]]]")
pymc/aesaraf.py:311: error: Argument 2 to "clone_get_equiv" has incompatible type "Iterable[TensorVariable[Any, Any]]"; expected "Sequence[Variable[Any, Any]]"
pymc/aesaraf.py:312: error: List comprehension has incompatible type List[Union[Apply[Any], Variable[Any, Any], Op]]; expected List[TensorVariable[Any, Any]]
pymc/aesaraf.py:316: error: Key expression in dictionary comprehension has incompatible type "Union[Apply[Any], Variable[Any, Any], Op]"; expected type "TensorVariable[Any, Any]"
pymc/aesaraf.py:316: error: Value expression in dictionary comprehension has incompatible type "Union[Apply[Any], Variable[Any, Any], Op]"; expected type "TensorVariable[Any, Any]"
pymc/aesaraf.py:321: error: Argument "replacement_fn" to "replace_rvs_in_graphs" has incompatible type "Callable[[TensorVariable[Any, Any], Dict[TensorVariable[Any, Any], TensorVariable[Any, Any]]], List[TensorVariable[Any, Any]]]"; expected "Callable[[TensorVariable[Any, Any]], Dict[TensorVariable[Any, Any], TensorVariable[Any, Any]]]"
pymc/aesaraf.py:569: error: Invalid index type "Optional[str]" for "Dict[str, ndarray[Any, Any]]"; expected type "str"
pymc/aesaraf.py:578: error: Invalid index type "Optional[str]" for "Dict[str, ndarray[Any, Any]]"; expected type "str"
pymc/aesaraf.py:585: error: Argument 1 to "clone_replace" has incompatible type "TensorVariable[Any, Any]"; expected "Collection[Variable[Any, Any]]"
pymc/aesaraf.py:585: note: "TensorVariable" is missing following "Collection" protocol members:
pymc/aesaraf.py:585: note:     __contains__, __len__
pymc/aesaraf.py:585: error: Argument 2 to "clone_replace" has incompatible type "Dict[TensorVariable[Any, Any], Any]"; expected "Union[Iterable[Tuple[Variable[Any, Any], Variable[Any, Any]]], Dict[Variable[Any, Any], Variable[Any, Any]], None]"
pymc/aesaraf.py:851: error: Argument 2 to "zip" has incompatible type "List[Union[RandomState, Generator]]"; expected "Iterable[Variable[Any, Any]]"
pymc/aesaraf.py:852: error: Incompatible return value type (got "List[Variable[Any, Any]]", expected "Sequence[TensorVariable[Any, Any]]")
pymc/aesaraf.py:864: error: Argument 1 to "SeedSequence" has incompatible type "Union[int, Sequence[int], ndarray[Any, Any], SeedSequence, None]"; expected "Union[None, int, Sequence[int], Union[_SupportsArray[dtype[Union[bool_, integer[Any]]]], _NestedSequence[_SupportsArray[dtype[Union[bool_, integer[Any]]]]], bool, int, _NestedSequence[Union[bool, int]]]]"
pymc/aesaraf.py:953: error: Argument 1 to "reseed_rngs" has incompatible type "dict_keys[Any, Any]"; expected "Sequence[SharedVariable]"
pymc/aesaraf.py:997: error: Item "Variable[Any, Any]" of "Union[Variable[Any, Any], Sequence[Variable[Any, Any]], FunctionGraph]" has no attribute "outputs"
pymc/aesaraf.py:997: error: Item "Sequence[Variable[Any, Any]]" of "Union[Variable[Any, Any], Sequence[Variable[Any, Any]], FunctionGraph]" has no attribute "outputs"


[pymc/distributions/continuous.py]
pymc/distributions/continuous.py:151: error: Dispatch type "PositiveContinuous" must be subtype of fallback function first argument "Op"
pymc/distributions/continuous.py:156: error: Dispatch type "UnitContinuous" must be subtype of fallback function first argument "Op"
pymc/distributions/continuous.py:161: error: Dispatch type "CircularContinuous" must be subtype of fallback function first argument "Op"
pymc/distributions/continuous.py:166: error: Dispatch type "BoundedContinuous" must be subtype of fallback function first argument "Op"
pymc/distributions/continuous.py:299: error: Incompatible types in assignment (expression has type "Tuple[int, int]", base class "BoundedContinuous" defined the type as "Optional[List[int]]")
pymc/distributions/continuous.py:341: error: Dispatch type "Uniform" must be subtype of fallback function first argument "Op"
pymc/distributions/continuous.py:348: error: Need type annotation for "ndims_params" (hint: "ndims_params: List[<type>] = ...")
pymc/distributions/continuous.py:419: error: Need type annotation for "ndims_params" (hint: "ndims_params: List[<type>] = ...")
pymc/distributions/continuous.py:596: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:596: note:      Superclass:
pymc/distributions/continuous.py:596: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:596: note:      Subclass:
pymc/distributions/continuous.py:596: note:          @classmethod
pymc/distributions/continuous.py:596: note:          def rng_fn(cls, rng: RandomState, mu: Union[ndarray[Any, Any], float], sigma: Union[ndarray[Any, Any], float], lower: Union[ndarray[Any, Any], float], upper: Union[ndarray[Any, Any], float], size: Union[List[int], int, None]) -> ndarray[Any, Any]
pymc/distributions/continuous.py:696: error: Incompatible types in assignment (expression has type "Tuple[int, int]", base class "BoundedContinuous" defined the type as "Optional[List[int]]")
pymc/distributions/continuous.py:699: error: Signature of "dist" incompatible with supertype "Distribution"
pymc/distributions/continuous.py:699: note:      Superclass:
pymc/distributions/continuous.py:699: note:          @classmethod
pymc/distributions/continuous.py:699: note:          def dist(cls, dist_params: Any, *, shape: Union[int, TensorVariable[Any, Any], Sequence[Union[int, Variable[Any, Any]]], None] = ..., **kwargs: Any) -> TensorVariable[Any, Any]
pymc/distributions/continuous.py:699: note:      Subclass:
pymc/distributions/continuous.py:699: note:          @classmethod
pymc/distributions/continuous.py:699: note:          def dist(cls, mu: Union[ndarray[Any, Any], int, float, TensorVariable[Any, Any], None] = ..., sigma: Union[ndarray[Any, Any], int, float, TensorVariable[Any, Any], None] = ..., tau: Union[ndarray[Any, Any], int, float, TensorVariable[Any, Any], None] = ..., lower: Union[ndarray[Any, Any], int, float, TensorVariable[Any, Any], None] = ..., upper: Union[ndarray[Any, Any], int, float, TensorVariable[Any, Any], None] = ..., *args: Any, **kwargs: Any) -> RandomVariable
pymc/distributions/continuous.py:710: error: Argument 1 to "as_tensor_variable" has incompatible type "Union[ndarray[Any, Any], int, float, TensorVariable[Any, Any], None]"; expected "Union[Variable[Any, Any], Sequence[Variable[Any, Any]], Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]]"
pymc/distributions/continuous.py:711: error: Argument 1 to "as_tensor_variable" has incompatible type "Union[ndarray[Any, Any], int, float, TensorVariable[Any, Any], None]"; expected "Union[Variable[Any, Any], Sequence[Variable[Any, Any]], Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]]"
pymc/distributions/continuous.py:716: error: Incompatible return value type (got "TensorVariable[Any, Any]", expected "RandomVariable")
pymc/distributions/continuous.py:781: error: Argument 2 to "_logprob" has incompatible type "Tuple[TruncatedNormal]"; expected "Tuple[TensorVariable[Any, Any]]"
pymc/distributions/continuous.py:781: error: Argument 3 to "_logprob" has incompatible type "None"; expected "TensorVariable[Any, Any]"
pymc/distributions/continuous.py:781: error: Argument 4 to "_logprob" has incompatible type "None"; expected "TensorVariable[Any, Any]"
pymc/distributions/continuous.py:781: error: Argument 5 to "_logprob" has incompatible type "None"; expected "TensorVariable[Any, Any]"
pymc/distributions/continuous.py:781: error: Argument 6 to "_logprob" has incompatible type "Union[float, ndarray[Any, Any], TensorVariable[Any, Any]]"; expected "TensorVariable[Any, Any]"
pymc/distributions/continuous.py:781: error: Argument 7 to "_logprob" has incompatible type "Union[float, ndarray[Any, Any], TensorVariable[Any, Any]]"; expected "TensorVariable[Any, Any]"
pymc/distributions/continuous.py:784: error: Unsupported operand types for > ("float" and "TruncatedNormal")
pymc/distributions/continuous.py:784: note: Right operand is of type "Union[float, ndarray[Any, Any], TensorVariable[Any, Any]]"
pymc/distributions/continuous.py:787: error: Unsupported operand types for < ("float" and "TruncatedNormal")
pymc/distributions/continuous.py:787: note: Right operand is of type "Union[float, ndarray[Any, Any], TensorVariable[Any, Any]]"
pymc/distributions/continuous.py:800: error: Dispatch type "TruncatedNormal" must be subtype of fallback function first argument "Op"
pymc/distributions/continuous.py:921: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:921: note:      Superclass:
pymc/distributions/continuous.py:921: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:921: note:      Subclass:
pymc/distributions/continuous.py:921: note:          @classmethod
pymc/distributions/continuous.py:921: note:          def rng_fn(cls, rng: Any, mu: Any, lam: Any, alpha: Any, size: Any) -> ndarray[Any, Any]
pymc/distributions/continuous.py:1010: error: Signature of "dist" incompatible with supertype "Distribution"
pymc/distributions/continuous.py:1010: note:      Superclass:
pymc/distributions/continuous.py:1010: note:          @classmethod
pymc/distributions/continuous.py:1010: note:          def dist(cls, dist_params: Any, *, shape: Union[int, TensorVariable[Any, Any], Sequence[Union[int, Variable[Any, Any]]], None] = ..., **kwargs: Any) -> TensorVariable[Any, Any]
pymc/distributions/continuous.py:1010: note:      Subclass:
pymc/distributions/continuous.py:1010: note:          @classmethod
pymc/distributions/continuous.py:1010: note:          def dist(cls, mu: Union[float, ndarray[Any, Any], None] = ..., lam: Union[float, ndarray[Any, Any], None] = ..., phi: Union[float, ndarray[Any, Any], None] = ..., alpha: Union[float, ndarray[Any, Any]] = ..., *args: Any, **kwargs: Any) -> RandomVariable
pymc/distributions/continuous.py:1019: error: Argument 1 to "get_mu_lam_phi" of "Wald" has incompatible type "Union[float, ndarray[Any, Any], None]"; expected "Optional[float]"
pymc/distributions/continuous.py:1019: error: Argument 2 to "get_mu_lam_phi" of "Wald" has incompatible type "Union[float, ndarray[Any, Any], None]"; expected "Optional[float]"
pymc/distributions/continuous.py:1019: error: Argument 3 to "get_mu_lam_phi" of "Wald" has incompatible type "Union[float, ndarray[Any, Any], None]"; expected "Optional[float]"
pymc/distributions/continuous.py:1020: error: Incompatible types in assignment (expression has type "TensorVariable[Any, Any]", variable has type "Union[float, ndarray[Any, Any]]")
pymc/distributions/continuous.py:1021: error: Incompatible types in assignment (expression has type "TensorVariable[Any, Any]", variable has type "Union[float, ndarray[Any, Any], None]")
pymc/distributions/continuous.py:1022: error: Incompatible types in assignment (expression has type "TensorVariable[Any, Any]", variable has type "Union[float, ndarray[Any, Any], None]")
pymc/distributions/continuous.py:1024: error: Incompatible return value type (got "TensorVariable[Any, Any]", expected "RandomVariable")
pymc/distributions/continuous.py:1079: error: Unsupported operand types for - ("Wald" and "float")
pymc/distributions/continuous.py:1079: note: Right operand is of type "Union[float, ndarray[Any, Any], TensorVariable[Any, Any]]"
pymc/distributions/continuous.py:1092: error: Argument 2 to "check_parameters" has incompatible type "Union[bool, ndarray[Any, dtype[bool_]], Any]"; expected "Iterable[Variable[Any, Any]]"
pymc/distributions/continuous.py:1093: error: Argument 3 to "check_parameters" has incompatible type "Union[bool, ndarray[Any, dtype[bool_]], Any]"; expected "Iterable[Variable[Any, Any]]"
pymc/distributions/continuous.py:1094: error: Argument 4 to "check_parameters" has incompatible type "Union[bool, ndarray[Any, dtype[bool_]], Any]"; expected "Iterable[Variable[Any, Any]]"
pymc/distributions/continuous.py:1124: error: Unsupported operand types for - ("Wald" and "float")
pymc/distributions/continuous.py:1124: note: Right operand is of type "Union[float, ndarray[Any, Any], TensorVariable[Any, Any]]"
pymc/distributions/continuous.py:1124: error: Incompatible types in assignment (expression has type "Union[float, Any]", variable has type "Wald")
pymc/distributions/continuous.py:1125: error: Unsupported operand types for / ("Wald" and "float")
pymc/distributions/continuous.py:1125: note: Right operand is of type "Union[float, ndarray[Any, Any], TensorVariable[Any, Any]]"
pymc/distributions/continuous.py:1127: error: Unsupported operand types for * ("Wald" and "float")
pymc/distributions/continuous.py:1127: note: Right operand is of type "Union[float, ndarray[Any, Any], TensorVariable[Any, Any]]"
pymc/distributions/continuous.py:1143: error: Argument 2 to "check_parameters" has incompatible type "Union[bool, ndarray[Any, dtype[bool_]], Any]"; expected "Iterable[Variable[Any, Any]]"
pymc/distributions/continuous.py:1143: error: Argument 3 to "check_parameters" has incompatible type "Union[bool, ndarray[Any, dtype[bool_]], Any]"; expected "Iterable[Variable[Any, Any]]"
pymc/distributions/continuous.py:1143: error: Argument 4 to "check_parameters" has incompatible type "Union[bool, ndarray[Any, dtype[bool_]], Any]"; expected "Iterable[Variable[Any, Any]]"
pymc/distributions/continuous.py:1149: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:1149: note:      Superclass:
pymc/distributions/continuous.py:1149: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:1149: note:      Subclass:
pymc/distributions/continuous.py:1149: note:          @classmethod
pymc/distributions/continuous.py:1149: note:          def rng_fn(cls, rng: Any, alpha: Any, beta: Any, size: Any) -> ndarray[Any, Any]
pymc/distributions/continuous.py:1299: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:1299: note:      Superclass:
pymc/distributions/continuous.py:1299: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:1299: note:      Subclass:
pymc/distributions/continuous.py:1299: note:          @classmethod
pymc/distributions/continuous.py:1299: note:          def rng_fn(cls, rng: Any, a: Any, b: Any, size: Any) -> ndarray[Any, Any]
pymc/distributions/continuous.py:1608: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:1608: note:      Superclass:
pymc/distributions/continuous.py:1608: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:1608: note:      Subclass:
pymc/distributions/continuous.py:1608: note:          @classmethod
pymc/distributions/continuous.py:1608: note:          def rng_fn(cls, rng: Any, b: Any, kappa: Any, mu: Any, size: Any = ...) -> ndarray[Any, Any]
pymc/distributions/continuous.py:1813: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:1813: note:      Superclass:
pymc/distributions/continuous.py:1813: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:1813: note:      Subclass:
pymc/distributions/continuous.py:1813: note:          @classmethod
pymc/distributions/continuous.py:1813: note:          def rng_fn(cls, rng: Any, nu: Any, mu: Any, sigma: Any, size: Any = ...) -> ndarray[Any, Any]
pymc/distributions/continuous.py:1998: error: Incompatible types in assignment (expression has type "Tuple[int, None]", base class "BoundedContinuous" defined the type as "Optional[List[int]]")
pymc/distributions/continuous.py:2001: error: Signature of "dist" incompatible with supertype "Distribution"
pymc/distributions/continuous.py:2001: note:      Superclass:
pymc/distributions/continuous.py:2001: note:          @classmethod
pymc/distributions/continuous.py:2001: note:          def dist(cls, dist_params: Any, *, shape: Union[int, TensorVariable[Any, Any], Sequence[Union[int, Variable[Any, Any]]], None] = ..., **kwargs: Any) -> TensorVariable[Any, Any]
pymc/distributions/continuous.py:2001: note:      Subclass:
pymc/distributions/continuous.py:2001: note:          @classmethod
pymc/distributions/continuous.py:2001: note:          def dist(cls, alpha: Optional[float] = ..., m: Optional[float] = ..., **kwargs: Any) -> RandomVariable
pymc/distributions/continuous.py:2002: error: Incompatible types in assignment (expression has type "TensorVariable[Any, Any]", variable has type "Optional[float]")
pymc/distributions/continuous.py:2003: error: Incompatible types in assignment (expression has type "TensorVariable[Any, Any]", variable has type "Optional[float]")
pymc/distributions/continuous.py:2005: error: Incompatible return value type (got "TensorVariable[Any, Any]", expected "RandomVariable")
pymc/distributions/continuous.py:2013: error: Self argument missing for a non-static method (or an invalid type for self)
pymc/distributions/continuous.py:2044: error: Argument 2 to "check_parameters" has incompatible type "Union[bool, ndarray[Any, dtype[bool_]], Any]"; expected "Iterable[Variable[Any, Any]]"
pymc/distributions/continuous.py:2044: error: Argument 3 to "check_parameters" has incompatible type "Union[bool, ndarray[Any, dtype[bool_]], Any]"; expected "Iterable[Variable[Any, Any]]"
pymc/distributions/continuous.py:2048: error: Dispatch type "Pareto" must be subtype of fallback function first argument "Op"
pymc/distributions/continuous.py:2540: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:2540: note:      Superclass:
pymc/distributions/continuous.py:2540: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:2540: note:      Subclass:
pymc/distributions/continuous.py:2540: note:          @classmethod
pymc/distributions/continuous.py:2540: note:          def rng_fn(cls, rng: Any, alpha: Any, beta: Any, size: Any) -> ndarray[Any, Any]
pymc/distributions/continuous.py:2652: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:2652: note:      Superclass:
pymc/distributions/continuous.py:2652: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:2652: note:      Subclass:
pymc/distributions/continuous.py:2652: note:          @classmethod
pymc/distributions/continuous.py:2652: note:          def rng_fn(cls, rng: Any, nu: Any, sigma: Any, size: Any = ...) -> ndarray[Any, Any]
pymc/distributions/continuous.py:2773: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:2773: note:      Superclass:
pymc/distributions/continuous.py:2773: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:2773: note:      Subclass:
pymc/distributions/continuous.py:2773: note:          @classmethod
pymc/distributions/continuous.py:2773: note:          def rng_fn(cls, rng: Any, mu: Any, sigma: Any, nu: Any, size: Any = ...) -> ndarray[Any, Any]
pymc/distributions/continuous.py:3004: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:3004: note:      Superclass:
pymc/distributions/continuous.py:3004: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:3004: note:      Subclass:
pymc/distributions/continuous.py:3004: note:          @classmethod
pymc/distributions/continuous.py:3004: note:          def rng_fn(cls, rng: Any, mu: Any, sigma: Any, alpha: Any, size: Any = ...) -> ndarray[Any, Any]
pymc/distributions/continuous.py:3173: error: Incompatible types in assignment (expression has type "Tuple[int, int]", base class "BoundedContinuous" defined the type as "Optional[List[int]]")
pymc/distributions/continuous.py:3227: error: Dispatch type "Triangular" must be subtype of fallback function first argument "Op"
pymc/distributions/continuous.py:3283: error: Signature of "dist" incompatible with supertype "Distribution"
pymc/distributions/continuous.py:3283: note:      Superclass:
pymc/distributions/continuous.py:3283: note:          @classmethod
pymc/distributions/continuous.py:3283: note:          def dist(cls, dist_params: Any, *, shape: Union[int, TensorVariable[Any, Any], Sequence[Union[int, Variable[Any, Any]]], None] = ..., **kwargs: Any) -> TensorVariable[Any, Any]
pymc/distributions/continuous.py:3283: note:      Subclass:
pymc/distributions/continuous.py:3283: note:          @classmethod
pymc/distributions/continuous.py:3283: note:          def dist(cls, mu: Optional[float] = ..., beta: Optional[float] = ..., **kwargs: Any) -> RandomVariable
pymc/distributions/continuous.py:3285: error: Incompatible types in assignment (expression has type "TensorVariable[Any, Any]", variable has type "Optional[float]")
pymc/distributions/continuous.py:3286: error: Incompatible types in assignment (expression has type "TensorVariable[Any, Any]", variable has type "Optional[float]")
pymc/distributions/continuous.py:3288: error: Incompatible return value type (got "TensorVariable[Any, Any]", expected "RandomVariable")
pymc/distributions/continuous.py:3299: error: Self argument missing for a non-static method (or an invalid type for self)
pymc/distributions/continuous.py:3320: error: Argument 2 to "check_parameters" has incompatible type "Union[bool, ndarray[Any, dtype[bool_]], Any]"; expected "Iterable[Variable[Any, Any]]"
pymc/distributions/continuous.py:3331: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:3331: note:      Superclass:
pymc/distributions/continuous.py:3331: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:3331: note:      Subclass:
pymc/distributions/continuous.py:3331: note:          @classmethod
pymc/distributions/continuous.py:3331: note:          def rng_fn(cls, rng: Any, b: Any, sigma: Any, size: Any = ...) -> ndarray[Any, Any]
pymc/distributions/continuous.py:3557: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:3557: note:      Superclass:
pymc/distributions/continuous.py:3557: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:3557: note:      Subclass:
pymc/distributions/continuous.py:3557: note:          @classmethod
pymc/distributions/continuous.py:3557: note:          def rng_fn(cls, rng: Any, mu: Any, sigma: Any, size: Any = ...) -> ndarray[Any, Any]
pymc/distributions/continuous.py:3689: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:3689: note:      Superclass:
pymc/distributions/continuous.py:3689: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:3689: note:      Subclass:
pymc/distributions/continuous.py:3689: note:          @classmethod
pymc/distributions/continuous.py:3689: note:          def rng_fn(cls, rng: Any, x: Any, pdf: Any, cdf: Any, size: Any = ...) -> ndarray[Any, Any]
pymc/distributions/continuous.py:3809: error: Dispatch type "Interpolated" must be subtype of fallback function first argument "Op"
pymc/distributions/continuous.py:3825: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:3825: note:      Superclass:
pymc/distributions/continuous.py:3825: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:3825: note:      Subclass:
pymc/distributions/continuous.py:3825: note:          @classmethod
pymc/distributions/continuous.py:3825: note:          def rng_fn(cls, rng: Any, mu: Any, sigma: Any, size: Any = ...) -> ndarray[Any, Any]
pymc/distributions/continuous.py:3951: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/continuous.py:3951: note:      Superclass:
pymc/distributions/continuous.py:3951: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/continuous.py:3951: note:      Subclass:
pymc/distributions/continuous.py:3951: note:          @classmethod
pymc/distributions/continuous.py:3951: note:          def rng_fn(cls, rng: Any, h: Any, z: Any, size: Any = ...) -> ndarray[Any, Any]


[pymc/distributions/dist_math.py]
pymc/distributions/dist_math.py:64: error: Incompatible types in assignment (expression has type "List[Iterable[Variable[Any, Any]]]", variable has type "Tuple[Iterable[Variable[Any, Any]], ...]")
pymc/distributions/dist_math.py:331: error: Cannot instantiate abstract class "I1e" with abstract attribute "c_code"
pymc/distributions/dist_math.py:351: error: Cannot instantiate abstract class "I0e" with abstract attribute "c_code"


[pymc/distributions/distribution.py]
pymc/distributions/distribution.py:168: error: Incompatible types in assignment (expression has type "None", variable has type "int")
pymc/distributions/distribution.py:201: error: Bracketed expression "[...]" is not valid as a type
pymc/distributions/distribution.py:201: note: Did you mean "List[...]"?
pymc/distributions/distribution.py:202: error: Incompatible types in assignment (expression has type "None", variable has type "MetaType")
pymc/distributions/distribution.py:204: error: Incompatible return type for "__new__" (returns "TensorVariable[Any, Any]", but must return a subtype of "Distribution")
pymc/distributions/distribution.py:292: error: "None" has no attribute "register_rv"
pymc/distributions/distribution.py:303: error: "TensorVariable[Any, Any]" has no attribute "str_repr"
pymc/distributions/distribution.py:304: error: "TensorVariable[Any, Any]" has no attribute "_repr_latex_"
pymc/distributions/distribution.py:308: error: "TensorVariable[Any, Any]" has no attribute "logp"
pymc/distributions/distribution.py:309: error: "TensorVariable[Any, Any]" has no attribute "logcdf"
pymc/distributions/distribution.py:310: error: "TensorVariable[Any, Any]" has no attribute "random"
pymc/distributions/distribution.py:361: error: Argument 1 to "convert_shape" has incompatible type "Union[int, TensorVariable[Any, Any], Sequence[Union[int, Variable[Any, Any]]], None]"; expected "Union[int, TensorVariable[Any, Any], Sequence[Union[int, Variable[Any, Any]]]]"
pymc/distributions/distribution.py:582: error: Signature of "dist" incompatible with supertype "Distribution"
pymc/distributions/distribution.py:582: note:      Superclass:
pymc/distributions/distribution.py:582: note:          @classmethod
pymc/distributions/distribution.py:582: note:          def dist(cls, dist_params: Any, *, shape: Union[int, TensorVariable[Any, Any], Sequence[Union[int, Variable[Any, Any]]], None] = ..., **kwargs: Any) -> TensorVariable[Any, Any]
pymc/distributions/distribution.py:582: note:      Subclass:
pymc/distributions/distribution.py:582: note:          @classmethod
pymc/distributions/distribution.py:582: note:          def dist(cls, *dist_params: Any, class_name: str, logp: Optional[Callable[..., Any]] = ..., logcdf: Optional[Callable[..., Any]] = ..., random: Optional[Callable[..., Any]] = ..., moment: Optional[Callable[..., Any]] = ..., ndim_supp: int = ..., ndims_params: Optional[Sequence[int]] = ..., dtype: str = ..., **kwargs: Any) -> Any


[pymc/distributions/mixture.py]
pymc/distributions/mixture.py:52: error: "Node" has no attribute "inputs"
pymc/distributions/mixture.py:52: error: "Node" has no attribute "outputs"
pymc/distributions/mixture.py:386: error: Cannot determine type of "_moment"


[pymc/distributions/multivariate.py]
pymc/distributions/multivariate.py:102: error: Dispatch type "SimplexContinuous" must be subtype of fallback function first argument "Op"
pymc/distributions/multivariate.py:1238: error: Cannot determine type of "_moment"
pymc/distributions/multivariate.py:1631: error: Dispatch type "LKJCorr" must be subtype of fallback function first argument "Op"
pymc/distributions/multivariate.py:2077: error: Signature of "rng_fn" incompatible with supertype "RandomVariable"
pymc/distributions/multivariate.py:2077: note:      Superclass:
pymc/distributions/multivariate.py:2077: note:          def rng_fn(self, rng: Any, *args: Any, **kwargs: Any) -> Any
pymc/distributions/multivariate.py:2077: note:      Subclass:
pymc/distributions/multivariate.py:2077: note:          @classmethod
pymc/distributions/multivariate.py:2077: note:          def rng_fn(cls, rng: RandomState, mu: Any, W: Any, alpha: Any, tau: Any, size: Any) -> Any
pymc/distributions/multivariate.py:2556: error: Cannot determine type of "_moment"


[pymc/distributions/timeseries.py]
pymc/distributions/timeseries.py:83: error: Signature of "dist" incompatible with supertype "Distribution"
pymc/distributions/timeseries.py:83: note:      Superclass:
pymc/distributions/timeseries.py:83: note:          @classmethod
pymc/distributions/timeseries.py:83: note:          def dist(cls, dist_params: Any, *, shape: Union[int, TensorVariable[Any, Any], Sequence[Union[int, Variable[Any, Any]]], None] = ..., **kwargs: Any) -> TensorVariable[Any, Any]
pymc/distributions/timeseries.py:83: note:      Subclass:
pymc/distributions/timeseries.py:83: note:          @classmethod
pymc/distributions/timeseries.py:83: note:          def dist(cls, init_dist: Any, innovation_dist: Any, steps: Any = ..., **kwargs: Any) -> TensorVariable[Any, Any]
pymc/distributions/timeseries.py:146: error: Cannot determine type of "_change_dist_size"
pymc/distributions/timeseries.py:155: error: Cannot determine type of "_moment"
pymc/distributions/timeseries.py:257: error: "Node" has no attribute "inputs"
pymc/distributions/timeseries.py:257: error: "Node" has no attribute "outputs"
pymc/distributions/timeseries.py:493: error: Cannot determine type of "_change_dist_size"
pymc/distributions/timeseries.py:541: error: Cannot determine type of "_moment"
pymc/distributions/timeseries.py:556: error: "Node" has no attribute "inputs"
pymc/distributions/timeseries.py:556: error: "Node" has no attribute "outputs"
pymc/distributions/timeseries.py:666: error: Cannot determine type of "_change_dist_size"
pymc/distributions/timeseries.py:704: error: Cannot determine type of "_moment"


[pymc/distributions/truncated.py]
pymc/distributions/truncated.py:49: error: "Node" has no attribute "inputs"
pymc/distributions/truncated.py:49: error: "Node" has no attribute "outputs"
pymc/distributions/truncated.py:128: error: Signature of "dist" incompatible with supertype "Distribution"
pymc/distributions/truncated.py:128: note:      Superclass:
pymc/distributions/truncated.py:128: note:          @classmethod
pymc/distributions/truncated.py:128: note:          def dist(cls, dist_params: Any, *, shape: Union[int, TensorVariable[Any, Any], Sequence[Union[int, Variable[Any, Any]]], None] = ..., **kwargs: Any) -> TensorVariable[Any, Any]
pymc/distributions/truncated.py:128: note:      Subclass:
pymc/distributions/truncated.py:128: note:          @classmethod
pymc/distributions/truncated.py:128: note:          def dist(cls, dist: Any, lower: Any = ..., upper: Any = ..., max_n_steps: int = ..., **kwargs: Any) -> Any
pymc/distributions/truncated.py:241: error: Cannot determine type of "_change_dist_size"
pymc/distributions/truncated.py:258: error: Cannot determine type of "_moment"


[pymc/initial_point.py]
pymc/initial_point.py:170: error: Incompatible types in assignment (expression has type "Sequence[TensorVariable[Any, Any]]", variable has type "List[TensorVariable[Any, Any]]")
pymc/initial_point.py:307: error: Incompatible return value type (got "List[Variable[Any, Any]]", expected "List[TensorVariable[Any, Any]]")
pymc/initial_point.py:311: error: Incompatible return value type (got "List[Variable[Any, Any]]", expected "List[TensorVariable[Any, Any]]")


[pymc/model.py]
pymc/model.py:733: error: List item 0 has incompatible type "Union[Variable[Any, Any], Sequence[Variable[Any, Any]]]"; expected "TensorVariable[Any, Any]"
pymc/model.py:758: error: Incompatible types in assignment (expression has type "Union[TensorVariable[Any, Any], List[TensorVariable[Any, Any]]]", variable has type "List[TensorVariable[Any, Any]]")
pymc/model.py:762: error: Need type annotation for "potential_logps" (hint: "potential_logps: List[<type>] = ...")
pymc/model.py:764: error: Incompatible types in assignment (expression has type "TensorVariable[Any, Any]", variable has type "List[Any]")
pymc/model.py:768: error: No overload variant of "__setitem__" of "list" matches argument types "int", "TensorVariable[Any, Any]"
pymc/model.py:768: note: Possible overload variants:
pymc/model.py:768: note:     def __setitem__(self, SupportsIndex, None) -> None
pymc/model.py:768: note:     def __setitem__(self, slice, Iterable[None]) -> None
pymc/model.py:771: error: Incompatible return value type (got "List[None]", expected "Union[Variable[Any, Any], List[Variable[Any, Any]]]")
pymc/model.py:810: error: List item 0 has incompatible type "Union[Variable[Any, Any], Sequence[Variable[Any, Any]]]"; expected "Variable[Any, Any]"
pymc/model.py:855: error: List item 0 has incompatible type "Union[Variable[Any, Any], Sequence[Variable[Any, Any]]]"; expected "Variable[Any, Any]"
pymc/model.py:882: error: Unsupported left operand type for + ("Variable[Any, Any]")
pymc/model.py:896: error: Incompatible return value type (got "Union[Variable[Any, Any], List[Variable[Any, Any]]]", expected "Variable[Any, Any]")
pymc/model.py:910: error: Incompatible return value type (got "Union[Variable[Any, Any], List[Variable[Any, Any]]]", expected "Variable[Any, Any]")
pymc/model.py:923: error: Incompatible return value type (got "Union[Variable[Any, Any], List[Variable[Any, Any]]]", expected "Variable[Any, Any]")
pymc/model.py:1142: error: Argument 1 to "array_equal" has incompatible type "Optional[Tuple[Any, ...]]"; expected "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"
pymc/model.py:1142: error: Argument 2 to "array_equal" has incompatible type "Optional[Tuple[Any, ...]]"; expected "Union[_SupportsArray[dtype[Any]], _NestedSequence[_SupportsArray[dtype[Any]]], bool, int, float, complex, str, bytes, _NestedSequence[Union[bool, int, float, complex, str, bytes]]]"
pymc/model.py:1149: error: Argument 1 to "len" has incompatible type "Optional[Tuple[Any, ...]]"; expected "Sized"
pymc/model.py:1199: error: "Variable[Any, Any]" has no attribute "set_value"
pymc/model.py:1238: error: "Dict[str, Optional[Sequence[Any]]]" has no attribute "ndim"
pymc/model.py:1238: error: "SharedVariable" has no attribute "ndim"
pymc/model.py:1240: error: "SharedVariable" has no attribute "ndim"
pymc/model.py:1244: error: Invalid index type "Optional[str]" for "Dict[str, Variable[Any, Any]]"; expected type "str"
pymc/model.py:1246: error: "Dict[str, Optional[Sequence[Any]]]" has no attribute "shape"
pymc/model.py:1247: error: Argument 1 to "get" of "dict" has incompatible type "Optional[str]"; expected "str"
pymc/model.py:1248: error: Argument 1 to "get" of "dict" has incompatible type "Optional[str]"; expected "str"
pymc/model.py:1309: error: Argument 1 to "set_dim" of "Model" has incompatible type "Optional[str]"; expected "str"
pymc/model.py:1498: error: Incompatible types in assignment (expression has type "TensorVariable[Any, Any]", variable has type "ndarray[Any, Any]")
pymc/model.py:1500: error: Argument "value_var" to "create_value_var" of "Model" has incompatible type "ndarray[Any, Any]"; expected "Optional[Variable[Any, Any]]"
pymc/model.py:1545: error: Incompatible return value type (got "Union[Variable[Any, Any], Any]", expected "TensorVariable[Any, Any]")
pymc/model.py:1646: error: Incompatible return value type (got "Callable[..., Union[ndarray[Any, Any], List[ndarray[Any, Any]]]]", expected "Union[PointFunc, Callable[[Sequence[ndarray[Any, Any]]], Sequence[ndarray[Any, Any]]]]")
pymc/model.py:1960: error: Incompatible types in assignment (expression has type "List[Any]", variable has type "Tuple[Any, ...]")


[pymc/model_graph.py]
pymc/model_graph.py:65: error: Item "Tuple[Any, ...]" of "Union[Any, Tuple[Any, Optional[Iterable[Any]]]]" has no attribute "name"
pymc/model_graph.py:68: error: Incompatible return value type (got "Set[str]", expected "Set[VarName]")
pymc/model_graph.py:98: error: List comprehension has incompatible type List[Optional[str]]; expected List[VarName]


[pymc/printing.py]
pymc/printing.py:61: error: Argument 1 to "_latex_escape" has incompatible type "Optional[str]"; expected "str"
pymc/printing.py:159: error: "Variable[Any, Any]" has no attribute "str_repr"
pymc/printing.py:182: error: Argument 1 to "str_for_dist" has incompatible type "Variable[Any, Any]"; expected "TensorVariable[Any, Any]"
pymc/printing.py:213: error: Item "Tuple[Any, ...]" of "Union[Any, Tuple[Any, Optional[Iterable[Any]]]]" has no attribute "owner"
pymc/printing.py:215: error: Item "Tuple[Any, ...]" of "Union[Any, Tuple[Any, Optional[Iterable[Any]]]]" has no attribute "name"
pymc/printing.py:235: error: Item "TensorVariable[Any, Any]" of "Union[TensorVariable[Any, Any], Model]" has no attribute "str_repr"


[pymc/sampling_jax.py]
pymc/sampling_jax.py:13: error: Incompatible types in assignment (expression has type "List[str]", variable has type "str")
pymc/sampling_jax.py:14: error: No overload variant of "__add__" of "list" matches argument type "str"
pymc/sampling_jax.py:14: note: Possible overload variants:
pymc/sampling_jax.py:14: note:     def __add__(self, List[str]) -> List[str]
pymc/sampling_jax.py:14: note:     def [_S] __add__(self, List[_S]) -> List[Union[_S, str]]
pymc/sampling_jax.py:73: error: Argument "replace" to "clone_replace" has incompatible type "Dict[SharedVariable, TensorConstant[Any]]"; expected "Union[Iterable[Tuple[Variable[Any, Any], Variable[Any, Any]]], Dict[Variable[Any, Any], Variable[Any, Any]], None]"
pymc/sampling_jax.py:74: error: Incompatible return value type (got "List[Variable[Any, Any]]", expected "List[TensorVariable[Any, Any]]")
pymc/sampling_jax.py:83: error: Argument 1 to "_replace_shared_variables" has incompatible type "Optional[List[TensorVariable[Any, Any]]]"; expected "List[TensorVariable[Any, Any]]"
pymc/sampling_jax.py:95: error: "FunctionGraph" has no attribute "has_destroyers"
pymc/sampling_jax.py:107: error: Unsupported operand type for unary - ("Union[Variable[Any, Any], List[Variable[Any, Any]]]")
pymc/sampling_jax.py:108: error: List item 0 has incompatible type "Union[Variable[Any, Any], List[Variable[Any, Any]]]"; expected "TensorVariable[Any, Any]"
pymc/sampling_jax.py:140: error: Argument "outputs" to "get_jaxified_graph" has incompatible type "Union[Variable[Any, Any], List[Variable[Any, Any]]]"; expected "Optional[List[TensorVariable[Any, Any]]]"
pymc/sampling_jax.py:141: error: Value of type variable "F" of "vmap" cannot be "List[TensorVariable[Any, Any]]"
pymc/sampling_jax.py:141: error: "List[TensorVariable[Any, Any]]" not callable
pymc/sampling_jax.py:169: error: List comprehension has incompatible type List[List[ndarray[Any, Any]]]; expected List[Dict[str, ndarray[Any, Any]]]
pymc/sampling_jax.py:171: error: Incompatible types in assignment (expression has type "Dict[str, ndarray[Any, Any]]", variable has type "List[Dict[str, ndarray[Any, Any]]]")
pymc/sampling_jax.py:173: error: List comprehension has incompatible type List[ndarray[Any, dtype[Any]]]; expected List[Dict[str, ndarray[Any, Any]]]
pymc/sampling_jax.py:174: error: Incompatible return value type (got "List[Dict[str, ndarray[Any, Any]]]", expected "Union[ndarray[Any, Any], List[ndarray[Any, Any]]]")
pymc/sampling_jax.py:349: error: Incompatible types in assignment (expression has type "Callable[[F, Union[int, Sequence[Any]], Any, Optional[Hashable], Optional[int], Optional[Hashable]], F]", variable has type "Callable[[Callable[..., Any], Optional[Any], DefaultNamedArg(Any, 'in_axes'), DefaultNamedArg(Any, 'out_axes'), DefaultNamedArg(Union[int, Iterable[int]], 'static_broadcasted_argnums'), DefaultNamedArg(Optional[Sequence[Device]], 'devices'), DefaultNamedArg(Optional[str], 'backend'), DefaultNamedArg(Optional[int], 'axis_size'), DefaultNamedArg(Union[int, Iterable[int]], 'donate_argnums'), DefaultNamedArg(Optional[Tuple[Tuple[int, ...], ...]], 'global_arg_shapes')], Any]")
pymc/sampling_jax.py:363: error: Value of type variable "F" of "vmap" cannot be "List[TensorVariable[Any, Any]]"
pymc/sampling_jax.py:363: error: "List[TensorVariable[Any, Any]]" not callable
pymc/sampling_jax.py:587: error: Value of type variable "F" of "vmap" cannot be "List[TensorVariable[Any, Any]]"
pymc/sampling_jax.py:587: error: "List[TensorVariable[Any, Any]]" not callable


[pymc/stats/convergence.py]
pymc/stats/convergence.py:71: error: Need type annotation for "warnings" (hint: "warnings: List[<type>] = ...")


[pymc/step_methods/arraystep.py]
pymc/step_methods/arraystep.py:106: error: Self argument missing for a non-static method (or an invalid type for self)
pymc/step_methods/arraystep.py:153: error: Argument 1 to "append" of "list" has incompatible type "Dict[str, ndarray[Any, Any]]"; expected "Callable[[RaveledVars], Any]"
pymc/step_methods/arraystep.py:155: error: Key expression in dictionary comprehension has incompatible type "Optional[str]"; expected type "str"
pymc/step_methods/arraystep.py:155: error: Invalid index type "Optional[str]" for "Dict[str, ndarray[Any, Any]]"; expected type "str"
pymc/step_methods/arraystep.py:156: error: Need type annotation for "step_res"
pymc/step_methods/arraystep.py:156: error: Argument 2 to "astep" of "ArrayStep" has incompatible type "*List[Callable[[RaveledVars], Any]]"; expected "Dict[str, ndarray[Any, Any]]"


[pymc/step_methods/metropolis.py]
pymc/step_methods/metropolis.py:68: error: Incompatible types in assignment (expression has type Module, variable has type "Optional[Generator]")
pymc/step_methods/metropolis.py:69: error: Item "None" of "Optional[Generator]" has no attribute "normal"
pymc/step_methods/metropolis.py:75: error: Incompatible types in assignment (expression has type Module, variable has type "Optional[Generator]")
pymc/step_methods/metropolis.py:76: error: Item "None" of "Optional[Generator]" has no attribute "uniform"
pymc/step_methods/metropolis.py:82: error: Incompatible types in assignment (expression has type Module, variable has type "Optional[Generator]")
pymc/step_methods/metropolis.py:83: error: Item "None" of "Optional[Generator]" has no attribute "standard_cauchy"
pymc/step_methods/metropolis.py:89: error: Incompatible types in assignment (expression has type Module, variable has type "Optional[Generator]")
pymc/step_methods/metropolis.py:91: error: Item "None" of "Optional[Generator]" has no attribute "standard_exponential"
pymc/step_methods/metropolis.py:97: error: Incompatible types in assignment (expression has type Module, variable has type "Optional[Generator]")
pymc/step_methods/metropolis.py:98: error: Item "None" of "Optional[Generator]" has no attribute "poisson"
pymc/step_methods/metropolis.py:111: error: Incompatible types in assignment (expression has type Module, variable has type "Optional[Generator]")
pymc/step_methods/metropolis.py:113: error: Item "None" of "Optional[Generator]" has no attribute "normal"
pymc/step_methods/metropolis.py:116: error: Item "None" of "Optional[Generator]" has no attribute "normal"
pymc/step_methods/metropolis.py:263: error: "RaveledVars" has no attribute "astype"
pymc/step_methods/metropolis.py:272: error: "RaveledVars" has no attribute "copy"
pymc/step_methods/metropolis.py:402: error: Signature of "astep" incompatible with supertype "ArrayStep"
pymc/step_methods/metropolis.py:402: note:      Superclass:
pymc/step_methods/metropolis.py:402: note:          def [StatsType] astep(self, apoint: RaveledVars, point: Dict[str, ndarray[Any, Any]], *args: Any) -> Union[RaveledVars, Tuple[RaveledVars, StatsType]]
pymc/step_methods/metropolis.py:402: note:      Subclass:
pymc/step_methods/metropolis.py:402: note:          def astep(self, q0: RaveledVars, logp: Any) -> Tuple[RaveledVars, List[Dict[str, Any]]]
pymc/step_methods/metropolis.py:411: error: "RaveledVars" has no attribute "shape"
pymc/step_methods/metropolis.py:503: error: Signature of "astep" incompatible with supertype "ArrayStep"
pymc/step_methods/metropolis.py:503: note:      Superclass:
pymc/step_methods/metropolis.py:503: note:          def [StatsType] astep(self, apoint: RaveledVars, point: Dict[str, ndarray[Any, Any]], *args: Any) -> Union[RaveledVars, Tuple[RaveledVars, StatsType]]
pymc/step_methods/metropolis.py:503: note:      Subclass:
pymc/step_methods/metropolis.py:503: note:          def astep(self, q0: RaveledVars, logp: Callable[[RaveledVars], ndarray[Any, Any]]) -> RaveledVars
pymc/step_methods/metropolis.py:955: error: Need type annotation for "_history" (hint: "_history: List[<type>] = ...")


[pymc/variational/approximations.py]
pymc/variational/approximations.py:349: error: Incompatible types in assignment (expression has type "Type[MeanFieldGroup]", base class "SingleGroupApproximation" defined the type as "None")
pymc/variational/approximations.py:358: error: Incompatible types in assignment (expression has type "Type[FullRankGroup]", base class "SingleGroupApproximation" defined the type as "None")
pymc/variational/approximations.py:367: error: Incompatible types in assignment (expression has type "Type[EmpiricalGroup]", base class "SingleGroupApproximation" defined the type as "None")


[pymc/variational/opvi.py]
pymc/variational/opvi.py:655: error: Need type annotation for "__param_spec__" (hint: "__param_spec__: Dict[<type>, <type>] = ...")
pymc/variational/opvi.py:657: error: Need type annotation for "alias_names"
pymc/variational/opvi.py:658: error: Need type annotation for "__param_registry" (hint: "__param_registry: Dict[<type>, <type>] = ...")
pymc/variational/opvi.py:659: error: Need type annotation for "__name_registry" (hint: "__name_registry: Dict[<type>, <type>] = ...")
pymc/variational/opvi.py:1476: error: Incompatible types in assignment (expression has type "MultiTrace", variable has type "NDArray")
pymc/variational/opvi.py:1480: error: Argument 1 to "to_inference_data" has incompatible type "NDArray"; expected "Optional[MultiTrace]"

57/75 files pass as expected.

I don't have time at the moment to investigate further, but maybe there needs to be some more configuration?

@michaelosthege
Copy link
Member

@maresb the output you posted is actually correct..
When I set up mypy originally, I already silenced a lot of warnings that didn't seem to be relevant for us.

More or less all that remains appears relevant ..

@maresb
Copy link
Contributor

maresb commented Oct 9, 2022

Ah, I see now. I was in a hurry, not looking carefully enough and missed the last line "57/75 files pass as expected". My eyes were drawn to the error:s.

Just a nit, but it might improve the experience to add a prominent all-caps PASS/FAIL to the beginning of that last line.

@ricardoV94
Copy link
Member Author

Hey there, just got the review request, and I'm trying to catch up on context. I managed to find #5907, and I was myself also frustrated by the slow mypy in pre-commit.

If I'm understanding correctly, @michaelosthege transferred mypy to run only in the workflow. This has the disadvantage that you don't notice the mypy failure until the workflow runs. This PR addresses this by configuring the local dev environment and giving a message clarifying how to run locally.

Am I understanding correctly? If so, this looks excellent. I haven't tested it locally yet, but I'll give it a shot momentarily...

That's exactly it. I should have added more context to the description

@michaelosthege michaelosthege merged commit dd2c822 into pymc-devs:main Oct 9, 2022
@ricardoV94 ricardoV94 deleted the improve_mypy_instructions branch June 6, 2023 03:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Github CI/CD no releasenotes Skipped in automatic release notes generation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants