mypy
mypy copied to clipboard
Optional static typing for Python
I noticed this issue when exploring a [feature request](https://github.com/microsoft/pyright/issues/8434) in pyright. The following code results in an "INTERNAL ERROR" when running mypy. ```python from typing import Final MY_CONST: Final =...
Fixes issue #17840 (shows signature of __call__ for incompatible function argument) made modifications to messages.py - created a note_call_message function to just return the note message for __call__ type instead...
**Bug Report** Calls to `TypedDict.update` don't type-check, even if all the updates are specified using keyword arguments. **To Reproduce** Type-check this program: ```python from typing import TypedDict class Args(TypedDict, total=False):...
Adds a new output format as GitHub Workflow commands, aka annotations. Refs: - https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/workflow-commands-for-github-actions Closes https://github.com/python/mypy/issues/17612
**Bug Report** Some obtuse code results in a false positive for the `possibly-undefined` error code. **To Reproduce** Run `mypy --enable-error-code possibly-undefined file.py` on this file: ```python decorator = lambda f:...
Fixes #12358 [needs tests. also, I think I can fix it to make it almost "the right way"] Appendix A: the original text of this pr, before I radically improved...
**Bug Report** Mypy raises a false positive for `dataclass.asdict` (`No overload variant of "asdict" matches argument type "Self" [call-overload]`) on the very specific circumstances: 1. The specific decorator for `dataclass`...
I have several `TypedDict`: ``` TerminateHandlerContextType = TypedDict( "TerminateHandlerContextType",{...},) CrashHandlerContextType = TypedDict( "CrashHandlerContextType", {... },) QuitHandlerContextType = TypedDict("QuitHandlerContextType", {...}) ``` And then related `Callable`: ``` TerminateHandlerType = Callable[[TerminateHandlerContextType], None] QuitHandlerType...
**Bug Report** When one of the alternatives of an overload has a return type T which is a subtype of the return type of the annotation U but that the...
```py class Base: def foo(self): pass class Mix: pass class A(Mix, Base): pass class B(Mix, Base): pass def foo() -> None: a = [A(), B()] reveal_type(a) # Shows Mix a.foo()...