| 1 |
import dis |
| 2 |
import enum |
| 3 |
import sys |
| 4 |
import types |
| 5 |
from _typeshed import AnnotationForm, StrPath |
| 6 |
from collections import OrderedDict |
| 7 |
from collections.abc import AsyncGenerator, Awaitable, Callable, Coroutine, Generator, Mapping, Sequence, Set as AbstractSet |
| 8 |
from types import ( |
| 9 |
AsyncGeneratorType, |
| 10 |
BuiltinFunctionType, |
| 11 |
BuiltinMethodType, |
| 12 |
ClassMethodDescriptorType, |
| 13 |
CodeType, |
| 14 |
CoroutineType, |
| 15 |
FrameType, |
| 16 |
FunctionType, |
| 17 |
GeneratorType, |
| 18 |
GetSetDescriptorType, |
| 19 |
LambdaType, |
| 20 |
MemberDescriptorType, |
| 21 |
MethodDescriptorType, |
| 22 |
MethodType, |
| 23 |
MethodWrapperType, |
| 24 |
ModuleType, |
| 25 |
TracebackType, |
| 26 |
WrapperDescriptorType, |
| 27 |
) |
| 28 |
from typing import Any, ClassVar, Final, Literal, NamedTuple, Protocol, TypeVar, overload, type_check_only |
| 29 |
from typing_extensions import ParamSpec, Self, TypeAlias, TypeGuard, TypeIs, deprecated, disjoint_base |
| 30 |
|
| 31 |
if sys.version_info >= (3, 14): |
| 32 |
from annotationlib import Format |
| 33 |
|
| 34 |
if sys.version_info >= (3, 11): |
| 35 |
__all__ = [ |
| 36 |
"ArgInfo", |
| 37 |
"Arguments", |
| 38 |
"Attribute", |
| 39 |
"BlockFinder", |
| 40 |
"BoundArguments", |
| 41 |
"CORO_CLOSED", |
| 42 |
"CORO_CREATED", |
| 43 |
"CORO_RUNNING", |
| 44 |
"CORO_SUSPENDED", |
| 45 |
"CO_ASYNC_GENERATOR", |
| 46 |
"CO_COROUTINE", |
| 47 |
"CO_GENERATOR", |
| 48 |
"CO_ITERABLE_COROUTINE", |
| 49 |
"CO_NESTED", |
| 50 |
"CO_NEWLOCALS", |
| 51 |
"CO_NOFREE", |
| 52 |
"CO_OPTIMIZED", |
| 53 |
"CO_VARARGS", |
| 54 |
"CO_VARKEYWORDS", |
| 55 |
"ClassFoundException", |
| 56 |
"ClosureVars", |
| 57 |
"EndOfBlock", |
| 58 |
"FrameInfo", |
| 59 |
"FullArgSpec", |
| 60 |
"GEN_CLOSED", |
| 61 |
"GEN_CREATED", |
| 62 |
"GEN_RUNNING", |
| 63 |
"GEN_SUSPENDED", |
| 64 |
"Parameter", |
| 65 |
"Signature", |
| 66 |
"TPFLAGS_IS_ABSTRACT", |
| 67 |
"Traceback", |
| 68 |
"classify_class_attrs", |
| 69 |
"cleandoc", |
| 70 |
"currentframe", |
| 71 |
"findsource", |
| 72 |
"formatannotation", |
| 73 |
"formatannotationrelativeto", |
| 74 |
"formatargvalues", |
| 75 |
"get_annotations", |
| 76 |
"getabsfile", |
| 77 |
"getargs", |
| 78 |
"getargvalues", |
| 79 |
"getattr_static", |
| 80 |
"getblock", |
| 81 |
"getcallargs", |
| 82 |
"getclasstree", |
| 83 |
"getclosurevars", |
| 84 |
"getcomments", |
| 85 |
"getcoroutinelocals", |
| 86 |
"getcoroutinestate", |
| 87 |
"getdoc", |
| 88 |
"getfile", |
| 89 |
"getframeinfo", |
| 90 |
"getfullargspec", |
| 91 |
"getgeneratorlocals", |
| 92 |
"getgeneratorstate", |
| 93 |
"getinnerframes", |
| 94 |
"getlineno", |
| 95 |
"getmembers", |
| 96 |
"getmembers_static", |
| 97 |
"getmodule", |
| 98 |
"getmodulename", |
| 99 |
"getmro", |
| 100 |
"getouterframes", |
| 101 |
"getsource", |
| 102 |
"getsourcefile", |
| 103 |
"getsourcelines", |
| 104 |
"indentsize", |
| 105 |
"isabstract", |
| 106 |
"isasyncgen", |
| 107 |
"isasyncgenfunction", |
| 108 |
"isawaitable", |
| 109 |
"isbuiltin", |
| 110 |
"isclass", |
| 111 |
"iscode", |
| 112 |
"iscoroutine", |
| 113 |
"iscoroutinefunction", |
| 114 |
"isdatadescriptor", |
| 115 |
"isframe", |
| 116 |
"isfunction", |
| 117 |
"isgenerator", |
| 118 |
"isgeneratorfunction", |
| 119 |
"isgetsetdescriptor", |
| 120 |
"ismemberdescriptor", |
| 121 |
"ismethod", |
| 122 |
"ismethoddescriptor", |
| 123 |
"ismethodwrapper", |
| 124 |
"ismodule", |
| 125 |
"isroutine", |
| 126 |
"istraceback", |
| 127 |
"signature", |
| 128 |
"stack", |
| 129 |
"trace", |
| 130 |
"unwrap", |
| 131 |
"walktree", |
| 132 |
] |
| 133 |
|
| 134 |
if sys.version_info >= (3, 12): |
| 135 |
__all__ += [ |
| 136 |
"markcoroutinefunction", |
| 137 |
"AGEN_CLOSED", |
| 138 |
"AGEN_CREATED", |
| 139 |
"AGEN_RUNNING", |
| 140 |
"AGEN_SUSPENDED", |
| 141 |
"getasyncgenlocals", |
| 142 |
"getasyncgenstate", |
| 143 |
"BufferFlags", |
| 144 |
] |
| 145 |
if sys.version_info >= (3, 14): |
| 146 |
__all__ += ["CO_HAS_DOCSTRING", "CO_METHOD", "ispackage"] |
| 147 |
|
| 148 |
_P = ParamSpec("_P") |
| 149 |
_T = TypeVar("_T") |
| 150 |
_F = TypeVar("_F", bound=Callable[..., Any]) |
| 151 |
_T_contra = TypeVar("_T_contra", contravariant=True) |
| 152 |
_V_contra = TypeVar("_V_contra", contravariant=True) |
| 153 |
|
| 154 |
|
| 155 |
|
| 156 |
|
| 157 |
class EndOfBlock(Exception): ... |
| 158 |
|
| 159 |
class BlockFinder: |
| 160 |
indent: int |
| 161 |
islambda: bool |
| 162 |
started: bool |
| 163 |
passline: bool |
| 164 |
indecorator: bool |
| 165 |
decoratorhasargs: bool |
| 166 |
last: int |
| 167 |
def tokeneater(self, type: int, token: str, srowcol: tuple[int, int], erowcol: tuple[int, int], line: str) -> None: ... |
| 168 |
|
| 169 |
CO_OPTIMIZED: Final = 1 |
| 170 |
CO_NEWLOCALS: Final = 2 |
| 171 |
CO_VARARGS: Final = 4 |
| 172 |
CO_VARKEYWORDS: Final = 8 |
| 173 |
CO_NESTED: Final = 16 |
| 174 |
CO_GENERATOR: Final = 32 |
| 175 |
CO_NOFREE: Final = 64 |
| 176 |
CO_COROUTINE: Final = 128 |
| 177 |
CO_ITERABLE_COROUTINE: Final = 256 |
| 178 |
CO_ASYNC_GENERATOR: Final = 512 |
| 179 |
TPFLAGS_IS_ABSTRACT: Final = 1048576 |
| 180 |
if sys.version_info >= (3, 14): |
| 181 |
CO_HAS_DOCSTRING: Final = 67108864 |
| 182 |
CO_METHOD: Final = 134217728 |
| 183 |
|
| 184 |
modulesbyfile: dict[str, Any] |
| 185 |
|
| 186 |
_GetMembersPredicateTypeGuard: TypeAlias = Callable[[Any], TypeGuard[_T]] |
| 187 |
_GetMembersPredicateTypeIs: TypeAlias = Callable[[Any], TypeIs[_T]] |
| 188 |
_GetMembersPredicate: TypeAlias = Callable[[Any], bool] |
| 189 |
_GetMembersReturn: TypeAlias = list[tuple[str, _T]] |
| 190 |
|
| 191 |
@overload |
| 192 |
def getmembers(object: object, predicate: _GetMembersPredicateTypeGuard[_T]) -> _GetMembersReturn[_T]: ... |
| 193 |
@overload |
| 194 |
def getmembers(object: object, predicate: _GetMembersPredicateTypeIs[_T]) -> _GetMembersReturn[_T]: ... |
| 195 |
@overload |
| 196 |
def getmembers(object: object, predicate: _GetMembersPredicate | None = None) -> _GetMembersReturn[Any]: ... |
| 197 |
|
| 198 |
if sys.version_info >= (3, 11): |
| 199 |
@overload |
| 200 |
def getmembers_static(object: object, predicate: _GetMembersPredicateTypeGuard[_T]) -> _GetMembersReturn[_T]: ... |
| 201 |
@overload |
| 202 |
def getmembers_static(object: object, predicate: _GetMembersPredicateTypeIs[_T]) -> _GetMembersReturn[_T]: ... |
| 203 |
@overload |
| 204 |
def getmembers_static(object: object, predicate: _GetMembersPredicate | None = None) -> _GetMembersReturn[Any]: ... |
| 205 |
|
| 206 |
def getmodulename(path: StrPath) -> str | None: ... |
| 207 |
def ismodule(object: object) -> TypeIs[ModuleType]: ... |
| 208 |
def isclass(object: object) -> TypeIs[type[Any]]: ... |
| 209 |
def ismethod(object: object) -> TypeIs[MethodType]: ... |
| 210 |
|
| 211 |
if sys.version_info >= (3, 14): |
| 212 |
|
| 213 |
def ispackage(object: object) -> TypeGuard[ModuleType]: ... |
| 214 |
|
| 215 |
def isfunction(object: object) -> TypeIs[FunctionType]: ... |
| 216 |
|
| 217 |
if sys.version_info >= (3, 12): |
| 218 |
def markcoroutinefunction(func: _F) -> _F: ... |
| 219 |
|
| 220 |
@overload |
| 221 |
def isgeneratorfunction(obj: Callable[..., Generator[Any, Any, Any]]) -> bool: ... |
| 222 |
@overload |
| 223 |
def isgeneratorfunction(obj: Callable[_P, Any]) -> TypeGuard[Callable[_P, GeneratorType[Any, Any, Any]]]: ... |
| 224 |
@overload |
| 225 |
def isgeneratorfunction(obj: object) -> TypeGuard[Callable[..., GeneratorType[Any, Any, Any]]]: ... |
| 226 |
@overload |
| 227 |
def iscoroutinefunction(obj: Callable[..., Coroutine[Any, Any, Any]]) -> bool: ... |
| 228 |
@overload |
| 229 |
def iscoroutinefunction(obj: Callable[_P, Awaitable[_T]]) -> TypeGuard[Callable[_P, CoroutineType[Any, Any, _T]]]: ... |
| 230 |
@overload |
| 231 |
def iscoroutinefunction(obj: Callable[_P, object]) -> TypeGuard[Callable[_P, CoroutineType[Any, Any, Any]]]: ... |
| 232 |
@overload |
| 233 |
def iscoroutinefunction(obj: object) -> TypeGuard[Callable[..., CoroutineType[Any, Any, Any]]]: ... |
| 234 |
def isgenerator(object: object) -> TypeIs[GeneratorType[Any, Any, Any]]: ... |
| 235 |
def iscoroutine(object: object) -> TypeIs[CoroutineType[Any, Any, Any]]: ... |
| 236 |
def isawaitable(object: object) -> TypeIs[Awaitable[Any]]: ... |
| 237 |
@overload |
| 238 |
def isasyncgenfunction(obj: Callable[..., AsyncGenerator[Any, Any]]) -> bool: ... |
| 239 |
@overload |
| 240 |
def isasyncgenfunction(obj: Callable[_P, Any]) -> TypeGuard[Callable[_P, AsyncGeneratorType[Any, Any]]]: ... |
| 241 |
@overload |
| 242 |
def isasyncgenfunction(obj: object) -> TypeGuard[Callable[..., AsyncGeneratorType[Any, Any]]]: ... |
| 243 |
@type_check_only |
| 244 |
class _SupportsSet(Protocol[_T_contra, _V_contra]): |
| 245 |
def __set__(self, instance: _T_contra, value: _V_contra, /) -> None: ... |
| 246 |
|
| 247 |
@type_check_only |
| 248 |
class _SupportsDelete(Protocol[_T_contra]): |
| 249 |
def __delete__(self, instance: _T_contra, /) -> None: ... |
| 250 |
|
| 251 |
def isasyncgen(object: object) -> TypeIs[AsyncGeneratorType[Any, Any]]: ... |
| 252 |
def istraceback(object: object) -> TypeIs[TracebackType]: ... |
| 253 |
def isframe(object: object) -> TypeIs[FrameType]: ... |
| 254 |
def iscode(object: object) -> TypeIs[CodeType]: ... |
| 255 |
def isbuiltin(object: object) -> TypeIs[BuiltinFunctionType]: ... |
| 256 |
|
| 257 |
if sys.version_info >= (3, 11): |
| 258 |
def ismethodwrapper(object: object) -> TypeIs[MethodWrapperType]: ... |
| 259 |
|
| 260 |
def isroutine( |
| 261 |
object: object, |
| 262 |
) -> TypeIs[ |
| 263 |
FunctionType |
| 264 |
| LambdaType |
| 265 |
| MethodType |
| 266 |
| BuiltinFunctionType |
| 267 |
| BuiltinMethodType |
| 268 |
| WrapperDescriptorType |
| 269 |
| MethodDescriptorType |
| 270 |
| ClassMethodDescriptorType |
| 271 |
]: ... |
| 272 |
def ismethoddescriptor(object: object) -> TypeIs[MethodDescriptorType]: ... |
| 273 |
def ismemberdescriptor(object: object) -> TypeIs[MemberDescriptorType]: ... |
| 274 |
def isabstract(object: object) -> bool: ... |
| 275 |
def isgetsetdescriptor(object: object) -> TypeIs[GetSetDescriptorType]: ... |
| 276 |
def isdatadescriptor(object: object) -> TypeIs[_SupportsSet[Any, Any] | _SupportsDelete[Any]]: ... |
| 277 |
|
| 278 |
|
| 279 |
|
| 280 |
|
| 281 |
_SourceObjectType: TypeAlias = ( |
| 282 |
ModuleType | type[Any] | MethodType | FunctionType | TracebackType | FrameType | CodeType | Callable[..., Any] |
| 283 |
) |
| 284 |
|
| 285 |
def findsource(object: _SourceObjectType) -> tuple[list[str], int]: ... |
| 286 |
def getabsfile(object: _SourceObjectType, _filename: str | None = None) -> str: ... |
| 287 |
|
| 288 |
|
| 289 |
|
| 290 |
@overload |
| 291 |
def getblock(lines: list[str]) -> list[str]: ... |
| 292 |
@overload |
| 293 |
def getblock(lines: tuple[str, ...]) -> tuple[str, ...]: ... |
| 294 |
@overload |
| 295 |
def getblock(lines: Sequence[str]) -> Sequence[str]: ... |
| 296 |
def getdoc(object: object) -> str | None: ... |
| 297 |
def getcomments(object: object) -> str | None: ... |
| 298 |
def getfile(object: _SourceObjectType) -> str: ... |
| 299 |
def getmodule(object: object, _filename: str | None = None) -> ModuleType | None: ... |
| 300 |
def getsourcefile(object: _SourceObjectType) -> str | None: ... |
| 301 |
def getsourcelines(object: _SourceObjectType) -> tuple[list[str], int]: ... |
| 302 |
def getsource(object: _SourceObjectType) -> str: ... |
| 303 |
def cleandoc(doc: str) -> str: ... |
| 304 |
def indentsize(line: str) -> int: ... |
| 305 |
|
| 306 |
_IntrospectableCallable: TypeAlias = Callable[..., Any] |
| 307 |
|
| 308 |
|
| 309 |
|
| 310 |
|
| 311 |
if sys.version_info >= (3, 14): |
| 312 |
def signature( |
| 313 |
obj: _IntrospectableCallable, |
| 314 |
*, |
| 315 |
follow_wrapped: bool = True, |
| 316 |
globals: Mapping[str, Any] | None = None, |
| 317 |
locals: Mapping[str, Any] | None = None, |
| 318 |
eval_str: bool = False, |
| 319 |
annotation_format: Format = Format.VALUE, |
| 320 |
) -> Signature: ... |
| 321 |
|
| 322 |
elif sys.version_info >= (3, 10): |
| 323 |
def signature( |
| 324 |
obj: _IntrospectableCallable, |
| 325 |
*, |
| 326 |
follow_wrapped: bool = True, |
| 327 |
globals: Mapping[str, Any] | None = None, |
| 328 |
locals: Mapping[str, Any] | None = None, |
| 329 |
eval_str: bool = False, |
| 330 |
) -> Signature: ... |
| 331 |
|
| 332 |
else: |
| 333 |
def signature(obj: _IntrospectableCallable, *, follow_wrapped: bool = True) -> Signature: ... |
| 334 |
|
| 335 |
class _void: ... |
| 336 |
class _empty: ... |
| 337 |
|
| 338 |
class Signature: |
| 339 |
__slots__ = ("_return_annotation", "_parameters") |
| 340 |
def __init__( |
| 341 |
self, parameters: Sequence[Parameter] | None = None, *, return_annotation: Any = ..., __validate_parameters__: bool = True |
| 342 |
) -> None: ... |
| 343 |
empty = _empty |
| 344 |
@property |
| 345 |
def parameters(self) -> types.MappingProxyType[str, Parameter]: ... |
| 346 |
@property |
| 347 |
def return_annotation(self) -> Any: ... |
| 348 |
def bind(self, *args: Any, **kwargs: Any) -> BoundArguments: ... |
| 349 |
def bind_partial(self, *args: Any, **kwargs: Any) -> BoundArguments: ... |
| 350 |
def replace(self, *, parameters: Sequence[Parameter] | type[_void] | None = ..., return_annotation: Any = ...) -> Self: ... |
| 351 |
__replace__ = replace |
| 352 |
if sys.version_info >= (3, 14): |
| 353 |
@classmethod |
| 354 |
def from_callable( |
| 355 |
cls, |
| 356 |
obj: _IntrospectableCallable, |
| 357 |
*, |
| 358 |
follow_wrapped: bool = True, |
| 359 |
globals: Mapping[str, Any] | None = None, |
| 360 |
locals: Mapping[str, Any] | None = None, |
| 361 |
eval_str: bool = False, |
| 362 |
annotation_format: Format = Format.VALUE, |
| 363 |
) -> Self: ... |
| 364 |
elif sys.version_info >= (3, 10): |
| 365 |
@classmethod |
| 366 |
def from_callable( |
| 367 |
cls, |
| 368 |
obj: _IntrospectableCallable, |
| 369 |
*, |
| 370 |
follow_wrapped: bool = True, |
| 371 |
globals: Mapping[str, Any] | None = None, |
| 372 |
locals: Mapping[str, Any] | None = None, |
| 373 |
eval_str: bool = False, |
| 374 |
) -> Self: ... |
| 375 |
else: |
| 376 |
@classmethod |
| 377 |
def from_callable(cls, obj: _IntrospectableCallable, *, follow_wrapped: bool = True) -> Self: ... |
| 378 |
if sys.version_info >= (3, 14): |
| 379 |
def format(self, *, max_width: int | None = None, quote_annotation_strings: bool = True) -> str: ... |
| 380 |
elif sys.version_info >= (3, 13): |
| 381 |
def format(self, *, max_width: int | None = None) -> str: ... |
| 382 |
|
| 383 |
def __eq__(self, other: object) -> bool: ... |
| 384 |
def __hash__(self) -> int: ... |
| 385 |
|
| 386 |
if sys.version_info >= (3, 14): |
| 387 |
from annotationlib import get_annotations as get_annotations |
| 388 |
elif sys.version_info >= (3, 10): |
| 389 |
def get_annotations( |
| 390 |
obj: Callable[..., object] | type[object] | ModuleType, |
| 391 |
*, |
| 392 |
globals: Mapping[str, Any] | None = None, |
| 393 |
locals: Mapping[str, Any] | None = None, |
| 394 |
eval_str: bool = False, |
| 395 |
) -> dict[str, AnnotationForm]: ... |
| 396 |
|
| 397 |
|
| 398 |
class _ParameterKind(enum.IntEnum): |
| 399 |
POSITIONAL_ONLY = 0 |
| 400 |
POSITIONAL_OR_KEYWORD = 1 |
| 401 |
VAR_POSITIONAL = 2 |
| 402 |
KEYWORD_ONLY = 3 |
| 403 |
VAR_KEYWORD = 4 |
| 404 |
|
| 405 |
@property |
| 406 |
def description(self) -> str: ... |
| 407 |
|
| 408 |
if sys.version_info >= (3, 12): |
| 409 |
AGEN_CREATED: Final = "AGEN_CREATED" |
| 410 |
AGEN_RUNNING: Final = "AGEN_RUNNING" |
| 411 |
AGEN_SUSPENDED: Final = "AGEN_SUSPENDED" |
| 412 |
AGEN_CLOSED: Final = "AGEN_CLOSED" |
| 413 |
|
| 414 |
def getasyncgenstate( |
| 415 |
agen: AsyncGenerator[Any, Any], |
| 416 |
) -> Literal["AGEN_CREATED", "AGEN_RUNNING", "AGEN_SUSPENDED", "AGEN_CLOSED"]: ... |
| 417 |
def getasyncgenlocals(agen: AsyncGeneratorType[Any, Any]) -> dict[str, Any]: ... |
| 418 |
|
| 419 |
class Parameter: |
| 420 |
__slots__ = ("_name", "_kind", "_default", "_annotation") |
| 421 |
def __init__(self, name: str, kind: _ParameterKind, *, default: Any = ..., annotation: Any = ...) -> None: ... |
| 422 |
empty = _empty |
| 423 |
|
| 424 |
POSITIONAL_ONLY: ClassVar[Literal[_ParameterKind.POSITIONAL_ONLY]] |
| 425 |
POSITIONAL_OR_KEYWORD: ClassVar[Literal[_ParameterKind.POSITIONAL_OR_KEYWORD]] |
| 426 |
VAR_POSITIONAL: ClassVar[Literal[_ParameterKind.VAR_POSITIONAL]] |
| 427 |
KEYWORD_ONLY: ClassVar[Literal[_ParameterKind.KEYWORD_ONLY]] |
| 428 |
VAR_KEYWORD: ClassVar[Literal[_ParameterKind.VAR_KEYWORD]] |
| 429 |
@property |
| 430 |
def name(self) -> str: ... |
| 431 |
@property |
| 432 |
def default(self) -> Any: ... |
| 433 |
@property |
| 434 |
def kind(self) -> _ParameterKind: ... |
| 435 |
@property |
| 436 |
def annotation(self) -> Any: ... |
| 437 |
def replace( |
| 438 |
self, |
| 439 |
*, |
| 440 |
name: str | type[_void] = ..., |
| 441 |
kind: _ParameterKind | type[_void] = ..., |
| 442 |
default: Any = ..., |
| 443 |
annotation: Any = ..., |
| 444 |
) -> Self: ... |
| 445 |
if sys.version_info >= (3, 13): |
| 446 |
__replace__ = replace |
| 447 |
|
| 448 |
def __eq__(self, other: object) -> bool: ... |
| 449 |
def __hash__(self) -> int: ... |
| 450 |
|
| 451 |
class BoundArguments: |
| 452 |
__slots__ = ("arguments", "_signature", "__weakref__") |
| 453 |
arguments: OrderedDict[str, Any] |
| 454 |
@property |
| 455 |
def args(self) -> tuple[Any, ...]: ... |
| 456 |
@property |
| 457 |
def kwargs(self) -> dict[str, Any]: ... |
| 458 |
@property |
| 459 |
def signature(self) -> Signature: ... |
| 460 |
def __init__(self, signature: Signature, arguments: OrderedDict[str, Any]) -> None: ... |
| 461 |
def apply_defaults(self) -> None: ... |
| 462 |
def __eq__(self, other: object) -> bool: ... |
| 463 |
__hash__: ClassVar[None] |
| 464 |
|
| 465 |
|
| 466 |
|
| 467 |
|
| 468 |
|
| 469 |
_ClassTreeItem: TypeAlias = list[tuple[type, ...]] | list[_ClassTreeItem] |
| 470 |
|
| 471 |
def getclasstree(classes: list[type], unique: bool = False) -> _ClassTreeItem: ... |
| 472 |
def walktree(classes: list[type], children: Mapping[type[Any], list[type]], parent: type[Any] | None) -> _ClassTreeItem: ... |
| 473 |
|
| 474 |
class Arguments(NamedTuple): |
| 475 |
args: list[str] |
| 476 |
varargs: str | None |
| 477 |
varkw: str | None |
| 478 |
|
| 479 |
def getargs(co: CodeType) -> Arguments: ... |
| 480 |
|
| 481 |
if sys.version_info < (3, 11): |
| 482 |
@deprecated("Deprecated since Python 3.0; removed in Python 3.11.") |
| 483 |
class ArgSpec(NamedTuple): |
| 484 |
args: list[str] |
| 485 |
varargs: str | None |
| 486 |
keywords: str | None |
| 487 |
defaults: tuple[Any, ...] |
| 488 |
|
| 489 |
@deprecated("Deprecated since Python 3.0; removed in Python 3.11. Use `inspect.signature()` instead.") |
| 490 |
def getargspec(func: object) -> ArgSpec: ... |
| 491 |
|
| 492 |
class FullArgSpec(NamedTuple): |
| 493 |
args: list[str] |
| 494 |
varargs: str | None |
| 495 |
varkw: str | None |
| 496 |
defaults: tuple[Any, ...] | None |
| 497 |
kwonlyargs: list[str] |
| 498 |
kwonlydefaults: dict[str, Any] | None |
| 499 |
annotations: dict[str, Any] |
| 500 |
|
| 501 |
def getfullargspec(func: object) -> FullArgSpec: ... |
| 502 |
|
| 503 |
class ArgInfo(NamedTuple): |
| 504 |
args: list[str] |
| 505 |
varargs: str | None |
| 506 |
keywords: str | None |
| 507 |
locals: dict[str, Any] |
| 508 |
|
| 509 |
def getargvalues(frame: FrameType) -> ArgInfo: ... |
| 510 |
|
| 511 |
if sys.version_info >= (3, 14): |
| 512 |
def formatannotation(annotation: object, base_module: str | None = None, *, quote_annotation_strings: bool = True) -> str: ... |
| 513 |
|
| 514 |
else: |
| 515 |
def formatannotation(annotation: object, base_module: str | None = None) -> str: ... |
| 516 |
|
| 517 |
def formatannotationrelativeto(object: object) -> Callable[[object], str]: ... |
| 518 |
|
| 519 |
if sys.version_info < (3, 11): |
| 520 |
@deprecated( |
| 521 |
"Deprecated since Python 3.5; removed in Python 3.11. Use `inspect.signature()` and the `Signature` class instead." |
| 522 |
) |
| 523 |
def formatargspec( |
| 524 |
args: list[str], |
| 525 |
varargs: str | None = None, |
| 526 |
varkw: str | None = None, |
| 527 |
defaults: tuple[Any, ...] | None = None, |
| 528 |
kwonlyargs: Sequence[str] | None = (), |
| 529 |
kwonlydefaults: Mapping[str, Any] | None = {}, |
| 530 |
annotations: Mapping[str, Any] = {}, |
| 531 |
formatarg: Callable[[str], str] = ..., |
| 532 |
formatvarargs: Callable[[str], str] = ..., |
| 533 |
formatvarkw: Callable[[str], str] = ..., |
| 534 |
formatvalue: Callable[[Any], str] = ..., |
| 535 |
formatreturns: Callable[[Any], str] = ..., |
| 536 |
formatannotation: Callable[[Any], str] = ..., |
| 537 |
) -> str: ... |
| 538 |
|
| 539 |
def formatargvalues( |
| 540 |
args: list[str], |
| 541 |
varargs: str | None, |
| 542 |
varkw: str | None, |
| 543 |
locals: Mapping[str, Any] | None, |
| 544 |
formatarg: Callable[[str], str] | None = ..., |
| 545 |
formatvarargs: Callable[[str], str] | None = ..., |
| 546 |
formatvarkw: Callable[[str], str] | None = ..., |
| 547 |
formatvalue: Callable[[Any], str] | None = ..., |
| 548 |
) -> str: ... |
| 549 |
def getmro(cls: type) -> tuple[type, ...]: ... |
| 550 |
@deprecated("Deprecated since Python 3.5. Use `Signature.bind` and `Signature.bind_partial` instead.") |
| 551 |
def getcallargs(func: Callable[_P, Any], /, *args: _P.args, **kwds: _P.kwargs) -> dict[str, Any]: ... |
| 552 |
|
| 553 |
class ClosureVars(NamedTuple): |
| 554 |
nonlocals: Mapping[str, Any] |
| 555 |
globals: Mapping[str, Any] |
| 556 |
builtins: Mapping[str, Any] |
| 557 |
unbound: AbstractSet[str] |
| 558 |
|
| 559 |
def getclosurevars(func: _IntrospectableCallable) -> ClosureVars: ... |
| 560 |
def unwrap(func: Callable[..., Any], *, stop: Callable[[Callable[..., Any]], Any] | None = None) -> Any: ... |
| 561 |
|
| 562 |
|
| 563 |
|
| 564 |
|
| 565 |
|
| 566 |
if sys.version_info >= (3, 11): |
| 567 |
class _Traceback(NamedTuple): |
| 568 |
filename: str |
| 569 |
lineno: int |
| 570 |
function: str |
| 571 |
code_context: list[str] | None |
| 572 |
index: int | None |
| 573 |
|
| 574 |
class _FrameInfo(NamedTuple): |
| 575 |
frame: FrameType |
| 576 |
filename: str |
| 577 |
lineno: int |
| 578 |
function: str |
| 579 |
code_context: list[str] | None |
| 580 |
index: int | None |
| 581 |
|
| 582 |
if sys.version_info >= (3, 12): |
| 583 |
class Traceback(_Traceback): |
| 584 |
positions: dis.Positions | None |
| 585 |
def __new__( |
| 586 |
cls, |
| 587 |
filename: str, |
| 588 |
lineno: int, |
| 589 |
function: str, |
| 590 |
code_context: list[str] | None, |
| 591 |
index: int | None, |
| 592 |
*, |
| 593 |
positions: dis.Positions | None = None, |
| 594 |
) -> Self: ... |
| 595 |
|
| 596 |
class FrameInfo(_FrameInfo): |
| 597 |
positions: dis.Positions | None |
| 598 |
def __new__( |
| 599 |
cls, |
| 600 |
frame: FrameType, |
| 601 |
filename: str, |
| 602 |
lineno: int, |
| 603 |
function: str, |
| 604 |
code_context: list[str] | None, |
| 605 |
index: int | None, |
| 606 |
*, |
| 607 |
positions: dis.Positions | None = None, |
| 608 |
) -> Self: ... |
| 609 |
|
| 610 |
else: |
| 611 |
@disjoint_base |
| 612 |
class Traceback(_Traceback): |
| 613 |
positions: dis.Positions | None |
| 614 |
def __new__( |
| 615 |
cls, |
| 616 |
filename: str, |
| 617 |
lineno: int, |
| 618 |
function: str, |
| 619 |
code_context: list[str] | None, |
| 620 |
index: int | None, |
| 621 |
*, |
| 622 |
positions: dis.Positions | None = None, |
| 623 |
) -> Self: ... |
| 624 |
|
| 625 |
@disjoint_base |
| 626 |
class FrameInfo(_FrameInfo): |
| 627 |
positions: dis.Positions | None |
| 628 |
def __new__( |
| 629 |
cls, |
| 630 |
frame: FrameType, |
| 631 |
filename: str, |
| 632 |
lineno: int, |
| 633 |
function: str, |
| 634 |
code_context: list[str] | None, |
| 635 |
index: int | None, |
| 636 |
*, |
| 637 |
positions: dis.Positions | None = None, |
| 638 |
) -> Self: ... |
| 639 |
|
| 640 |
else: |
| 641 |
class Traceback(NamedTuple): |
| 642 |
filename: str |
| 643 |
lineno: int |
| 644 |
function: str |
| 645 |
code_context: list[str] | None |
| 646 |
index: int | None |
| 647 |
|
| 648 |
class FrameInfo(NamedTuple): |
| 649 |
frame: FrameType |
| 650 |
filename: str |
| 651 |
lineno: int |
| 652 |
function: str |
| 653 |
code_context: list[str] | None |
| 654 |
index: int | None |
| 655 |
|
| 656 |
def getframeinfo(frame: FrameType | TracebackType, context: int = 1) -> Traceback: ... |
| 657 |
def getouterframes(frame: Any, context: int = 1) -> list[FrameInfo]: ... |
| 658 |
def getinnerframes(tb: TracebackType, context: int = 1) -> list[FrameInfo]: ... |
| 659 |
def getlineno(frame: FrameType) -> int: ... |
| 660 |
def currentframe() -> FrameType | None: ... |
| 661 |
def stack(context: int = 1) -> list[FrameInfo]: ... |
| 662 |
def trace(context: int = 1) -> list[FrameInfo]: ... |
| 663 |
|
| 664 |
|
| 665 |
|
| 666 |
|
| 667 |
|
| 668 |
def getattr_static(obj: object, attr: str, default: Any | None = ...) -> Any: ... |
| 669 |
|
| 670 |
|
| 671 |
|
| 672 |
|
| 673 |
|
| 674 |
GEN_CREATED: Final = "GEN_CREATED" |
| 675 |
GEN_RUNNING: Final = "GEN_RUNNING" |
| 676 |
GEN_SUSPENDED: Final = "GEN_SUSPENDED" |
| 677 |
GEN_CLOSED: Final = "GEN_CLOSED" |
| 678 |
|
| 679 |
def getgeneratorstate( |
| 680 |
generator: Generator[Any, Any, Any], |
| 681 |
) -> Literal["GEN_CREATED", "GEN_RUNNING", "GEN_SUSPENDED", "GEN_CLOSED"]: ... |
| 682 |
|
| 683 |
CORO_CREATED: Final = "CORO_CREATED" |
| 684 |
CORO_RUNNING: Final = "CORO_RUNNING" |
| 685 |
CORO_SUSPENDED: Final = "CORO_SUSPENDED" |
| 686 |
CORO_CLOSED: Final = "CORO_CLOSED" |
| 687 |
|
| 688 |
def getcoroutinestate( |
| 689 |
coroutine: Coroutine[Any, Any, Any], |
| 690 |
) -> Literal["CORO_CREATED", "CORO_RUNNING", "CORO_SUSPENDED", "CORO_CLOSED"]: ... |
| 691 |
def getgeneratorlocals(generator: Generator[Any, Any, Any]) -> dict[str, Any]: ... |
| 692 |
def getcoroutinelocals(coroutine: Coroutine[Any, Any, Any]) -> dict[str, Any]: ... |
| 693 |
|
| 694 |
|
| 695 |
|
| 696 |
_Object: TypeAlias = object |
| 697 |
|
| 698 |
class Attribute(NamedTuple): |
| 699 |
name: str |
| 700 |
kind: Literal["class method", "static method", "property", "method", "data"] |
| 701 |
defining_class: type |
| 702 |
object: _Object |
| 703 |
|
| 704 |
def classify_class_attrs(cls: type) -> list[Attribute]: ... |
| 705 |
|
| 706 |
class ClassFoundException(Exception): ... |
| 707 |
|
| 708 |
if sys.version_info >= (3, 12): |
| 709 |
class BufferFlags(enum.IntFlag): |
| 710 |
SIMPLE = 0 |
| 711 |
WRITABLE = 1 |
| 712 |
FORMAT = 4 |
| 713 |
ND = 8 |
| 714 |
STRIDES = 24 |
| 715 |
C_CONTIGUOUS = 56 |
| 716 |
F_CONTIGUOUS = 88 |
| 717 |
ANY_CONTIGUOUS = 152 |
| 718 |
INDIRECT = 280 |
| 719 |
CONTIG = 9 |
| 720 |
CONTIG_RO = 8 |
| 721 |
STRIDED = 25 |
| 722 |
STRIDED_RO = 24 |
| 723 |
RECORDS = 29 |
| 724 |
RECORDS_RO = 28 |
| 725 |
FULL = 285 |
| 726 |
FULL_RO = 284 |
| 727 |
READ = 256 |
| 728 |
WRITE = 512 |