mypy
mypy copied to clipboard
Optional static typing for Python
**Bug Report** mypy ignores the return type of a function if the annotation uses `@overload` and one of the parameters has type `Any`. Possible duplicate of #14995. **To Reproduce** https://mypy-play.net/?mypy=1.1.1&python=3.11&gist=5ca80f2b256e4d31a8c588b15702b085...
The root cause is hacky creation of incomplete symbols; instead switching to `add_method_to_class` which does the necessary housekeeping. Fixes #15618.
This is WIP. Adding tests from [PEP 692](https://peps.python.org/pep-0692/) - still the last two (added in last two commits) are not passing, trying to figure out how to approach this.
**Bug Report** `not isinstance` check fails to narrow type for a TypeVar with a union bound. **To Reproduce** ```python from typing import TypeVar T = TypeVar("T", bound=int | str) def...
Covariant overriding of attributes is allowed though it's clearly unsafe. Example: ```py class A: x: float class B(A): x: int # no error, though unsafe def f(a: A) -> None:...
**Bug Report** Overload resolution appears to pick the first matching overload if the argument type is an alias to Any. It should consider all overloads. This works correctly when using...
**Feature** I would like for dmypy to be a fully fledged language server. Obviously it would only support diagnostics (which would make this much simpler). But this would be very...
```py foo: int foo = str(foo) # no error try: bar: int bar = str(bar) # error: Incompatible types in assignment (expression has type "str", variable has type "int") [assignment]...
**Bug Report** By using `Self` in the type of a method's argument it's possible to violate the Liskov Substitution Principle without any warning. (A clear and concise description of what...
Followup to #15310 > **Note** > This should only be merged **after** the branch was renamed. Cleanup references to `master` branch and replace them with `main`. This also updates the...