Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion stdlib/builtins.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -1487,7 +1487,7 @@ def __import__(
locals: Mapping[str, object] | None = ...,
fromlist: Sequence[str] = ...,
level: int = ...,
) -> types.ModuleType: ...
) -> Any: ...

# Actually the type of Ellipsis is <type 'ellipsis'>, but since it's
# not exposed anywhere under that name, we make it private here.
Expand Down
6 changes: 3 additions & 3 deletions stdlib/importlib/__init__.pyi
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from importlib.abc import Loader
from types import ModuleType
from typing import Mapping, Sequence
from typing import Any, Mapping, Sequence

# Signature of `builtins.__import__` should be kept identical to `importlib.__import__`
def __import__(
Expand All @@ -9,10 +9,10 @@ def __import__(
locals: Mapping[str, object] | None = ...,
fromlist: Sequence[str] = ...,
level: int = ...,
) -> ModuleType: ...
) -> Any: ...

# `importlib.import_module` return type should be kept the same as `builtins.__import__`
def import_module(name: str, package: str | None = ...) -> ModuleType: ...
def import_module(name: str, package: str | None = ...) -> Any: ...
def find_loader(name: str, path: str | None = ...) -> Loader | None: ...
def invalidate_caches() -> None: ...
def reload(module: ModuleType) -> ModuleType: ...
4 changes: 0 additions & 4 deletions stdlib/types.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -180,10 +180,6 @@ class ModuleType:
__path__: MutableSequence[str]
__spec__: ModuleSpec | None
def __init__(self, name: str, doc: str | None = ...) -> None: ...
# __getattr__ doesn't exist at runtime,
# but having it here in typeshed makes dynamic imports
# using `builtins.__import__` or `importlib.import_module` less painful
def __getattr__(self, name: str) -> Any: ...

@final
class GeneratorType(Generator[_T_co, _T_contra, _V_co]):
Expand Down
1 change: 0 additions & 1 deletion tests/stubtest_allowlists/py3_common.txt
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,6 @@ tkinter.font.Font.__getitem__ # Argument name differs (doesn't matter for __dun
traceback.TracebackException.from_exception # explicitly expanding arguments going into TracebackException __init__
types.GetSetDescriptorType.__get__ # this function can accept no value for the type parameter.
types.MemberDescriptorType.__get__ # this function can accept no value for the type parameter.
types.ModuleType.__getattr__ # this doesn't exist at runtime
types.SimpleNamespace.__init__ # class doesn't accept positional arguments but has default C signature
typing.IO.__iter__ # Added because IO streams are iterable. See https://github.com/python/typeshed/commit/97bc450acd60c1bcdafef3ce8fbe3b95a9c0cac3
typing.IO.__next__ # Added because IO streams are iterable. See https://github.com/python/typeshed/commit/97bc450acd60c1bcdafef3ce8fbe3b95a9c0cac3
Expand Down