mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 21:14:48 +08:00
Harmonise return type of builtins.__import__ and importlib.import_module (#6302)
builtins.__import__ now returns ModuleType instead of Any. In addition, add __getattr__() to ModuleType to ease using imported modules.
This commit is contained in:
@@ -1443,13 +1443,14 @@ class zip(Iterator[_T_co], Generic[_T_co]):
|
||||
def __iter__(self) -> Iterator[_T_co]: ...
|
||||
def __next__(self) -> _T_co: ...
|
||||
|
||||
# Return type of `__import__` should be kept the same as return type of `importlib.import_module`
|
||||
def __import__(
|
||||
name: str,
|
||||
globals: Mapping[str, object] | None = ...,
|
||||
locals: Mapping[str, object] | None = ...,
|
||||
fromlist: Sequence[str] = ...,
|
||||
level: int = ...,
|
||||
) -> Any: ...
|
||||
) -> types.ModuleType: ...
|
||||
|
||||
# Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
|
||||
# not exposed anywhere under that name, we make it private here.
|
||||
|
||||
Reference in New Issue
Block a user