mypy
mypy copied to clipboard
Optional static typing for Python
**Bug Report** Mypy appears not to consider `ImportError` to be an exception type in some cases. **To Reproduce** ```python y = [ # ValueError, ImportError, # error: List item 0...
The mypy plugin interface is experimental, unstable, and prone to change. In particular, there are no guarantees about backwards compatibility. Backwards incompatible changes may be made without a deprecation period....
Fixes [#14428](https://github.com/python/mypy/issues/14428) Similar to https://github.com/python/mypy/pull/9203, this PR exposes a way for `stubgen` to receive a Mypy configuration file with extra options, which allows it to use custom plugins.
**Bug Report** mypy is unable to correctly disambiguate a union when there is a dependent function type. The call `meow(s)(s)` is always valid as `s` is either `int` or `str`...
**Bug Report** When taking the `and` of multiple isinstances/typeguards, it seems like only the most recent is used to constrain the variable whose type is being checked. **To Reproduce** See...
This format allows editors and terminals that support linking to specific lines in files to go directly to the right line. Before:   After:  
I have a class which is generic and has some runtime marker for determining the underlying type. I would like to use that marker to guide MyPy in validating the...
Fixes #11925 This avoids mypy from guessing subtype relationships because of the any fallback over here: https://github.com/python/mypy/blob/e1bfb75ed2187db76d51ed875ce953da3ba4d02c/mypy/subtypes.py#L438
**Bug Report** Accessing a property typed to the object we access , e.g. a property defining `__get__(self, obj: B, ...)` through a `Union[A,B]` complains that the argument to `__get__` has...
A TODO I found while looking at something else got me down this rabbit hole, and I noticed mypy's subpar performance in these two cases. Short descriptions from *before* I...