mirror of
https://github.com/davidhalter/typeshed.git
synced 2026-01-09 04:52:23 +08:00
Resolve builtins/importlib inconsistencies (#6310)
This commit is contained in:
@@ -1,16 +1,18 @@
|
||||
import types
|
||||
from importlib.abc import Loader
|
||||
from typing import Any, Mapping, Sequence
|
||||
from types import ModuleType
|
||||
from typing import Mapping, Sequence
|
||||
|
||||
# `__import__` and `import_module` return type should be kept the same as `builtins.__import__`
|
||||
# Signature of `builtins.__import__` should be kept identical to `importlib.__import__`
|
||||
def __import__(
|
||||
name: str,
|
||||
globals: Mapping[str, Any] | None = ...,
|
||||
locals: Mapping[str, Any] | None = ...,
|
||||
globals: Mapping[str, object] | None = ...,
|
||||
locals: Mapping[str, object] | None = ...,
|
||||
fromlist: Sequence[str] = ...,
|
||||
level: int = ...,
|
||||
) -> types.ModuleType: ...
|
||||
def import_module(name: str, package: str | None = ...) -> types.ModuleType: ...
|
||||
) -> ModuleType: ...
|
||||
|
||||
# `importlib.import_module` return type should be kept the same as `builtins.__import__`
|
||||
def import_module(name: str, package: str | None = ...) -> ModuleType: ...
|
||||
def find_loader(name: str, path: str | None = ...) -> Loader | None: ...
|
||||
def invalidate_caches() -> None: ...
|
||||
def reload(module: types.ModuleType) -> types.ModuleType: ...
|
||||
def reload(module: ModuleType) -> ModuleType: ...
|
||||
|
||||
Reference in New Issue
Block a user