Add some missing items to sys.pyi and types.pyi (#7447)

This commit is contained in:
Jelle Zijlstra
2022-03-06 23:22:08 -08:00
committed by GitHub
parent 947724a5cb
commit 675de720d6
7 changed files with 31 additions and 14 deletions

View File

@@ -5,7 +5,20 @@ from importlib.abc import PathEntryFinder
from importlib.machinery import ModuleSpec
from io import TextIOWrapper
from types import FrameType, ModuleType, TracebackType
from typing import Any, AsyncGenerator, Callable, NoReturn, Optional, Protocol, Sequence, TextIO, TypeVar, Union, overload
from typing import (
Any,
AsyncGenerator,
Callable,
Coroutine,
NoReturn,
Optional,
Protocol,
Sequence,
TextIO,
TypeVar,
Union,
overload,
)
from typing_extensions import Literal, final
_T = TypeVar("_T")
@@ -292,6 +305,10 @@ if sys.version_info < (3, 9):
def getcheckinterval() -> int: ... # deprecated
def setcheckinterval(__n: int) -> None: ... # deprecated
if sys.version_info < (3, 9):
# An 11-tuple or None
def callstats() -> tuple[int, int, int, int, int, int, int, int, int, int, int] | None: ...
if sys.version_info >= (3, 8):
# Doesn't exist at runtime, but exported in the stubs so pytest etc. can annotate their code more easily.
class UnraisableHookArgs:
@@ -324,3 +341,8 @@ if sys.version_info >= (3, 6):
if sys.version_info >= (3, 7):
def get_coroutine_origin_tracking_depth() -> int: ...
def set_coroutine_origin_tracking_depth(depth: int) -> None: ...
if sys.version_info < (3, 8):
_CoroWrapper = Callable[[Coroutine[Any, Any, Any]], Any]
def set_coroutine_wrapper(__wrapper: _CoroWrapper) -> None: ...
def get_coroutine_wrapper() -> _CoroWrapper: ...

View File

@@ -437,6 +437,10 @@ class CoroutineType(Coroutine[_T_co, _T_contra, _V_co]):
def cr_frame(self) -> FrameType: ...
@property
def cr_running(self) -> bool: ...
if sys.version_info >= (3, 7):
@property
def cr_origin(self) -> tuple[tuple[str, int, str], ...] | None: ...
def close(self) -> None: ...
def __await__(self) -> Generator[Any, None, _V_co]: ...
def send(self, __arg: _T_contra) -> _T_co: ...