mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-24 21:01:52 +08:00
Update inspect stubs for Python 3.11 (#7342)
This commit is contained in:
@@ -21,11 +21,117 @@ from types import (
|
||||
)
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
from types import ClassMethodDescriptorType, WrapperDescriptorType, MemberDescriptorType, MethodDescriptorType
|
||||
from types import (
|
||||
ClassMethodDescriptorType,
|
||||
WrapperDescriptorType,
|
||||
MemberDescriptorType,
|
||||
MethodDescriptorType,
|
||||
MethodWrapperType,
|
||||
)
|
||||
|
||||
from typing import Any, ClassVar, Coroutine, NamedTuple, Protocol, TypeVar, Union
|
||||
from typing_extensions import Literal, ParamSpec, TypeGuard
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
__all__ = [
|
||||
"ArgInfo",
|
||||
"Arguments",
|
||||
"Attribute",
|
||||
"BlockFinder",
|
||||
"BoundArguments",
|
||||
"CORO_CLOSED",
|
||||
"CORO_CREATED",
|
||||
"CORO_RUNNING",
|
||||
"CORO_SUSPENDED",
|
||||
"CO_ASYNC_GENERATOR",
|
||||
"CO_COROUTINE",
|
||||
"CO_GENERATOR",
|
||||
"CO_ITERABLE_COROUTINE",
|
||||
"CO_NESTED",
|
||||
"CO_NEWLOCALS",
|
||||
"CO_NOFREE",
|
||||
"CO_OPTIMIZED",
|
||||
"CO_VARARGS",
|
||||
"CO_VARKEYWORDS",
|
||||
"ClassFoundException",
|
||||
"ClosureVars",
|
||||
"EndOfBlock",
|
||||
"FrameInfo",
|
||||
"FullArgSpec",
|
||||
"GEN_CLOSED",
|
||||
"GEN_CREATED",
|
||||
"GEN_RUNNING",
|
||||
"GEN_SUSPENDED",
|
||||
"Parameter",
|
||||
"Signature",
|
||||
"TPFLAGS_IS_ABSTRACT",
|
||||
"Traceback",
|
||||
"classify_class_attrs",
|
||||
"cleandoc",
|
||||
"currentframe",
|
||||
"findsource",
|
||||
"formatannotation",
|
||||
"formatannotationrelativeto",
|
||||
"formatargvalues",
|
||||
"get_annotations",
|
||||
"getabsfile",
|
||||
"getargs",
|
||||
"getargvalues",
|
||||
"getattr_static",
|
||||
"getblock",
|
||||
"getcallargs",
|
||||
"getclasstree",
|
||||
"getclosurevars",
|
||||
"getcomments",
|
||||
"getcoroutinelocals",
|
||||
"getcoroutinestate",
|
||||
"getdoc",
|
||||
"getfile",
|
||||
"getframeinfo",
|
||||
"getfullargspec",
|
||||
"getgeneratorlocals",
|
||||
"getgeneratorstate",
|
||||
"getinnerframes",
|
||||
"getlineno",
|
||||
"getmembers",
|
||||
"getmembers_static",
|
||||
"getmodule",
|
||||
"getmodulename",
|
||||
"getmro",
|
||||
"getouterframes",
|
||||
"getsource",
|
||||
"getsourcefile",
|
||||
"getsourcelines",
|
||||
"indentsize",
|
||||
"isabstract",
|
||||
"isasyncgen",
|
||||
"isasyncgenfunction",
|
||||
"isawaitable",
|
||||
"isbuiltin",
|
||||
"isclass",
|
||||
"iscode",
|
||||
"iscoroutine",
|
||||
"iscoroutinefunction",
|
||||
"isdatadescriptor",
|
||||
"isframe",
|
||||
"isfunction",
|
||||
"isgenerator",
|
||||
"isgeneratorfunction",
|
||||
"isgetsetdescriptor",
|
||||
"ismemberdescriptor",
|
||||
"ismethod",
|
||||
"ismethoddescriptor",
|
||||
"ismethodwrapper",
|
||||
"ismodule",
|
||||
"isroutine",
|
||||
"istraceback",
|
||||
"signature",
|
||||
"stack",
|
||||
"trace",
|
||||
"unwrap",
|
||||
"walktree",
|
||||
]
|
||||
|
||||
_P = ParamSpec("_P")
|
||||
_T_cont = TypeVar("_T_cont", contravariant=True)
|
||||
_V_cont = TypeVar("_V_cont", contravariant=True)
|
||||
@@ -59,7 +165,14 @@ TPFLAGS_IS_ABSTRACT: Literal[1048576]
|
||||
|
||||
modulesbyfile: dict[str, Any]
|
||||
|
||||
def getmembers(object: object, predicate: Callable[[Any], bool] | None = ...) -> list[tuple[str, Any]]: ...
|
||||
_GetMembersPredicate = Callable[[Any], bool]
|
||||
_GetMembersReturn = list[tuple[str, Any]]
|
||||
|
||||
def getmembers(object: object, predicate: _GetMembersPredicate | None = ...) -> _GetMembersReturn: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
def getmembers_static(object: object, predicate: _GetMembersPredicate | None = ...) -> _GetMembersReturn: ...
|
||||
|
||||
def getmodulename(path: str) -> str | None: ...
|
||||
def ismodule(object: object) -> TypeGuard[ModuleType]: ...
|
||||
def isclass(object: object) -> TypeGuard[type[Any]]: ...
|
||||
@@ -96,6 +209,9 @@ def isframe(object: object) -> TypeGuard[FrameType]: ...
|
||||
def iscode(object: object) -> TypeGuard[CodeType]: ...
|
||||
def isbuiltin(object: object) -> TypeGuard[BuiltinFunctionType]: ...
|
||||
|
||||
if sys.version_info >= (3, 11):
|
||||
def ismethodwrapper(object: object) -> TypeGuard[MethodWrapperType]: ...
|
||||
|
||||
if sys.version_info >= (3, 7):
|
||||
def isroutine(
|
||||
object: object,
|
||||
|
||||
Reference in New Issue
Block a user