mypy
mypy copied to clipboard
Optional static typing for Python
These both result in the `All conditional function variants must have identical signatures` warning: ```python try: from math import comb except ImportError: def comb(n: int, k: int) -> int: #...
**Bug Report** Mypy is evaluating `builtins.object` instead of `Union[X, Y]` as the returned type when passing an argument of type `Type[Union[X, Y]]` to a `def [T] (cl: Type[T']) -> T'`...
Is there a way to use TypedDict for more complicated nested structures? For example, if I pass around a dictionary with certain defined keys and values, some of which are...
We've started seeing non deterministic failures of mypyc incremental tests in CI. The first test failure on master was on https://github.com/python/mypy/commit/840a310f0b6c4a4bd7edfb141c8d1731ba4dd027 (succeeded on retry). The earliest test failure I've observed...
Note: if you are reporting a wrong signature of a function or a class in the standard library, then the typeshed tracker is better suited for this report: https://github.com/python/typeshed/issues Please...
There is currently a safety check around `TypeVar`-dependent `Final` attributes declared in the class body that I believe we can loosen when the variable is assigned in the ctor. This...
**Bug Report** The function ```python def get_value(key: CombinedDictKey, mapping: CombinedDict): return mapping[key] ``` raises an error when `mapping` is a union of two `TypedDict`s and `key` is a union of...
It would raise even if there were only non-trait bases, leading to this slightly confusing situation: class A: pass class B: pass class C(A, B): pass # E: Non-trait bases...
**Bug Report** Error on a valid code. **To Reproduce** ```python sets = map(set[str], ["aaa", "abb", "acc"]) intersection = set[str].intersection(*sets) ``` [mypy Playground](https://mypy-play.net/?mypy=latest&python=3.11&gist=533fac7635d59c9e25dfa02f45e96bcb&flags=strict) **Actual Behavior** Argument 1 to \"intersection\" of \"set\"...
Fixes #8330. Made a first mypy_primer run locally, and had a lot of things breaking, so the fix might be incomplete. - [ ] Fix/add tests in `check-classes.test`