mypy
mypy copied to clipboard
Optional static typing for Python
**Bug Report** If Literals are given as Unions they aren't accepted as TypedDict Keys **To Reproduce** ```python from typing import TypedDict, reveal_type, Final, Literal, TypeAlias, get_args from datetime import datetime...
Simplified Example: ```python from typing import TypeVar _T = TypeVar('_T') def foo(a: _T = 42) -> _T: # E: Incompatible types in assignment (expression has type "int", variable has type...
**Bug Report** I'm getting a false positive from the following example ```python from typing import Protocol from typing_extensions import Self class P(Protocol): # Removing the property makes the problem disappear...
**Bug Report** When using `dict.get` to access specific members of TypeVar entries bound to TypedDict, mypy always narrows the type to `object` where, without the TypeVar, we expect the union...
I have a function `add(x,y)` that adds two floats, and that that the user can specify. If no custom function `add` is given, `default_add` is used. If it _is_ given,...
**Bug Report** Slot definition in a form of `__slots__ = []` raise an error: ``` ex.py:2: error: Need type annotation for "__slots__" (hint: "__slots__: List[] = ...") ``` **To Reproduce**...
**Bug Report** Hey folks! I ran into what I think is a bug while trying to write a config retrieval library for a Flask server. I'd like to pass a...
This are defined in the PEP 484 draft.
**Bug Report** Descriptor protocol does not work on metaclasses - defining `__get__` method in a metaclass does not make classes using that metaclass work as descriptors. **To Reproduce** 1. Put...
**Bug Report** In some circumstances, a plugin which works fine from command line fails when run from the API with: ``` ('Found 1 error in 1 file (errors prevented further...