Update inspect for Python3.12 (#10398)

This commit is contained in:
Nikita Sobolev
2023-07-03 15:54:19 +03:00
committed by GitHub
parent 18d45d62aa
commit 31dca1d660
2 changed files with 27 additions and 8 deletions

View File

@@ -128,8 +128,21 @@ if sys.version_info >= (3, 11):
"walktree",
]
if sys.version_info >= (3, 12):
__all__ += [
"markcoroutinefunction",
"AGEN_CLOSED",
"AGEN_CREATED",
"AGEN_RUNNING",
"AGEN_SUSPENDED",
"getasyncgenlocals",
"getasyncgenstate",
"BufferFlags",
]
_P = ParamSpec("_P")
_T = TypeVar("_T")
_F = TypeVar("_F", bound=Callable[..., Any])
_T_cont = TypeVar("_T_cont", contravariant=True)
_V_cont = TypeVar("_V_cont", contravariant=True)
@@ -184,6 +197,9 @@ def isclass(object: object) -> TypeGuard[type[Any]]: ...
def ismethod(object: object) -> TypeGuard[MethodType]: ...
def isfunction(object: object) -> TypeGuard[FunctionType]: ...
if sys.version_info >= (3, 12):
def markcoroutinefunction(func: _F) -> _F: ...
if sys.version_info >= (3, 8):
@overload
def isgeneratorfunction(obj: Callable[..., Generator[Any, Any, Any]]) -> bool: ...
@@ -360,6 +376,17 @@ class _ParameterKind(enum.IntEnum):
@property
def description(self) -> str: ...
if sys.version_info >= (3, 12):
AGEN_CREATED: Literal["AGEN_CREATED"]
AGEN_RUNNING: Literal["AGEN_RUNNING"]
AGEN_SUSPENDED: Literal["AGEN_SUSPENDED"]
AGEN_CLOSED: Literal["AGEN_CLOSED"]
def getasyncgenstate(
agen: AsyncGenerator[Any, Any]
) -> Literal["AGEN_CREATED", "AGEN_RUNNING", "AGEN_SUSPENDED", "AGEN_CLOSED"]: ...
def getasyncgenlocals(agen: AsyncGeneratorType[Any, Any]) -> dict[str, Any]: ...
class Parameter:
def __init__(self, name: str, kind: _ParameterKind, *, default: Any = ..., annotation: Any = ...) -> None: ...
empty = _empty

View File

@@ -53,14 +53,6 @@ importlib.resources.files
importlib.util.module_for_loader
importlib.util.set_loader
importlib.util.set_package
inspect.AGEN_CLOSED
inspect.AGEN_CREATED
inspect.AGEN_RUNNING
inspect.AGEN_SUSPENDED
inspect.__all__
inspect.getasyncgenlocals
inspect.getasyncgenstate
inspect.markcoroutinefunction
logging.Logger.getChildren
logging.__all__
logging.getHandlerByName