# coding: utf-8 # AUTO-GENERATED FILE -- DO NOT EDIT """ Accelerators for the typing module. """ class Generic(object): """ Abstract base class for generic types. On Python 3.12 and newer, generic classes implicitly inherit from Generic when they declare a parameter list after the class's name:: class Mapping[KT, VT]: def __getitem__(self, key: KT) -> VT: ... # Etc. On older versions of Python, however, generic classes have to explicitly inherit from Generic. After a class has been declared to be generic, it can then be used as follows:: def lookup_name[KT, VT](mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default """ def __init__(self, arg0): return None class ParamSpec(object): """ Parameter specification variable. The preferred way to construct a parameter specification is via the dedicated syntax for generic functions, classes, and type aliases, where the use of '**' creates a parameter specification:: type IntFunc[**P] = Callable[P, int] For compatibility with Python 3.11 and earlier, ParamSpec objects can also be created as follows:: P = ParamSpec('P') Parameter specification variables exist primarily for the benefit of static type checkers. They are used to forward the parameter types of one callable to another callable, a pattern commonly found in higher-order functions and decorators. They are only valid when used in ``Concatenate``, or as the first argument to ``Callable``, or as parameters for user-defined Generics. See class Generic for more information on generic types. An example for annotating a decorator:: def add_logging[**P, T](f: Callable[P, T]) -> Callable[P, T]: '''A type-safe decorator to add logging to a function.''' def inner(*args: P.args, **kwargs: P.kwargs) -> T: logging.info(f'{f.__name__} was called') return f(*args, **kwargs) return inner @add_logging def add_two(x: float, y: float) -> float: '''Add two numbers together.''' return x + y Parameter specification variables can be introspected. e.g.:: >>> P = ParamSpec("P") >>> P.__name__ 'P' Note that only parameter specification variables defined in the global scope can be pickled. """ args = property(None, None, None, """ Represents positional arguments. """ ) kwargs = property(None, None, None, """ Represents keyword arguments. """ ) def __init__(self, P): return None class ParamSpecArgs(object): """ The args for a ParamSpec object. Given a ParamSpec object P, P.args is an instance of ParamSpecArgs. ParamSpecArgs objects have a reference back to their ParamSpec:: >>> P = ParamSpec("P") >>> P.args.__origin__ is P True This type is meant for runtime introspection and has no special meaning to static type checkers. """ pass class ParamSpecKwargs(object): """ The kwargs for a ParamSpec object. Given a ParamSpec object P, P.kwargs is an instance of ParamSpecKwargs. ParamSpecKwargs objects have a reference back to their ParamSpec:: >>> P = ParamSpec("P") >>> P.kwargs.__origin__ is P True This type is meant for runtime introspection and has no special meaning to static type checkers. """ pass class TypeAliasType(object): """ Type alias. Type aliases are created through the type statement:: type Alias = int In this example, Alias and int will be treated equivalently by static type checkers. At runtime, Alias is an instance of TypeAliasType. The __name__ attribute holds the name of the type alias. The value of the type alias is stored in the __value__ attribute. It is evaluated lazily, so the value is computed only if the attribute is accessed. Type aliases can also be generic:: type ListOrSet[T] = list[T] | set[T] In this case, the type parameters of the alias are stored in the __type_params__ attribute. See PEP 695 for more information. """ pass class TypeVar(object): """ Type variable. The preferred way to construct a type variable is via the dedicated syntax for generic functions, classes, and type aliases:: class Sequence[T]: # T is a TypeVar ... This syntax can also be used to create bound and constrained type variables:: # S is a TypeVar bound to str class StrSequence[S: str]: ... # A is a TypeVar constrained to str or bytes class StrOrBytesSequence[A: (str, bytes)]: ... However, if desired, reusable type variables can also be constructed manually, like so:: T = TypeVar('T') # Can be anything S = TypeVar('S', bound=str) # Can be any subtype of str A = TypeVar('A', str, bytes) # Must be exactly str or bytes Type variables exist primarily for the benefit of static type checkers. They serve as the parameters for generic types as well as for generic function and type alias definitions. The variance of type variables is inferred by type checkers when they are created through the type parameter syntax and when ``infer_variance=True`` is passed. Manually created type variables may be explicitly marked covariant or contravariant by passing ``covariant=True`` or ``contravariant=True``. By default, manually created type variables are invariant. See PEP 484 and PEP 695 for more details. """ def __init__(self, T): return None class TypeVarTuple(object): """ Type variable tuple. A specialized form of type variable that enables variadic generics. The preferred way to construct a type variable tuple is via the dedicated syntax for generic functions, classes, and type aliases, where a single '*' indicates a type variable tuple:: def move_first_element_to_last[T, *Ts](tup: tuple[T, *Ts]) -> tuple[*Ts, T]: return (*tup[1:], tup[0]) For compatibility with Python 3.11 and earlier, TypeVarTuple objects can also be created as follows:: Ts = TypeVarTuple('Ts') # Can be given any name Just as a TypeVar (type variable) is a placeholder for a single type, a TypeVarTuple is a placeholder for an *arbitrary* number of types. For example, if we define a generic class using a TypeVarTuple:: class C[*Ts]: ... Then we can parameterize that class with an arbitrary number of type arguments:: C[int] # Fine C[int, str] # Also fine C[()] # Even this is fine For more details, see PEP 646. Note that only TypeVarTuples defined in the global scope can be pickled. """ def __init__(self, arg0=None, *Ts): return () __doc__ = """Accelerators for the typing module. """ class __loader__(object): """ Meta path import for built-in modules. All methods are either class or static methods to avoid the need to instantiate the class. """ _ORIGIN = 'built-in' def create_module(self, spec): """ Create a built-in module """ pass def exec_module(self, module): """ Exec a built-in module """ pass def find_spec(self, fullname, path=None, target=None): pass def get_code(self, fullname): """ Return None as built-in modules do not have code objects. """ pass def get_source(self, fullname): """ Return None as built-in modules do not have source code. """ pass def is_package(self, fullname): """ Return False as built-in modules are never packages. """ pass def load_module(self, fullname): """ Load the specified module into sys.modules and return it. This method is deprecated. Use loader.exec_module() instead. """ pass __name__ = '_typing' __package__ = '' __spec__ = None def _idfunc(x): pass