mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-10 05:51:52 +08:00
Use PEP 570 syntax in stdlib (#11250)
This commit is contained in:
@@ -17,9 +17,7 @@ _OptExcInfo: TypeAlias = OptExcInfo # noqa: Y047 # TODO: obsolete, remove fall
|
||||
|
||||
# Intentionally omits one deprecated and one optional method of `importlib.abc.MetaPathFinder`
|
||||
class _MetaPathFinder(Protocol):
|
||||
def find_spec(
|
||||
self, __fullname: str, __path: Sequence[str] | None, __target: ModuleType | None = ...
|
||||
) -> ModuleSpec | None: ...
|
||||
def find_spec(self, fullname: str, path: Sequence[str] | None, target: ModuleType | None = ..., /) -> ModuleSpec | None: ...
|
||||
|
||||
# ----- sys variables -----
|
||||
if sys.platform != "win32":
|
||||
@@ -245,19 +243,19 @@ class _version_info(_UninstantiableStructseq, tuple[int, int, int, _ReleaseLevel
|
||||
|
||||
version_info: _version_info
|
||||
|
||||
def call_tracing(__func: Callable[..., _T], __args: Any) -> _T: ...
|
||||
def call_tracing(func: Callable[..., _T], args: Any, /) -> _T: ...
|
||||
def _clear_type_cache() -> None: ...
|
||||
def _current_frames() -> dict[int, FrameType]: ...
|
||||
def _getframe(__depth: int = 0) -> FrameType: ...
|
||||
def _getframe(depth: int = 0, /) -> FrameType: ...
|
||||
def _debugmallocstats() -> None: ...
|
||||
def __displayhook__(__object: object) -> None: ...
|
||||
def __excepthook__(__exctype: type[BaseException], __value: BaseException, __traceback: TracebackType | None) -> None: ...
|
||||
def __displayhook__(object: object, /) -> None: ...
|
||||
def __excepthook__(exctype: type[BaseException], value: BaseException, traceback: TracebackType | None, /) -> None: ...
|
||||
def exc_info() -> OptExcInfo: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
def exception() -> BaseException | None: ...
|
||||
|
||||
def exit(__status: _ExitCode = None) -> NoReturn: ...
|
||||
def exit(status: _ExitCode = None, /) -> NoReturn: ...
|
||||
def getallocatedblocks() -> int: ...
|
||||
def getdefaultencoding() -> str: ...
|
||||
|
||||
@@ -266,7 +264,7 @@ if sys.platform != "win32":
|
||||
|
||||
def getfilesystemencoding() -> str: ...
|
||||
def getfilesystemencodeerrors() -> str: ...
|
||||
def getrefcount(__object: Any) -> int: ...
|
||||
def getrefcount(object: Any, /) -> int: ...
|
||||
def getrecursionlimit() -> int: ...
|
||||
def getsizeof(obj: object, default: int = ...) -> int: ...
|
||||
def getswitchinterval() -> float: ...
|
||||
@@ -302,22 +300,22 @@ if sys.platform == "win32":
|
||||
|
||||
def getwindowsversion() -> _WinVersion: ...
|
||||
|
||||
def intern(__string: str) -> str: ...
|
||||
def intern(string: str, /) -> str: ...
|
||||
def is_finalizing() -> bool: ...
|
||||
def breakpointhook(*args: Any, **kwargs: Any) -> Any: ...
|
||||
|
||||
__breakpointhook__ = breakpointhook # Contains the original value of breakpointhook
|
||||
|
||||
if sys.platform != "win32":
|
||||
def setdlopenflags(__flags: int) -> None: ...
|
||||
def setdlopenflags(flags: int, /) -> None: ...
|
||||
|
||||
def setrecursionlimit(__limit: int) -> None: ...
|
||||
def setswitchinterval(__interval: float) -> None: ...
|
||||
def setrecursionlimit(limit: int, /) -> None: ...
|
||||
def setswitchinterval(interval: float, /) -> None: ...
|
||||
def gettotalrefcount() -> int: ... # Debug builds only
|
||||
|
||||
if sys.version_info < (3, 9):
|
||||
def getcheckinterval() -> int: ... # deprecated
|
||||
def setcheckinterval(__n: int) -> None: ... # deprecated
|
||||
def setcheckinterval(n: int, /) -> None: ... # deprecated
|
||||
|
||||
if sys.version_info < (3, 9):
|
||||
# An 11-tuple or None
|
||||
@@ -333,9 +331,9 @@ class UnraisableHookArgs(Protocol):
|
||||
|
||||
unraisablehook: Callable[[UnraisableHookArgs], Any]
|
||||
|
||||
def __unraisablehook__(__unraisable: UnraisableHookArgs) -> Any: ...
|
||||
def __unraisablehook__(unraisable: UnraisableHookArgs, /) -> Any: ...
|
||||
def addaudithook(hook: Callable[[str, tuple[Any, ...]], Any]) -> None: ...
|
||||
def audit(__event: str, *args: Any) -> None: ...
|
||||
def audit(event: str, /, *args: Any) -> None: ...
|
||||
|
||||
_AsyncgenHook: TypeAlias = Callable[[AsyncGenerator[Any, Any]], None] | None
|
||||
|
||||
@@ -366,9 +364,9 @@ if sys.version_info >= (3, 12):
|
||||
def is_stack_trampoline_active() -> bool: ...
|
||||
# It always exists, but raises on non-linux platforms:
|
||||
if sys.platform == "linux":
|
||||
def activate_stack_trampoline(__backend: str) -> None: ...
|
||||
def activate_stack_trampoline(backend: str, /) -> None: ...
|
||||
else:
|
||||
def activate_stack_trampoline(__backend: str) -> NoReturn: ...
|
||||
def activate_stack_trampoline(backend: str, /) -> NoReturn: ...
|
||||
|
||||
from . import _monitoring
|
||||
|
||||
|
||||
@@ -14,9 +14,9 @@ COVERAGE_ID: int
|
||||
PROFILER_ID: int
|
||||
OPTIMIZER_ID: int
|
||||
|
||||
def use_tool_id(__tool_id: int, __name: str) -> None: ...
|
||||
def free_tool_id(__tool_id: int) -> None: ...
|
||||
def get_tool(__tool_id: int) -> str | None: ...
|
||||
def use_tool_id(tool_id: int, name: str, /) -> None: ...
|
||||
def free_tool_id(tool_id: int, /) -> None: ...
|
||||
def get_tool(tool_id: int, /) -> str | None: ...
|
||||
|
||||
events: _events
|
||||
|
||||
@@ -40,13 +40,13 @@ class _events:
|
||||
RERAISE: int
|
||||
STOP_ITERATION: int
|
||||
|
||||
def get_events(__tool_id: int) -> int: ...
|
||||
def set_events(__tool_id: int, __event_set: int) -> None: ...
|
||||
def get_local_events(__tool_id: int, __code: CodeType) -> int: ...
|
||||
def set_local_events(__tool_id: int, __code: CodeType, __event_set: int) -> int: ...
|
||||
def get_events(tool_id: int, /) -> int: ...
|
||||
def set_events(tool_id: int, event_set: int, /) -> None: ...
|
||||
def get_local_events(tool_id: int, code: CodeType, /) -> int: ...
|
||||
def set_local_events(tool_id: int, code: CodeType, event_set: int, /) -> int: ...
|
||||
def restart_events() -> None: ...
|
||||
|
||||
DISABLE: object
|
||||
MISSING: object
|
||||
|
||||
def register_callback(__tool_id: int, __event: int, __func: Callable[..., Any] | None) -> Callable[..., Any] | None: ...
|
||||
def register_callback(tool_id: int, event: int, func: Callable[..., Any] | None, /) -> Callable[..., Any] | None: ...
|
||||
|
||||
Reference in New Issue
Block a user