|
1 |
| -import types |
2 | 1 | from importlib.abc import Loader
|
3 |
| -from typing import Any, Mapping, Sequence |
| 2 | +from types import ModuleType |
| 3 | +from typing import Mapping, Sequence |
4 | 4 |
|
5 |
| -# `__import__` and `import_module` return type should be kept the same as `builtins.__import__` |
| 5 | +# Signature of `builtins.__import__` should be kept identical to `importlib.__import__` |
6 | 6 | def __import__(
|
7 | 7 | name: str,
|
8 |
| - globals: Mapping[str, Any] | None = ..., |
9 |
| - locals: Mapping[str, Any] | None = ..., |
| 8 | + globals: Mapping[str, object] | None = ..., |
| 9 | + locals: Mapping[str, object] | None = ..., |
10 | 10 | fromlist: Sequence[str] = ...,
|
11 | 11 | level: int = ...,
|
12 |
| -) -> types.ModuleType: ... |
13 |
| -def import_module(name: str, package: str | None = ...) -> types.ModuleType: ... |
| 12 | +) -> ModuleType: ... |
| 13 | + |
| 14 | +# `importlib.import_module` return type should be kept the same as `builtins.__import__` |
| 15 | +def import_module(name: str, package: str | None = ...) -> ModuleType: ... |
14 | 16 | def find_loader(name: str, path: str | None = ...) -> Loader | None: ...
|
15 | 17 | def invalidate_caches() -> None: ...
|
16 |
| -def reload(module: types.ModuleType) -> types.ModuleType: ... |
| 18 | +def reload(module: ModuleType) -> ModuleType: ... |
0 commit comments