naming and inheritance for importlib
This MR breaks out _frozen_importlib_external (which is the same thing as importlib._bootstrap_external) and _frozen_importlib (which is the same thing as importlib._bootstrap).
related to https://github.com/python/typeshed/issues/3968
I waffled on just adding importlib._bootstrap and importlib._bootstrap_external because the _frozen* modules are unusual even by private module standards, but decided to go ahead with _frozen* since that's the names that show up at runtime.
huh, stubtest didn't do that on my local machine. Looking into it.
Well, forgetting to git add some files didn't help matters.
Diff from mypy_primer, showing the effect of this PR on open source code:
dacite (https://github.com/konradhalas/dacite)
- dacite/config.py:8: error: Unused "type: ignore" comment [unused-ignore]
- dacite/types.py:52: error: Unused "type: ignore" comment [unused-ignore]
- dacite/types.py:67: error: Unused "type: ignore" comment [unused-ignore]
- dacite/types.py:161: error: Unused "type: ignore" comment [unused-ignore]
- dacite/dataclasses.py:17: error: Unused "type: ignore" comment [unused-ignore]
- dacite/dataclasses.py:18: error: Unused "type: ignore" comment [unused-ignore]
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/genericpath.pyi: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.2
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+ File "", line 8, in <module>
+ sys.exit(console_entry())
+ File "mypy/build.py", line 2069, in wrap_context
+ AssertionError: Var:nil(ModuleSpec)
packaging (https://github.com/pypa/packaging)
- src/packaging/metadata.py:29: error: Name "ExceptionGroup" already defined (possibly by an import) [no-redef]
- src/packaging/metadata.py:217: error: Incompatible types in assignment (expression has type "Message[str, str] | str | list[Message[str, str] | str] | Any", variable has type "str") [assignment]
- src/packaging/metadata.py:222: error: Incompatible types in assignment (expression has type "Message[str, str] | bytes | Any", variable has type "bytes") [assignment]
- src/packaging/metadata.py:427: error: No overload variant of "get_payload" of "Message" matches argument type "bool" [call-overload]
- src/packaging/metadata.py:427: note: Possible overload variants:
- src/packaging/metadata.py:427: note: def get_payload(self, i: int, decode: Literal[True]) -> None
- src/packaging/metadata.py:427: note: def get_payload(self, i: int, decode: Literal[False] = ...) -> Message[str, str] | str | Any
- src/packaging/metadata.py:427: note: def get_payload(self, i: None = ..., decode: Literal[False] = ...) -> Message[str, str] | str | list[Message[str, str] | str] | Any
- src/packaging/metadata.py:427: note: def get_payload(self, i: None = ..., *, decode: Literal[True]) -> Message[str, str] | bytes | Any
- src/packaging/metadata.py:427: note: def get_payload(self, i: None, decode: Literal[True]) -> Message[str, str] | bytes | Any
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/genericpath.pyi: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.2
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+ File "", line 8, in <module>
+ sys.exit(console_entry())
+ File "mypy/build.py", line 2069, in wrap_context
+ AssertionError: Var:nil(ModuleSpec)
pyinstrument (https://github.com/joerick/pyinstrument)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/genericpath.pyi: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.2
+ note: use --pdb to drop into pdb
- pyinstrument/frame.py:138: error: Missing return statement [return]
- pyinstrument/frame.py:143: error: Missing return statement [return]
- pyinstrument/frame.py:224: error: Name "attributes" already defined on line 58 [no-redef]
- pyinstrument/frame.py:277: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
- pyinstrument/frame.py:280: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
- pyinstrument/frame.py:380: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- pyinstrument/vendor/appdirs.py:559: error: Module "ctypes" has no attribute "windll" [attr-defined]
- pyinstrument/magic/_utils.py:73: error: Unused "type: ignore" comment [unused-ignore]
- pyinstrument/magic/_utils.py:74: error: Unused "type: ignore" comment [unused-ignore]
- pyinstrument/frame_ops.py:70: error: Variable "pyinstrument.typing.LiteralStr" is not valid as a type [valid-type]
- pyinstrument/frame_ops.py:70: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/frame_ops.py:70: error: Name "children" is not defined [name-defined]
- pyinstrument/frame_ops.py:70: error: Name "self_time" is not defined [name-defined]
- pyinstrument/frame_ops.py:70: error: Name "nothing" is not defined [name-defined]
- pyinstrument/low_level/pyi_timing_thread_python.py:18: error: Need type annotation for "subscribers" (hint: "subscribers: list[<type>] = ...") [var-annotated]
- pyinstrument/low_level/stat_profile.pyi:11: error: Variable "pyinstrument.low_level.types.TimerType" is not valid as a type [valid-type]
- pyinstrument/low_level/stat_profile.pyi:11: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/low_level/stat_profile.pyi:15: error: Variable "pyinstrument.low_level.types.TimerType" is not valid as a type [valid-type]
- pyinstrument/low_level/stat_profile.pyi:15: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/processors.py:90: error: Unused "type: ignore" comment [unused-ignore]
- pyinstrument/vendor/decorator.py:55: error: All conditional function variants must have identical signatures [misc]
- pyinstrument/vendor/decorator.py:55: note: Original:
- pyinstrument/vendor/decorator.py:55: note: def getfullargspec(func: object) -> FullArgSpec
- pyinstrument/vendor/decorator.py:55: note: Redefinition:
- pyinstrument/vendor/decorator.py:55: note: def getfullargspec(f: Any) -> Any
- pyinstrument/vendor/decorator.py:66: error: Incompatible redefinition (redefinition with type "Callable[[Any], Any]", original type overloaded function) [misc]
- pyinstrument/vendor/decorator.py:279: error: Module "contextlib" has no attribute "GeneratorContextManager"; maybe "_GeneratorContextManager", "_AsyncGeneratorContextManager", or "AbstractContextManager"? [attr-defined]
- pyinstrument/vendor/decorator.py:279: error: Name "_GeneratorContextManager" already defined (possibly by an import) [no-redef]
- pyinstrument/vendor/decorator.py:295: error: Cannot assign to a method [method-assign]
- pyinstrument/vendor/decorator.py:295: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, VarArg(Any), KwArg(Any)], Any]", variable has type "Callable[[_GeneratorContextManager[_T_co], Callable[..., Iterator[_T_co]], tuple[Any, ...], dict[str, Any]], None]") [assignment]
- pyinstrument/vendor/decorator.py:301: error: Cannot assign to a method [method-assign]
- pyinstrument/vendor/decorator.py:301: error: Incompatible types in assignment (expression has type "Callable[[Any, Any, VarArg(Any), KwArg(Any)], Any]", variable has type "Callable[[_GeneratorContextManager[_T_co], Callable[..., Iterator[_T_co]], tuple[Any, ...], dict[str, Any]], None]") [assignment]
- pyinstrument/low_level/stat_profile_python.py:26: error: Variable "pyinstrument.low_level.types.TimerType" is not valid as a type [valid-type]
- pyinstrument/low_level/stat_profile_python.py:26: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/low_level/stat_profile_python.py:100: error: Variable "pyinstrument.low_level.types.TimerType" is not valid as a type [valid-type]
- pyinstrument/low_level/stat_profile_python.py:100: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/stack_sampler.py:98: error: Unused "type: ignore" comment [unused-ignore]
- pyinstrument/stack_sampler.py:138: error: Variable "pyinstrument.low_level.types.TimerType" is not valid as a type [valid-type]
- pyinstrument/stack_sampler.py:138: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/stack_sampler.py:207: error: Variable "pyinstrument.low_level.types.TimerType" is not valid as a type [valid-type]
- pyinstrument/stack_sampler.py:207: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/stack_sampler.py:304: error: Incompatible types in string interpolation (expression has type "int | None", placeholder has type "int | float | SupportsInt") [str-format]
- pyinstrument/stack_sampler.py:315: error: Variable "pyinstrument.typing.LiteralStr" is not valid as a type [valid-type]
- pyinstrument/stack_sampler.py:315: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/stack_sampler.py:315: error: Name "in_context" is not defined [name-defined]
- pyinstrument/stack_sampler.py:315: error: Name "out_of_context_awaited" is not defined [name-defined]
- pyinstrument/stack_sampler.py:315: error: Name "out_of_context_unknown" is not defined [name-defined]
- pyinstrument/stack_sampler.py:333: error: Variable "pyinstrument.low_level.types.TimerType" is not valid as a type [valid-type]
- pyinstrument/stack_sampler.py:333: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/stack_sampler.py:336: error: Variable "pyinstrument.low_level.types.TimerType" is not valid as a type [valid-type]
- pyinstrument/stack_sampler.py:336: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/renderers/pstatsrenderer.py:50: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
- pyinstrument/renderers/pstatsrenderer.py:53: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
- pyinstrument/renderers/pstatsrenderer.py:54: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
- pyinstrument/renderers/pstatsrenderer.py:64: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
- pyinstrument/renderers/pstatsrenderer.py:66: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
- pyinstrument/renderers/pstatsrenderer.py:67: error: Incompatible types in assignment (expression has type "float", variable has type "int") [assignment]
- pyinstrument/renderers/jsonrenderer.py:16: error: Unused "type: ignore" comment [unused-ignore]
- pyinstrument/renderers/console.py:35: error: Variable "pyinstrument.typing.LiteralStr" is not valid as a type [valid-type]
- pyinstrument/renderers/console.py:35: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/renderers/console.py:35: error: Name "seconds" is not defined [name-defined]
- pyinstrument/renderers/console.py:35: error: Name "percent_of_total" is not defined [name-defined]
- pyinstrument/renderers/console.py:36: error: Variable "pyinstrument.renderers.console.FlatTimeMode" is not valid as a type [valid-type]
- pyinstrument/renderers/console.py:36: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/renderers/console.py:134: error: "type[object]" has no attribute "faint" [attr-defined]
- pyinstrument/renderers/console.py:134: error: "type[object]" has no attribute "end" [attr-defined]
- pyinstrument/renderers/console.py:231: error: "type[object]" has no attribute "end" [attr-defined]
- pyinstrument/renderers/console.py:239: error: "type[object]" has no attribute "end" [attr-defined]
- pyinstrument/renderers/console.py:241: error: "type[object]" has no attribute "faint" [attr-defined]
- pyinstrument/renderers/console.py:241: error: "type[object]" has no attribute "end" [attr-defined]
- pyinstrument/renderers/console.py:254: error: "type[object]" has no attribute "red" [attr-defined]
- pyinstrument/renderers/console.py:256: error: "type[object]" has no attribute "yellow" [attr-defined]
- pyinstrument/renderers/console.py:258: error: "type[object]" has no attribute "green" [attr-defined]
- pyinstrument/renderers/console.py:260: error: "type[object]" has no attribute "bright_green" [attr-defined]
- pyinstrument/renderers/console.py:260: error: "type[object]" has no attribute "faint" [attr-defined]
- pyinstrument/renderers/console.py:264: error: "type[object]" has no attribute "bg_dark_blue_255" [attr-defined]
- pyinstrument/renderers/console.py:264: error: "type[object]" has no attribute "white_255" [attr-defined]
- pyinstrument/profiler.py:51: error: Variable "pyinstrument.profiler.AsyncMode" is not valid as a type [valid-type]
- pyinstrument/profiler.py:51: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/profiler.py:57: error: Variable "pyinstrument.profiler.AsyncMode" is not valid as a type [valid-type]
- pyinstrument/profiler.py:57: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/profiler.py:84: error: Variable "pyinstrument.profiler.AsyncMode" is not valid as a type [valid-type]
- pyinstrument/profiler.py:84: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/profiler.py:236: error: Unused "type: ignore" comment [unused-ignore]
- pyinstrument/profiler.py:290: error: Variable "pyinstrument.typing.LiteralStr" is not valid as a type [valid-type]
- pyinstrument/profiler.py:290: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/profiler.py:290: error: Name "seconds" is not defined [name-defined]
- pyinstrument/profiler.py:290: error: Name "percent_of_total" is not defined [name-defined]
- pyinstrument/profiler.py:292: error: Variable "pyinstrument.renderers.console.FlatTimeMode" is not valid as a type [valid-type]
- pyinstrument/profiler.py:292: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/profiler.py:330: error: Variable "pyinstrument.typing.LiteralStr" is not valid as a type [valid-type]
- pyinstrument/profiler.py:330: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/profiler.py:330: error: Name "seconds" is not defined [name-defined]
- pyinstrument/profiler.py:330: error: Name "percent_of_total" is not defined [name-defined]
- pyinstrument/profiler.py:332: error: Variable "pyinstrument.renderers.console.FlatTimeMode" is not valid as a type [valid-type]
- pyinstrument/profiler.py:332: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/context_manager.py:19: error: Variable "pyinstrument.profiler.AsyncMode" is not valid as a type [valid-type]
- pyinstrument/context_manager.py:19: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/context_manager.py:30: error: Variable "pyinstrument.typing.Unpack" is not valid as a type [valid-type]
- pyinstrument/context_manager.py:30: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/context_manager.py:41: error: Incompatible types in assignment (expression has type "dict[str, Unpack?[TypedDict('pyinstrument.context_manager.ProfileContextOptions', {'interval'?: builtins.float, 'async_mode'?: AsyncMode?, 'use_timing_thread'?: Union[builtins.bool, None], 'renderer'?: Union[pyinstrument.renderers.base.Renderer, None], 'target_description'?: Union[builtins.str, None]})]]", variable has type "ProfileContextOptions") [assignment]
- pyinstrument/context_manager.py:46: error: Variable "pyinstrument.typing.Unpack" is not valid as a type [valid-type]
- pyinstrument/context_manager.py:46: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/context_manager.py:48: error: Variable "pyinstrument.typing.Unpack" is not valid as a type [valid-type]
- pyinstrument/context_manager.py:48: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/context_manager.py:71: error: Unused "type: ignore" comment [unused-ignore]
- pyinstrument/context_manager.py:104: error: Variable "pyinstrument.typing.Unpack" is not valid as a type [valid-type]
- pyinstrument/context_manager.py:104: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/context_manager.py:106: error: Variable "pyinstrument.typing.Unpack" is not valid as a type [valid-type]
- pyinstrument/context_manager.py:106: note: See https://mypy.readthedocs.io/en/stable/common_issues.html#variables-vs-type-aliases
- pyinstrument/magic/magic.py:10: error: Unused "type: ignore" comment [unused-ignore]
- pyinstrument/magic/magic.py:43: error: Unused "type: ignore" comment [unused-ignore]
- pyinstrument/magic/magic.py:185: error: Unused "type: ignore" comment [unused-ignore]
+ Traceback (most recent call last):
+ File "", line 8, in <module>
+ sys.exit(console_entry())
+ File "mypy/build.py", line 2069, in wrap_context
+ AssertionError: Var:nil(ModuleSpec)
- pyinstrument/middleware.py:37: error: Unused "type: ignore" comment [unused-ignore]
- pyinstrument/middleware.py:95: error: Unused "type: ignore" comment [unused-ignore]
- pyinstrument/middleware.py:99: error: Unused "type: ignore" comment [unused-ignore]
- pyinstrument/__main__.py:34: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- pyinstrument/__main__.py:268: error: Unused "type: ignore" comment [unused-ignore]
- pyinstrument/__main__.py:273: error: Unused "type: ignore" comment [unused-ignore]
- pyinstrument/__main__.py:564: error: Unused "type: ignore" comment [unused-ignore]
aioredis (https://github.com/aio-libs/aioredis)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/genericpath.pyi: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.2
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+ File "", line 8, in <module>
+ sys.exit(console_entry())
+ File "mypy/build.py", line 2069, in wrap_context
+ AssertionError: Var:nil(ModuleSpec)
- aioredis/exceptions.py:14: error: Duplicate base class "TimeoutError" [misc]
- aioredis/utils.py:45: error: Unused "type: ignore" comment [unused-ignore]
- aioredis/connection.py:455: error: Type of variable becomes "Any | None" due to an unfollowed import [no-any-unimported]
- aioredis/connection.py:933: error: Unsupported right operand type for in ("bytes | memoryview[int] | int") [operator]
- aioredis/connection.py:934: error: Item "memoryview[int]" of "bytes | memoryview[int] | int" has no attribute "split" [union-attr]
- aioredis/connection.py:934: error: Item "int" of "bytes | memoryview[int] | int" has no attribute "split" [union-attr]
- aioredis/connection.py:1201: error: Unused "type: ignore" comment [unused-ignore]
- aioredis/connection.py:1201: error: TypedDict key must be a string literal; expected one of ("username", "password", "connection_class", "host", "port", ...) [literal-required]
- aioredis/connection.py:1201: note: Error code changed to literal-required; "type: ignore" comment may be out of date
- aioredis/connection.py:1205: error: Unused "type: ignore" comment [unused-ignore]
- aioredis/connection.py:1205: error: TypedDict key must be a string literal; expected one of ("username", "password", "connection_class", "host", "port", ...) [literal-required]
- aioredis/connection.py:1205: note: Error code changed to literal-required; "type: ignore" comment may be out of date
- aioredis/client.py:94: error: Unused "type: ignore" comment [unused-ignore]
- aioredis/client.py:146: error: Signature of "update" incompatible with supertype "MutableMapping" [override]
- aioredis/client.py:146: note: Superclass:
- aioredis/client.py:146: note: @overload
- aioredis/client.py:146: note: def update(self, SupportsKeysAndGetItem[Any, Any], /, **kwargs: Any) -> None
- aioredis/client.py:146: note: @overload
- aioredis/client.py:146: note: def update(self, Iterable[tuple[Any, Any]], /, **kwargs: Any) -> None
- aioredis/client.py:146: note: @overload
- aioredis/client.py:146: note: def update(self, **kwargs: Any) -> None
- aioredis/client.py:146: note: Subclass:
- aioredis/client.py:146: note: def update(self, data: Any) -> Any
- aioredis/client.py:4114: error: Incompatible types in assignment (expression has type "dict[bytes | str | memoryview[int], Any | None]", variable has type "dict[bytes | str | memoryview[int], Callable[[dict[str, str]], Awaitable[None]]]") [assignment]
- aioredis/client.py:4158: error: Argument 1 to "update" of "MutableMapping" has incompatible type "dict[bytes | str | memoryview[int], Any | None]"; expected "SupportsKeysAndGetItem[bytes | str | memoryview[int], Callable[[dict[str, str]], Awaitable[None]]]" [arg-type]
- aioredis/client.py:4172: error: Incompatible types in assignment (expression has type "dict[bytes | str | memoryview[int], Callable[[dict[str, str]], Awaitable[None]]]", variable has type "dict[Any, Any | None]") [assignment]
pegen (https://github.com/we-like-parsers/pegen)
- src/pegen/web.py:6: error: Unused "type: ignore" comment [unused-ignore]
- src/pegen/web.py:7: error: Unused "type: ignore" comment [unused-ignore]
- src/pegen/web.py:55: error: Argument 1 to "make_parser" has incompatible type "str | None"; expected "str" [arg-type]
- src/pegen/web.py:56: error: Argument 1 to "parse_string" has incompatible type "str | None"; expected "str" [arg-type]
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/genericpath.pyi: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.2
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+ File "", line 8, in <module>
+ sys.exit(console_entry())
+ File "mypy/build.py", line 2069, in wrap_context
+ AssertionError: Var:nil(ModuleSpec)
com2ann (https://github.com/ilevkivskyi/com2ann)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/genericpath.pyi: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.2
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+ File "", line 8, in <module>
+ sys.exit(console_entry())
+ File "mypy/build.py", line 2069, in wrap_context
+ AssertionError: Var:nil(ModuleSpec)
websockets (https://github.com/aaugustin/websockets)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/genericpath.pyi: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.2
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+ File "", line 8, in <module>
+ sys.exit(console_entry())
+ File "mypy/build.py", line 2069, in wrap_context
+ AssertionError: Var:nil(ModuleSpec)
parso (https://github.com/davidhalter/parso)
- parso/python/prefix.py:17: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- parso/python/tree.py:49: error: Module "collections" does not explicitly export attribute "Mapping" [attr-defined]
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/genericpath.pyi: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.2
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+ File "", line 8, in <module>
+ sys.exit(console_entry())
+ File "mypy/build.py", line 2069, in wrap_context
+ AssertionError: Var:nil(ModuleSpec)
CPython (Argument Clinic) (https://github.com/python/cpython)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/genericpath.pyi: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.2
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+ File "", line 8, in <module>
+ sys.exit(console_entry())
+ File "mypy/build.py", line 2069, in wrap_context
+ AssertionError: Var:nil(ModuleSpec)
alerta (https://github.com/alerta/alerta)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/genericpath.pyi: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.2
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+ File "", line 8, in <module>
+ sys.exit(console_entry())
+ File "mypy/build.py", line 2069, in wrap_context
+ AssertionError: Var:nil(ModuleSpec)
- alerta/models/enums.py:126: error: Incompatible default for argument "resource" (default has type "None", argument has type "str") [assignment]
- alerta/models/enums.py:126: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/enums.py:126: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/enums.py:126: error: Incompatible default for argument "type" (default has type "None", argument has type "str") [assignment]
- alerta/utils/paging.py:9: error: Incompatible default for argument "page_size" (default has type "None", argument has type "int") [assignment]
- alerta/utils/paging.py:9: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/utils/paging.py:9: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/token.py:18: error: Incompatible default for argument "jti" (default has type "None", argument has type "str") [assignment]
- alerta/models/token.py:18: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/token.py:18: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/token.py:43: error: Incompatible default for argument "key" (default has type "None", argument has type "str") [assignment]
- alerta/models/token.py:43: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/token.py:43: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/utils/plugin.py:49: error: Unused "type: ignore" comment [unused-ignore]
- alerta/app.py:48: error: Incompatible default for argument "config_override" (default has type "None", argument has type "dict[str, Any]") [assignment]
- alerta/app.py:48: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/app.py:48: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/app.py:48: error: Incompatible default for argument "environment" (default has type "None", argument has type "str") [assignment]
- alerta/app.py:58: error: Unused "type: ignore" comment [unused-ignore]
- alerta/models/permission.py:76: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/permission.py:76: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/permission.py:76: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/permission.py:80: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/permission.py:80: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/permission.py:80: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/note.py:133: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/note.py:133: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/note.py:133: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/key.py:24: error: Incompatible default for argument "expire_time" (default has type "None", argument has type "datetime") [assignment]
- alerta/models/key.py:24: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/key.py:24: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/key.py:24: error: Incompatible default for argument "customer" (default has type "None", argument has type "str") [assignment]
- alerta/models/key.py:42: error: Incompatible return value type (got "str", expected "ApiKeyStatus") [return-value]
- alerta/models/key.py:54: error: Argument "expire_time" to "ApiKey" has incompatible type "datetime | None"; expected "datetime" [arg-type]
- alerta/models/key.py:127: error: Incompatible default for argument "user" (default has type "None", argument has type "str") [assignment]
- alerta/models/key.py:127: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/key.py:127: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/key.py:134: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/key.py:134: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/key.py:134: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/key.py:141: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/key.py:141: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/key.py:141: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/heartbeat.py:28: error: Incompatible default for argument "origin" (default has type "None", argument has type "str") [assignment]
- alerta/models/heartbeat.py:28: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/heartbeat.py:28: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/heartbeat.py:28: error: Incompatible default for argument "tags" (default has type "None", argument has type "list[str]") [assignment]
- alerta/models/heartbeat.py:28: error: Incompatible default for argument "create_time" (default has type "None", argument has type "datetime") [assignment]
- alerta/models/heartbeat.py:28: error: Incompatible default for argument "timeout" (default has type "None", argument has type "int") [assignment]
- alerta/models/heartbeat.py:28: error: Incompatible default for argument "customer" (default has type "None", argument has type "str") [assignment]
- alerta/models/heartbeat.py:88: error: Argument "create_time" to "Heartbeat" has incompatible type "datetime | None"; expected "datetime" [arg-type]
- alerta/models/heartbeat.py:161: error: Incompatible default for argument "customers" (default has type "None", argument has type "list[str]") [assignment]
- alerta/models/heartbeat.py:161: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/heartbeat.py:161: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/heartbeat.py:166: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/heartbeat.py:166: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/heartbeat.py:166: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/heartbeat.py:170: error: Incompatible default for argument "status" (default has type "None", argument has type "list[str]") [assignment]
- alerta/models/heartbeat.py:170: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/heartbeat.py:170: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/heartbeat.py:170: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/heartbeat.py:174: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/heartbeat.py:174: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/heartbeat.py:174: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/group.py:135: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/group.py:135: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/group.py:135: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/group.py:139: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/group.py:139: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/group.py:139: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/customer.py:71: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/customer.py:71: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/customer.py:71: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/customer.py:75: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/customer.py:75: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/customer.py:75: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/blackout.py:225: error: Incompatible default for argument "customers" (default has type "None", argument has type "list[str]") [assignment]
- alerta/models/blackout.py:225: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/blackout.py:225: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/blackout.py:229: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/blackout.py:229: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/blackout.py:229: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/blackout.py:233: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/blackout.py:233: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/blackout.py:233: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:38: error: Unused "type: ignore" comment [unused-ignore]
- alerta/models/alert.py:43: error: Unused "type: ignore" comment [unused-ignore]
- alerta/models/alert.py:413: error: Incompatible default for argument "customers" (default has type "None", argument has type "list[str]") [assignment]
- alerta/models/alert.py:413: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:413: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:429: error: Incompatible default for argument "timeout" (default has type "None", argument has type "int") [assignment]
- alerta/models/alert.py:429: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:429: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:489: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:489: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:489: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:498: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:498: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:498: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:503: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:503: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:503: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:508: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:508: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:508: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:513: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:513: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:513: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:518: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:518: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:518: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:522: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:522: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:522: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:527: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:527: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:527: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:531: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:531: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:531: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:536: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:536: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:536: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:540: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:540: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:540: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:545: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:545: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:545: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:550: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:550: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:550: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:555: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:555: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:555: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:560: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/alert.py:560: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:560: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:608: error: Incompatible default for argument "timeout" (default has type "None", argument has type "int") [assignment]
- alerta/models/alert.py:608: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:608: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:636: error: Incompatible default for argument "timeout" (default has type "None", argument has type "int") [assignment]
- alerta/models/alert.py:636: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:636: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:664: error: Incompatible types in assignment (expression has type "str", variable has type "ChangeType") [assignment]
- alerta/models/alert.py:691: error: Incompatible default for argument "timeout" (default has type "None", argument has type "int") [assignment]
- alerta/models/alert.py:691: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:691: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/alert.py:694: error: Incompatible default for argument "timeout" (default has type "None", argument has type "int") [assignment]
- alerta/models/alert.py:694: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/alert.py:694: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/auth/utils.py:19: error: Unused "type: ignore" comment [unused-ignore]
- alerta/auth/utils.py:30: error: Name "check_password_hash" already defined on line 26 [no-redef]
- alerta/auth/utils.py:31: error: Name "generate_password_hash" already defined on line 21 [no-redef]
- alerta/auth/utils.py:51: error: Incompatible default for argument "email" (default has type "None", argument has type "str") [assignment]
- alerta/auth/utils.py:51: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/auth/utils.py:51: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/auth/utils.py:51: error: Incompatible default for argument "email_verified" (default has type "None", argument has type "bool") [assignment]
- alerta/auth/utils.py:51: error: Incompatible default for argument "picture" (default has type "None", argument has type "str") [assignment]
- alerta/auth/utils.py:104: error: Incompatible default for argument "salt" (default has type "None", argument has type "str") [assignment]
- alerta/auth/utils.py:104: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/auth/utils.py:104: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/auth/utils.py:109: error: Incompatible default for argument "salt" (default has type "None", argument has type "str") [assignment]
- alerta/auth/utils.py:109: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/auth/utils.py:109: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/utils/api.py:14: error: Incompatible default for argument "wanted" (default has type "None", argument has type "str") [assignment]
- alerta/utils/api.py:14: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/utils/api.py:14: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/utils/api.py:95: error: Incompatible default for argument "timeout" (default has type "None", argument has type "int") [assignment]
- alerta/utils/api.py:95: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/utils/api.py:95: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/user.py:163: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/user.py:163: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/user.py:163: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/user.py:167: error: Incompatible default for argument "query" (default has type "None", argument has type "Query") [assignment]
- alerta/models/user.py:167: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/user.py:167: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/models/user.py:202: error: Incompatible default for argument "salt" (default has type "None", argument has type "str") [assignment]
- alerta/models/user.py:202: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/models/user.py:202: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/tasks.py:23: error: Argument 4 to "process_action" has incompatible type "int | None"; expected "int" [arg-type]
- alerta/tasks.py:24: error: Argument 3 to "from_action" of "Alert" has incompatible type "int | None"; expected "int" [arg-type]
- alerta/tasks.py:38: error: Argument 3 to "from_status" of "Alert" has incompatible type "int | None"; expected "int" [arg-type]
- alerta/auth/decorators.py:49: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- alerta/auth/decorators.py:86: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- alerta/auth/decorators.py:117: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- alerta/auth/decorators.py:148: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- alerta/auth/decorators.py:160: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- alerta/webhooks/__init__.py:32: error: Incompatible default for argument "name" (default has type "None", argument has type "str") [assignment]
- alerta/webhooks/__init__.py:32: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/webhooks/__init__.py:32: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/webhooks/custom.py:50: error: Unused "type: ignore" comment [unused-ignore]
- alerta/views/permissions.py:73: note: By default the bodies of untyped functions are not checked, consider using --check-untyped-defs [annotation-unchecked]
- alerta/views/alerts.py:49: error: Unused "type: ignore" comment [unused-ignore]
- alerta/management/views.py:26: error: Unused "type: ignore" comment [unused-ignore]
- alerta/auth/oidc.py:9: error: Unused "type: ignore" comment [unused-ignore]
- alerta/commands.py:17: error: Incompatible default for argument "config_override" (default has type "None", argument has type "dict[str, Any]") [assignment]
- alerta/commands.py:17: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
- alerta/commands.py:17: note: Use https://github.com/hauntsaninja/no_implicit_optional to automatically upgrade your codebase
- alerta/commands.py:17: error: Incompatible default for argument "environment" (default has type "None", argument has type "str") [assignment]
- alerta/webhooks/telegram.py:17: error: Unused "type: ignore" comment [unused-ignore]
- alerta/plugins/forwarder.py:39: error: Unused "type: ignore" comment [unused-ignore]
- alerta/plugins/forwarder.py:75: error: Unused "type: ignore" comment [unused-ignore]
- alerta/plugins/forwarder.py:104: error: Unused "type: ignore" comment [unused-ignore]
- alerta/database/backends/postgres/utils.py:16: error: Unused "type: ignore" comment [unused-ignore]
- alerta/database/backends/mongodb/utils.py:19: error: Unused "type: ignore" comment [unused-ignore]
- alerta/database/backends/mongodb/utils.py:159: error: Unused "type: ignore" comment [unused-ignore]
- alerta/database/backends/mongodb/utils.py:223: error: Unused "type: ignore" comment [unused-ignore]
- alerta/database/backends/mongodb/utils.py:243: error: Unused "type: ignore" comment [unused-ignore]
- alerta/database/backends/mongodb/utils.py:289: error: Unused "type: ignore" comment [unused-ignore]
- alerta/database/backends/mongodb/utils.py:295: error: Unused "type: ignore" comment [unused-ignore]
- alerta/database/backends/mongodb/utils.py:332: error: Unused "type: ignore" comment [unused-ignore]
- alerta/database/backends/mongodb/utils.py:338: error: Unused "type: ignore" comment [unused-ignore]
- alerta/database/backends/mongodb/utils.py:383: error: Unused "type: ignore" comment [unused-ignore]
- alerta/database/backends/mongodb/utils.py:406: error: Unused "type: ignore" comment [unused-ignore]
- alerta/database/backends/mongodb/utils.py:429: error: Unused "type: ignore" comment [unused-ignore]
- alerta/database/backends/mongodb/utils.py:451: error: Unused "type: ignore" comment [unused-ignore]
- tests/plugins/test_reject.py:9: error: Need type annotation for "TEST_ORIGIN_BLACKLISTS" (hint: "TEST_ORIGIN_BLACKLISTS: list[<type>] = ...") [var-annotated]
tornado (https://github.com/tornadoweb/tornado)
+ /tmp/mypy_primer/new_typeshed/typeshed_to_test/stdlib/genericpath.pyi: error: INTERNAL ERROR -- Please try using mypy master on GitHub:
+ https://mypy.readthedocs.io/en/stable/common_issues.html#using-a-development-mypy-build
+ Please report a bug at https://github.com/python/mypy/issues
+ version: 1.11.2
+ note: use --pdb to drop into pdb
+ Traceback (most recent call last):
+ File "", line 8, in <module>
+ sys.exit(console_entry())
+ File "mypy/build.py", line 2069, in wrap_context
+ AssertionError: Var:nil(ModuleSpec)
- tornado/util.py:172: error: Unused "type: ignore" comment [unused-ignore]
- tornado/util.py:366: error: Unused "type: ignore" comment [unused-ignore]
- tornado/log.py:38: error: Unused "type: ignore" comment [unused-ignore]
- tornado/log.py:40: error: Incompatible types in assignment (expression has type "None", variable has type Module) [assignment]
- tornado/concurrent.py:167: error: Unused "type: ignore" comment [unused-ignore]
- tornado/concurrent.py:168: error: Unused "type: ignore" comment [unused-ignore]
- tornado/netutil.py:118: error: Unused "type: ignore" comment [unused-ignore]
- tornado/netutil.py:518: error: Unused "type: ignore" comment [unused-ignore]
- tornado/gen.py:261: error: Unused "type: ignore" comment [unused-ignore]
- tornado/gen.py:872: error: Unused "type: ignore" comment [unused-ignore]
- tornado/iostream.py:68: error: Unused "type: ignore" comment [unused-ignore]
- tornado/iostream.py:1121: error: Unused "type: ignore" comment [unused-ignore]
- tornado/iostream.py:1513: error: Unused "type: ignore" comment [unused-ignore]
- tornado/iostream.py:1593: error: Unused "type: ignore" comment [unused-ignore]
- tornado/iostream.py:1601: error: Unused "type: ignore" comment [unused-ignore]
- tornado/httpclient.py:206: error: Unused "type: ignore" comment [unused-ignore]
- tornado/httpclient.py:563: error: Unused "type: ignore" comment [unused-ignore]
- tornado/platform/asyncio.py:397: error: Unused "type: ignore" comment [unused-ignore]
- tornado/tcpclient.py:274: error: Argument 1 to "_create_stream" of "TCPClient" has incompatible type "Optional[int]"; expected "int" [arg-type]
- tornado/process.py:58: error: Unused "type: ignore" comment [unused-ignore]
- tornado/process.py:346: error: Unused "type: ignore" comment [unused-ignore]
- tornado/curl_httpclient.py:234: error: Unused "type: ignore" comment [unused-ignore]
- tornado/curl_httpclient.py:366: error: Argument 2 to "_curl_header_callback" of "CurlAsyncHTTPClient" has incompatible type "Optional[Callable[[str], None]]"; expected "Callable[[str], None]" [arg-type]
- tornado/web.py:242: error: Unused "type: ignore" comment [unused-ignore]
- tornado/testing.py:860: error: Unused "type: ignore" comment [unused-ignore]
- tornado/wsgi.py:180: error: Unused "type: ignore" comment [unused-ignore]
- tornado/test/util.py:77: error: Unused "type: ignore" comment [unused-ignore]
- tornado/test/locks_test.py:102: error: Unused "type: ignore" comment [unused-ignore]
- tornado/test/asyncio_test.py:247: error: Unused "type: ignore" comment [unused-ignore]
- tornado/test/asyncio_test.py:257: error: Unused "type: ignore" comment [unused-ignore]
- tornado/test/asyncio_test.py:261: error: Unused "type: ignore" comment [unused-ignore]
- tornado/test/websocket_test.py:82: error: Signature of "open" incompatible with supertype "WebSocketHandler" [override]
- tornado/test/websocket_test.py:82: note: Superclass:
- tornado/test/websocket_test.py:82: note: def open(self, *args: str, **kwargs: str) -> Optional[Awaitable[None]]
- tornado/test/websocket_test.py:82: note: Subclass:
- tornado/test/websocket_test.py:82: note: def open(self) -> Any
- tornado/test/websocket_test.py:124: error: Signature of "open" incompatible with supertype "WebSocketHandler" [override]
- tornado/test/websocket_test.py:124: note: Superclass:
- tornado/test/websocket_test.py:124: note: def open(self, *args: str, **kwargs: str) -> Optional[Awaitable[None]]
- tornado/test/websocket_test.py:124: note: Subclass:
- tornado/test/websocket_test.py:124: note: def open(self) -> Any
- tornado/test/websocket_test.py:139: error: Signature of "open" incompatible with supertype "WebSocketHandler" [override]
- tornado/test/websocket_test.py:139: note: Superclass:
- tornado/test/websocket_test.py:139: note: def open(self, *args: str, **kwargs: str) -> Optional[Awaitable[None]]
- tornado/test/websocket_test.py:139: note: Subclass:
- tornado/test/websocket_test.py:139: note: def open(self, arg: Any) -> Any
- tornado/test/websocket_test.py:144: error: Signature of "initialize" incompatible with supertype "TestWebSocketHandler" [override]
- tornado/test/websocket_test.py:144: note: Superclass:
- tornado/test/websocket_test.py:144: note: def initialize(self, close_future: Any = ..., compression_options: Any = ...) -> Any
- tornado/test/websocket_test.py:144: note: Subclass:
- tornado/test/websocket_test.py:144: note: def initialize(self, **kwargs: Any) -> Any
- tornado/test/websocket_test.py:164: error: Signature of "initialize" incompatible with supertype "TestWebSocketHandler" [override]
- tornado/test/websocket_test.py:164: note: Superclass:
- tornado/test/websocket_test.py:164: note: def initialize(self, close_future: Any = ..., compression_options: Any = ...) -> Any
- tornado/test/websocket_test.py:164: note: Subclass:
- tornado/test/websocket_test.py:164: note: def initialize(self, **kwargs: Any) -> Any
- tornado/test/websocket_test.py:176: error: Signature of "open" incompatible with supertype "WebSocketHandler" [override]
- tornado/test/websocket_test.py:176: note: Superclass:
- tornado/test/websocket_test.py:176: note: def open(self, *args: str, **kwargs: str) -> Optional[Awaitable[None]]
- tornado/test/websocket_test.py:176: note: Subclass:
- tornado/test/websocket_test.py:176: note: def open(self) -> Any
- tornado/test/websocket_test.py:183: error: Signature of "initialize" incompatible with supertype "TestWebSocketHandler" [override]
- tornado/test/websocket_test.py:183: note: Superclass:
- tornado/test/websocket_test.py:183: note: def initialize(self, close_future: Any = ..., compression_options: Any = ...) -> Any
- tornado/test/websocket_test.py:183: note: Subclass:
- tornado/test/websocket_test.py:183: note: def initialize(self, test: Any, **kwargs: Any) -> Any
- tornado/test/websocket_test.py:201: error: Signature of "open" incompatible with supertype "WebSocketHandler" [override]
- tornado/test/websocket_test.py:201: note: Superclass:
- tornado/test/websocket_test.py:201: note: def open(self, *args: str, **kwargs: str) -> Optional[Awaitable[None]]
- tornado/test/websocket_test.py:201: note: Subclass:
- tornado/test/websocket_test.py:201: note: def open(self) -> Any
- tornado/test/websocket_test.py:206: error: Signature of "open" incompatible with supertype "WebSocketHandler" [override]
- tornado/test/websocket_test.py:206: note: Superclass:
- tornado/test/websocket_test.py:206: note: def open(self, *args: str, **kwargs: str) -> Optional[Awaitable[None]]
- tornado/test/websocket_test.py:206: note: Subclass:
- tornado/test/websocket_test.py:206: note: def open(self) -> Any
- tornado/test/websocket_test.py:212: error: Signature of "open" incompatible with supertype "WebSocketHandler" [override]
- tornado/test/websocket_test.py:212: note: Superclass:
- tornado/test/websocket_test.py:212: note: def open(self, *args: str, **kwargs: str) -> Optional[Awaitable[None]]
- tornado/test/websocket_test.py:212: note: Subclass:
- tornado/test/websocket_test.py:212: note: def open(self) -> Any
- tornado/test/websocket_test.py:636: error: Signature of "initialize" incompatible with supertype "TestWebSocketHandler" [override]
- tornado/test/websocket_test.py:636: note: Superclass:
- tornado/test/websocket_test.py:636: note: def initialize(self, close_future: Any = ..., compression_options: Any = ...) -> Any
- tornado/test/websocket_test.py:636: note: Subclass:
- tornado/test/websocket_test.py:636: note: def initialize(self, **kwargs: Any) -> Any
- tornado/test/web_test.py:114: error: Signature of "get_cookie" incompatible with supertype "RequestHandler" [override]
- tornado/test/web_test.py:114: note: Superclass:
- tornado/test/web_test.py:114: note: @overload
- tornado/test/web_test.py:114: note: def get_cookie(self, name: str, default: str) -> str
- tornado/test/web_test.py:114: note: @overload
- tornado/test/web_test.py:114: note: def get_cookie(self, name: str, default: None = ...) -> Optional[str]
- tornado/test/web_test.py:114: note: Subclass:
- tornado/test/web_test.py:114: note: def get_cookie(self, name: Any) -> Any
- tornado/test/web_test.py:117: error: Signature of "set_cookie" incompatible with supertype "RequestHandler" [override]
- tornado/test/web_test.py:117: note: Superclass:
- tornado/test/web_test.py:117: note: def set_cookie(self, name: str, value: Union[str, bytes], domain: Optional[str] = ..., expires: Union[float, tuple[Any, ...], datetime, None] = ..., path: str = ..., expires_days: Optional[float] = ..., *, max_age: Optional[int] = ..., httponly: bool = ..., secure: bool = ..., samesite: Optional[str]
... (truncated 31365 lines) ...
Diff from mypy_primer, showing the effect of this PR on open source code:
colour (https://github.com/colour-science/colour)
+ colour/__init__.py:968: error: Too many arguments for "SourceFileLoader" [call-arg]
+ colour/__init__.py:968: error: "SourceFileLoader" has no attribute "load_module" [attr-defined]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/addons/script.py:34: error: Too many arguments for "SourceFileLoader" [call-arg]
+ mitmproxy/addons/script.py:35: error: Argument "loader" to "spec_from_loader" has incompatible type "SourceFileLoader"; expected "LoaderProtocol | None" [arg-type]
+ mitmproxy/addons/script.py:38: error: "SourceFileLoader" has no attribute "exec_module" [attr-defined]
flake8 (https://github.com/pycqa/flake8)
+ tests/unit/plugins/pycodestyle_test.py:24: error: Too many arguments for "SourceFileLoader" [call-arg]
+ tests/unit/plugins/pycodestyle_test.py:25: error: "SourceFileLoader" has no attribute "name" [attr-defined]
+ tests/unit/plugins/pycodestyle_test.py:25: error: Argument 2 to "spec_from_loader" has incompatible type "SourceFileLoader"; expected "LoaderProtocol | None" [arg-type]
+ tests/unit/plugins/pycodestyle_test.py:28: error: "SourceFileLoader" has no attribute "exec_module" [attr-defined]
beartype (https://github.com/beartype/beartype)
- beartype/claw/_importlib/clawimppath.py:81: error: Unused "type: ignore" comment [unused-ignore]
+ beartype/claw/_importlib/_clawimpload.py:28: error: Unused "type: ignore" comment [unused-ignore]
+ beartype/claw/_importlib/_clawimpload.py:357: error: "get_code" undefined in superclass [misc]
+ beartype/claw/_importlib/_clawimpload.py:381: error: "get_code" undefined in superclass [misc]
+ beartype/claw/_importlib/_clawimpload.py:394: error: Unused "type: ignore" comment [unused-ignore]
+ beartype/claw/_importlib/_clawimpload.py:447: error: Unused "type: ignore" comment [unused-ignore]
+ beartype/claw/_importlib/_clawimpload.py:447: error: "source_to_code" undefined in superclass [misc]
+ beartype/claw/_importlib/_clawimpload.py:447: note: Error code "misc" not covered by "type: ignore" comment
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/pathlib.py:42: error: Module "importlib._bootstrap_external" has no attribute "_NamespaceLoader" [attr-defined]
+ src/_pytest/assertion/rewrite.py:123: error: Right operand of "or" is never evaluated [unreachable]
+ src/_pytest/assertion/rewrite.py:127: error: Statement is unreachable [unreachable]
+ src/_pytest/assertion/rewrite.py:129: error: Statement is unreachable [unreachable]
cloud-init (https://github.com/canonical/cloud-init)
+ tools/test_tools.py:26: error: Too many arguments for "SourceFileLoader" [call-arg]
+ tools/test_tools.py:26: error: Argument 2 to "spec_from_loader" has incompatible type "SourceFileLoader"; expected "LoaderProtocol | None" [arg-type]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/internal/module.py:3: error: Module "importlib._bootstrap" has no attribute "_init_module_attrs" [attr-defined]
Diff from mypy_primer, showing the effect of this PR on open source code:
colour (https://github.com/colour-science/colour)
+ colour/__init__.py:968: error: Too many arguments for "SourceFileLoader" [call-arg]
+ colour/__init__.py:968: error: "SourceFileLoader" has no attribute "load_module" [attr-defined]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/addons/script.py:34: error: Too many arguments for "SourceFileLoader" [call-arg]
+ mitmproxy/addons/script.py:35: error: Argument "loader" to "spec_from_loader" has incompatible type "SourceFileLoader"; expected "LoaderProtocol | None" [arg-type]
+ mitmproxy/addons/script.py:38: error: "SourceFileLoader" has no attribute "exec_module" [attr-defined]
flake8 (https://github.com/pycqa/flake8)
+ tests/unit/plugins/pycodestyle_test.py:24: error: Too many arguments for "SourceFileLoader" [call-arg]
+ tests/unit/plugins/pycodestyle_test.py:25: error: "SourceFileLoader" has no attribute "name" [attr-defined]
+ tests/unit/plugins/pycodestyle_test.py:25: error: Argument 2 to "spec_from_loader" has incompatible type "SourceFileLoader"; expected "LoaderProtocol | None" [arg-type]
+ tests/unit/plugins/pycodestyle_test.py:28: error: "SourceFileLoader" has no attribute "exec_module" [attr-defined]
beartype (https://github.com/beartype/beartype)
- beartype/claw/_importlib/clawimppath.py:81: error: Unused "type: ignore" comment [unused-ignore]
+ beartype/claw/_importlib/_clawimpload.py:28: error: Unused "type: ignore" comment [unused-ignore]
+ beartype/claw/_importlib/_clawimpload.py:357: error: "get_code" undefined in superclass [misc]
+ beartype/claw/_importlib/_clawimpload.py:381: error: "get_code" undefined in superclass [misc]
+ beartype/claw/_importlib/_clawimpload.py:394: error: Unused "type: ignore" comment [unused-ignore]
+ beartype/claw/_importlib/_clawimpload.py:447: error: Unused "type: ignore" comment [unused-ignore]
+ beartype/claw/_importlib/_clawimpload.py:447: error: "source_to_code" undefined in superclass [misc]
+ beartype/claw/_importlib/_clawimpload.py:447: note: Error code "misc" not covered by "type: ignore" comment
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/pathlib.py:42: error: Module "importlib._bootstrap_external" has no attribute "_NamespaceLoader" [attr-defined]
+ src/_pytest/assertion/rewrite.py:123: error: Right operand of "or" is never evaluated [unreachable]
+ src/_pytest/assertion/rewrite.py:127: error: Statement is unreachable [unreachable]
+ src/_pytest/assertion/rewrite.py:129: error: Statement is unreachable [unreachable]
cloud-init (https://github.com/canonical/cloud-init)
+ tools/test_tools.py:26: error: Too many arguments for "SourceFileLoader" [call-arg]
+ tools/test_tools.py:26: error: Argument 2 to "spec_from_loader" has incompatible type "SourceFileLoader"; expected "LoaderProtocol | None" [arg-type]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/internal/module.py:3: error: Module "importlib._bootstrap" has no attribute "_init_module_attrs" [attr-defined]
I'll investigate it more later, but it looks like at least some of the mypy primer stuff is because of the circular inheritance issue
Diff from mypy_primer, showing the effect of this PR on open source code:
colour (https://github.com/colour-science/colour)
+ colour/__init__.py:968: error: Too many arguments for "SourceFileLoader" [call-arg]
+ colour/__init__.py:968: error: "SourceFileLoader" has no attribute "load_module" [attr-defined]
mitmproxy (https://github.com/mitmproxy/mitmproxy)
+ mitmproxy/addons/script.py:34: error: Too many arguments for "SourceFileLoader" [call-arg]
+ mitmproxy/addons/script.py:35: error: Argument "loader" to "spec_from_loader" has incompatible type "SourceFileLoader"; expected "LoaderProtocol | None" [arg-type]
+ mitmproxy/addons/script.py:38: error: "SourceFileLoader" has no attribute "exec_module" [attr-defined]
flake8 (https://github.com/pycqa/flake8)
+ tests/unit/plugins/pycodestyle_test.py:24: error: Too many arguments for "SourceFileLoader" [call-arg]
+ tests/unit/plugins/pycodestyle_test.py:25: error: "SourceFileLoader" has no attribute "name" [attr-defined]
+ tests/unit/plugins/pycodestyle_test.py:25: error: Argument 2 to "spec_from_loader" has incompatible type "SourceFileLoader"; expected "LoaderProtocol | None" [arg-type]
+ tests/unit/plugins/pycodestyle_test.py:28: error: "SourceFileLoader" has no attribute "exec_module" [attr-defined]
beartype (https://github.com/beartype/beartype)
- beartype/claw/_importlib/clawimppath.py:81: error: Unused "type: ignore" comment [unused-ignore]
+ beartype/claw/_importlib/_clawimpload.py:28: error: Unused "type: ignore" comment [unused-ignore]
+ beartype/claw/_importlib/_clawimpload.py:357: error: "get_code" undefined in superclass [misc]
+ beartype/claw/_importlib/_clawimpload.py:381: error: "get_code" undefined in superclass [misc]
+ beartype/claw/_importlib/_clawimpload.py:394: error: Unused "type: ignore" comment [unused-ignore]
+ beartype/claw/_importlib/_clawimpload.py:447: error: Unused "type: ignore" comment [unused-ignore]
+ beartype/claw/_importlib/_clawimpload.py:447: error: "source_to_code" undefined in superclass [misc]
+ beartype/claw/_importlib/_clawimpload.py:447: note: Error code "misc" not covered by "type: ignore" comment
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/pathlib.py:42: error: Module "importlib._bootstrap_external" has no attribute "_NamespaceLoader" [attr-defined]
+ src/_pytest/assertion/rewrite.py:123: error: Right operand of "or" is never evaluated [unreachable]
+ src/_pytest/assertion/rewrite.py:127: error: Statement is unreachable [unreachable]
+ src/_pytest/assertion/rewrite.py:129: error: Statement is unreachable [unreachable]
cloud-init (https://github.com/canonical/cloud-init)
+ tools/test_tools.py:26: error: Too many arguments for "SourceFileLoader" [call-arg]
+ tools/test_tools.py:26: error: Argument 2 to "spec_from_loader" has incompatible type "SourceFileLoader"; expected "LoaderProtocol | None" [arg-type]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/internal/module.py:3: error: Module "importlib._bootstrap" has no attribute "_init_module_attrs" [attr-defined]
Diff from mypy_primer, showing the effect of this PR on open source code:
beartype (https://github.com/beartype/beartype)
+ beartype/claw/_importlib/_clawimpload.py:28: error: Unused "type: ignore" comment [unused-ignore]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/pathlib.py:42: error: Module "importlib._bootstrap_external" has no attribute "_NamespaceLoader" [attr-defined]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/internal/module.py:3: error: Module "importlib._bootstrap" has no attribute "_init_module_attrs" [attr-defined]
Diff from mypy_primer, showing the effect of this PR on open source code:
beartype (https://github.com/beartype/beartype)
+ beartype/claw/_importlib/_clawimpload.py:28: error: Unused "type: ignore" comment [unused-ignore]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/pathlib.py:42: error: Module "importlib._bootstrap_external" has no attribute "_NamespaceLoader" [attr-defined]
dd-trace-py (https://github.com/DataDog/dd-trace-py)
+ ddtrace/internal/module.py:3: error: Module "importlib._bootstrap" has no attribute "_init_module_attrs" [attr-defined]
Diff from mypy_primer, showing the effect of this PR on open source code:
beartype (https://github.com/beartype/beartype)
+ beartype/claw/_importlib/_clawimpload.py:28: error: Unused "type: ignore" comment [unused-ignore]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/pathlib.py:704: error: Argument 2 to "_NamespaceLoader" has incompatible type "Path"; expected "MutableSequence[str]" [arg-type]
+ src/_pytest/pathlib.py:704: error: Argument 3 to "_NamespaceLoader" has incompatible type "PathFinder"; expected "Callable[[str, Tuple[str, ...]], ModuleSpec]" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
beartype (https://github.com/beartype/beartype)
+ beartype/claw/_importlib/_clawimpload.py:28: error: Unused "type: ignore" comment [unused-ignore]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/pathlib.py:704: error: Argument 2 to "_NamespaceLoader" has incompatible type "Path"; expected "MutableSequence[str]" [arg-type]
+ src/_pytest/pathlib.py:704: error: Argument 3 to "_NamespaceLoader" has incompatible type "PathFinder"; expected "Callable[[str, Tuple[str, ...]], ModuleSpec]" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
beartype (https://github.com/beartype/beartype)
+ beartype/claw/_importlib/_clawimpload.py:28: error: Unused "type: ignore" comment [unused-ignore]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/pathlib.py:704: error: Argument 2 to "_NamespaceLoader" has incompatible type "Path"; expected "MutableSequence[str]" [arg-type]
+ src/_pytest/pathlib.py:704: error: Argument 3 to "_NamespaceLoader" has incompatible type "PathFinder"; expected "Callable[[str, Tuple[str, ...]], ModuleSpec]" [arg-type]
Diff from mypy_primer, showing the effect of this PR on open source code:
beartype (https://github.com/beartype/beartype)
+ beartype/claw/_importlib/_clawimpload.py:28: error: Unused "type: ignore" comment [unused-ignore]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/pathlib.py:704: error: Argument 2 to "_NamespaceLoader" has incompatible type "Path"; expected "MutableSequence[str]" [arg-type]
+ src/_pytest/pathlib.py:704: error: Argument 3 to "_NamespaceLoader" has incompatible type "PathFinder"; expected "Callable[[str, Tuple[str, ...]], ModuleSpec]" [arg-type]
Key diffs for the things moved between files:
__import__ moved from importlib.__init__ moved to _frozen_importlib: No diff.
spec_from_loader and module_from_spec moved from importlib.util to _frozen_importlib: No diff.
ModuleSpec, BuiltinImporter, and FrozenImporter moved from importlib.machinery to _frozen_importlib: No diff.
MAGIC_NUMBER, cache_from_source, source_from_cache, decode_source, and spec_from_file_location moved from importlib.util to _frozen_importlib_external: No diff.
The block of WindowsRegistryFinder through NamspaceLoader, moved from importlib.machinery to _frozen_importlib_external:
--- importlib.machinery (old)
+++ _frozen_importlib_external (new)
@@ -8,7 +8,7 @@
cls, fullname: str, path: Sequence[str] | None = None, target: types.ModuleType | None = None
) -> ModuleSpec | None: ...
-class PathFinder:
+class PathFinder(importlib.abc.MetaPathFinder):
if sys.version_info >= (3, 10):
@staticmethod
def invalidate_caches() -> None: ...
@@ -46,12 +44,47 @@
cls, *loader_details: tuple[type[importlib.abc.Loader], list[str]]
) -> Callable[[str], importlib.abc.PathEntryFinder]: ...
-class SourceFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader):
+class _LoaderBasics:
+ def is_package(self, fullname: str) -> bool: ...
+ def create_module(self, spec: ModuleSpec) -> types.ModuleType | None: ...
+ def exec_module(self, module: types.ModuleType) -> None: ...
+ def load_module(self, fullname: str) -> types.ModuleType: ...
+
+class SourceLoader(_LoaderBasics):
+ def path_mtime(self, path: str) -> float: ...
+ def set_data(self, path: str, data: bytes) -> None: ...
+ def get_source(self, fullname: str) -> str | None: ...
+ def path_stats(self, path: str) -> Mapping[str, Any]: ...
+ def source_to_code(
+ self, data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: ReadableBuffer | StrPath
+ ) -> types.CodeType: ...
+ def get_code(self, fullname: str) -> types.CodeType | None: ...
+
+class FileLoader:
+ name: str
+ path: str
+ def __init__(self, fullname: str, path: str) -> None: ...
+ def get_data(self, path: str) -> bytes: ...
+ def get_filename(self, name: str | None = None) -> str: ...
+ def load_module(self, name: str | None = None) -> types.ModuleType: ...
+ if sys.version_info >= (3, 10):
+ def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.FileReader: ...
+ else:
+ def get_resource_reader(self, module: types.ModuleType) -> Self | None: ...
+ def open_resource(self, resource: str) -> _io.FileIO: ...
+ def resource_path(self, resource: str) -> str: ...
+ def is_resource(self, name: str) -> bool: ...
+ def contents(self) -> Iterator[str]: ...
+
+class SourceFileLoader(importlib.abc.FileLoader, FileLoader, importlib.abc.SourceLoader, SourceLoader): # type: ignore[misc] # incompatible method arguments in base classes
def set_data(self, path: str, data: ReadableBuffer, *, _mode: int = 0o666) -> None: ...
+ def path_stats(self, path: str) -> Mapping[str, Any]: ...
-class SourcelessFileLoader(importlib.abc.FileLoader, importlib.abc.SourceLoader): ...
+class SourcelessFileLoader(importlib.abc.FileLoader, FileLoader, _LoaderBasics):
+ def get_code(self, fullname: str) -> types.CodeType | None: ...
+ def get_source(self, fullname: str) -> None: ...
-class ExtensionFileLoader(importlib.abc.ExecutionLoader):
+class ExtensionFileLoader(FileLoader, _LoaderBasics, importlib.abc.ExecutionLoader):
def __init__(self, name: str, path: str) -> None: ...
def get_filename(self, name: str | None = None) -> str: ...
def get_source(self, fullname: str) -> None: ...
@@ -62,8 +95,6 @@
def __hash__(self) -> int: ...
if sys.version_info >= (3, 11):
- import importlib.readers
-
class NamespaceLoader(importlib.abc.InspectLoader):
def __init__(
self, name: str, path: MutableSequence[str], path_finder: Callable[[str, tuple[str, ...]], ModuleSpec]
@@ -80,3 +111,29 @@
@staticmethod
@deprecated("module_repr() is deprecated, and has been removed in Python 3.12")
def module_repr(module: types.ModuleType) -> str: ...
+
+ _NamespaceLoader = NamespaceLoader
+else:
+ class _NamespaceLoader:
+ def __init__(
+ self, name: str, path: MutableSequence[str], path_finder: Callable[[str, tuple[str, ...]], ModuleSpec]
+ ) -> None: ...
+ def is_package(self, fullname: str) -> Literal[True]: ...
+ def get_source(self, fullname: str) -> Literal[""]: ...
+ def get_code(self, fullname: str) -> types.CodeType: ...
+ def create_module(self, spec: ModuleSpec) -> None: ...
+ def exec_module(self, module: types.ModuleType) -> None: ...
+ @deprecated("load_module() is deprecated; use exec_module() instead")
+ def load_module(self, fullname: str) -> types.ModuleType: ...
+ if sys.version_info >= (3, 10):
+ @staticmethod
+ @deprecated("module_repr() is deprecated, and has been removed in Python 3.12")
+ def module_repr(module: types.ModuleType) -> str: ...
+ def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.NamespaceReader: ...
+ else:
+ @classmethod
+ @deprecated("module_repr() is deprecated, and has been removed in Python 3.12")
+ def module_repr(cls, module: types.ModuleType) -> str: ...
+
+if sys.version_info >= (3, 13):
+ class AppleFrameworkLoader(ExtensionFileLoader, importlib.abc.ExecutionLoader): ...
In that diff, _LoaderBasics is new, and SourceLoader and FileLoader are roughly copies of the versions in importlib.abc, which have the following diffs respectively:
--- importlib.abc
+++ _frozen_importlib_external
@@ -1,5 +1,9 @@
-class SourceLoader(ResourceLoader, ExecutionLoader, metaclass=ABCMeta):
+class SourceLoader(_LoaderBasics):
def path_mtime(self, path: str) -> float: ...
def set_data(self, path: str, data: bytes) -> None: ...
def get_source(self, fullname: str) -> str | None: ...
def path_stats(self, path: str) -> Mapping[str, Any]: ...
+ def source_to_code(
+ self, data: ReadableBuffer | str | _ast.Module | _ast.Expression | _ast.Interactive, path: ReadableBuffer | StrPath
+ ) -> types.CodeType: ...
+ def get_code(self, fullname: str) -> types.CodeType | None: ...
--- importlib.abc
+++ _frozen_importlib_external
@@ -1,7 +1,15 @@
-class FileLoader(ResourceLoader, ExecutionLoader, metaclass=ABCMeta):
+class FileLoader:
name: str
path: str
def __init__(self, fullname: str, path: str) -> None: ...
def get_data(self, path: str) -> bytes: ...
def get_filename(self, name: str | None = None) -> str: ...
def load_module(self, name: str | None = None) -> types.ModuleType: ...
+ if sys.version_info >= (3, 10):
+ def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.FileReader: ...
+ else:
+ def get_resource_reader(self, module: types.ModuleType) -> Self | None: ...
+ def open_resource(self, resource: str) -> _io.FileIO: ...
+ def resource_path(self, resource: str) -> str: ...
+ def is_resource(self, name: str) -> bool: ...
+ def contents(self) -> Iterator[str]: ...
There's also the new _NamespaceLoader class, a version of NamespaceLoader for 3.10 and below. Here's a diff from the existing NamespaceLoader to the new copy:
--- NamespaceLoader (3.11+)
+++ _NamespaceLoader (3.10-)
@@ -1,4 +1,4 @@
- class NamespaceLoader(importlib.abc.InspectLoader):
+ class _NamespaceLoader:
def __init__(
self, name: str, path: MutableSequence[str], path_finder: Callable[[str, tuple[str, ...]], ModuleSpec]
) -> None: ...
@@ -9,8 +9,12 @@
def exec_module(self, module: types.ModuleType) -> None: ...
@deprecated("load_module() is deprecated; use exec_module() instead")
def load_module(self, fullname: str) -> types.ModuleType: ...
- def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.NamespaceReader: ...
- if sys.version_info < (3, 12):
+ if sys.version_info >= (3, 10):
@staticmethod
@deprecated("module_repr() is deprecated, and has been removed in Python 3.12")
def module_repr(module: types.ModuleType) -> str: ...
+ def get_resource_reader(self, module: types.ModuleType) -> importlib.readers.NamespaceReader: ...
+ else:
+ @classmethod
+ @deprecated("module_repr() is deprecated, and has been removed in Python 3.12")
+ def module_repr(cls, module: types.ModuleType) -> str: ...
Final notes: I added the private _init_module_attrs and _NamespaceLoader because both showed up in mypy-primer. I investigated the remaining mypy-primer result from pytest, and it seems correct: they're using an undocumented class directly, giving it arguments of the wrong type, but then never using it in a way where that matters.
Diff from mypy_primer, showing the effect of this PR on open source code:
beartype (https://github.com/beartype/beartype)
+ beartype/claw/_importlib/_clawimpload.py:28: error: Unused "type: ignore" comment [unused-ignore]
pytest (https://github.com/pytest-dev/pytest)
+ src/_pytest/pathlib.py:704: error: Argument 2 to "_NamespaceLoader" has incompatible type "Path"; expected "MutableSequence[str]" [arg-type]
+ src/_pytest/pathlib.py:704: error: Argument 3 to "_NamespaceLoader" has incompatible type "PathFinder"; expected "Callable[[str, Tuple[str, ...]], ModuleSpec]" [arg-type]