AlkantarClanX12

Your IP : 3.17.155.142


Current Path : /opt/alt/python39/lib64/python3.9/__pycache__/
Upload File :
Current File : //opt/alt/python39/lib64/python3.9/__pycache__/typing.cpython-39.pyc

a

R�f�,�@sdZddlmZmZddlZddlZddlZddlZddlZddl	Z
ddlZddlZddlm
Z
mZmZmZgd�Zd�dd�dd	�Zd�dd�dd�Zd
d�Zdd�Zdd�Zdd�Zdd�Zdd�ZgZd�dd�dd�Ze�fdd�ZGdd�d�ZGd d!�d!�ZGd"d#�d#ed
d$�Z Gd%d&�d&e d
d$�Z!e d'd(��Z"e d)d*��Z#e d+d,��Z$e d-d.��Z%e d/d0��Z&e d1d2��Z'e!ed
d�d3d4���Z(Gd5d6�d6ed
d$�Z)Gd7d8�d8eed
d$�Z*d9d:�Z+Gd;d<�d<ed
d$�Z,Gd=d>�d>e,d
d$�Z-Gd?d@�d@e,d
d$�Z.GdAdB�dBe-d
d$�Z/GdCdD�dDe.d
d$�Z0GdEdF�dFe.d
d$�Z1GdGdH�dHe-d
d$�Z2dIdJ�Z3GdKdL�dLe-d
d$�Z4GdMdN�dN�Z5GdOdP�dP�Z6GdQdR�dR�Z7gdS�Z8gdT�Z9e8e9dUgZ:dVdW�Z;dXdY�Z<dZd[�Z=d\d]�Z>gd^�d_d`gda�Z?Gdbdc�dce�Z@Gddde�dee5e@df�ZAGdgdh�dhe-d
d$�ZBGdidj�dj�ZCdkdl�ZDdmdn�ZEdodp�ZFejGejHejIejJe
eefZKd�dqdr�ZLdsdt�ZMdudv�ZNdwdx�ZOdydz�ZPd{d|�ZQd}d~�ZRdd��ZSd�d��ZTe*d��ZUe*d��ZVe*d��ZWe*d�d
d��ZXe*d�d
d��ZYe*d�d
d��ZZe*d�d
d��Z[e*d�d
e\d��Z]e*d�e^e_�Z`e.Zaeaejjbd�Zbeaejjcd��Zceaejjdd��Zdeaejjed��Zeeaejjfd��Zfeaejjgd��Zgeaejjhd��Zheaejjid��Zieaejjjd�Zjeaejjkd��Zkeaejjld��Zle0ejjmd��Zmd�em_eaejjnd�d�d��Zoeaejjpd��Zpeaejjqd��Zqeaejjrd��Zreaejjsd��Zseaejjtd��Zteaejjud�Zue1evd�dd�d��Zwd�ew_eaexd�dd�d��Zyeaejzd�d�d��Z{eae|d�dd�d��Zneaed�dd�d��Z}eaejj~d��Z~eaejjd��Zeaejj�d��Z�eaejj�d��Z�eaej�d�d�d��Z�eaej�d�d�d��Z�eae�d�dd�d��Z�eaej�d�d�d��Z�eaej�d��Z�eaej�d��Z�eaej�d��Z�eaejj�d��Z�eaejj�d��Z�eae\d�dd�d��Z�d�e�_eDGd�d��d�eA��Z�eDGd�d��d�eA��Z�eDGd�d��d�eA��Z�eDGd�d��d�eA��Z�eDGd�d��d�eA��Z�eDGd�d��d�eAeX��Z�eDGd�d��d�eAeX��Z�d�d�d��Z�ehd���Z�ehd���Z�Gd�d��d�e\�Z�d�d�d��Z�e\��e�d�d�i�Z�d�d��Z�e�e�_�Gd�d��d�e\�Z�d�d
d��d�d��Z�e\��e�d�d�i�Z�d�d„e�_�d�dĄZ�e_Z�dZ�Gd�dƄd�e5e`�Z�Gd�dȄd�e�e^�Z�Gd�dʄd�e�e_�Z�Gd�d̄d̃Z�e�d�e�_�e�ej�e�j�<eae
j�d��Z�eae
j�d��Z�Gd�dτdσZ	e�d�e	_�e	ej�e	j�<dS)�a=
The typing module: Support for gradual typing as defined by PEP 484.

At large scale, the structure of the module is following:
* Imports and exports, all public names should be explicitly added to __all__.
* Internal helper functions: these should never be used in code outside this module.
* _SpecialForm and its instances (special forms): Any, NoReturn, ClassVar, Union, Optional
* Two classes whose instances can be type arguments in addition to types: ForwardRef and TypeVar
* The core of internal generics API: _GenericAlias and _VariadicGenericAlias, the latter is
  currently only used by Tuple and Callable. All subscripted types like X[int], Union[int, str],
  etc., are instances of either of these classes.
* The public counterpart of the generics API consists of two classes: Generic and Protocol.
* Public helper functions: get_type_hints, overload, cast, no_type_check,
  no_type_check_decorator.
* Generic aliases for collections.abc ABCs and few additional protocols.
* Special types: NewType, NamedTuple, TypedDict.
* Wrapper submodules for re and io related types.
�)�abstractmethod�ABCMetaN)�WrapperDescriptorType�MethodWrapperType�MethodDescriptorType�GenericAlias)M�	Annotated�Any�Callable�ClassVar�Final�
ForwardRef�Generic�Literal�Optional�Protocol�Tuple�Type�TypeVar�Union�AbstractSet�
ByteString�	Container�ContextManager�Hashable�	ItemsView�Iterable�Iterator�KeysView�Mapping�MappingView�MutableMapping�MutableSequence�
MutableSet�Sequence�Sized�
ValuesView�	Awaitable�
AsyncIterator�
AsyncIterable�	Coroutine�
Collection�AsyncGenerator�AsyncContextManager�
Reversible�SupportsAbs�
SupportsBytes�SupportsComplex�
SupportsFloat�
SupportsIndex�SupportsInt�
SupportsRound�ChainMap�Counter�Deque�Dict�DefaultDict�List�OrderedDict�Set�	FrozenSet�
NamedTuple�	TypedDict�	Generator�BinaryIO�IO�Match�Pattern�TextIO�AnyStr�cast�final�get_args�
get_origin�get_type_hints�NewType�
no_type_check�no_type_check_decorator�NoReturn�overload�runtime_checkable�Text�
TYPE_CHECKINGF��allow_special_formscCs,|durtd�St|t�r(t|||d�S|S)z=For converting None to type(None), and strings to ForwardRef.N)�module�is_class)�type�
isinstance�strr
)�argrWrV�r]�+/opt/alt/python39/lib64/python3.9/typing.py�
_type_convert�s

r_TcCs�ttf}|s$|tf7}|r$|tf7}t|||d�}t|t�rT|j|vrTt|�d���|t	t
tfvrf|St|t�s||ttfvr�td|�d���t|tt
tf�r�|St|�s�t|�d|d�d���|S)a�Check that the argument is a type, and return it (internal helper).

    As a special case, accept None and return type(None) instead. Also wrap strings
    into ForwardRef instances. Consider several corner cases, for example plain
    special forms like Union are not valid, while Union[int, str] is OK, etc.
    The msg argument is a human-readable error message, e.g::

        "Union[arg, ...]: arg should be a type."

    We append the repr() of the actual value (truncated to 100 chars).
    )rWrVz is not valid as type argumentzPlain z Got z.100�.)rrrrr_rZ�
_GenericAlias�
__origin__�	TypeErrorr	rP�_SpecialFormrYrr
�callable)r\�msg�is_argumentrWrV�invalid_generic_formsr]r]r^�_type_check�s&


�ricCsft|tj�rt|�St|t�r@|jdkr.|jS|j�d|j��S|durLdSt|tj�r^|jSt|�S)a;Return the repr() of an object, special-casing types (internal helper).

    If obj is a type, we return a shorter version than the default
    type.__repr__, based on the module and qualified name, which is
    typically enough to uniquely identify a type.  For everything
    else, we fall back on repr(obj).
    �builtinsr`.z...)	rZ�typesr�reprrY�
__module__�__qualname__�FunctionType�__name__)�objr]r]r^�
_type_repr�s

rrcsZg�|D]H}t|t�r(|�vr(��|�t|ttf�r���fdd�|jD��qt��S)z�Collect all type variable contained in types in order of
    first appearance (lexicographic order). For example::

        _collect_type_vars((T, List[S, T])) == (T, S)
    csg|]}|�vr|�qSr]r]��.0�t��tvarsr]r^�
<listcomp>��z&_collect_type_vars.<locals>.<listcomp>)rZr�appendrar�extend�__parameters__�tuple)rkrur]rvr^�_collect_type_vars�s
r~c	CsR|st|�d���t|�}||krNtd||kr2dnd�d|�d|�d|����dS)	z�Check correct count for parameters of a generic cls (internal helper).
    This gives a nice error message in case of count mismatch.
    z is not a generic classzToo �many�fewz parameters for z	; actual z, expected N)rc�len)�cls�
parameters�elen�alenr]r]r^�_check_generic�s��r�cCsVt|�}t|�t|�krRg}|D] }||vr |�|�|�|�q |}|rRJ|��|S�N)�setr�rz�remove)�params�
all_params�
new_paramsrur]r]r^�_deduplicate�s
r�cCsrg}|D]\}t|t�r$|�|j�qt|t�rZt|�dkrZ|dturZ|�|dd��q|�|�qtt|��S)zyAn internal helper for Union creation and substitution: flatten Unions
    among parameters, then remove duplicates.
    r�N)	rZ�_UnionGenericAliasr{�__args__r}r�rrzr��r�r��pr]r]r^�_remove_dups_flatten�s
"r�cCs8g}|D]&}t|t�r$|�|j�q|�|�qt|�S)zJAn internal helper for Literal creation: flatten Literals among parameters)rZ�_LiteralGenericAliasr{r�rzr}r�r]r]r^�_flatten_literal_params�s
r���typedcs �fdd�}|dur||�S|S)zInternal wrapper caching __getitem__ of generic types with a fallback to
    original function for non-hashable arguments.
    cs8tj�d����t��j�t�����fdd��}|S)Nr�cs2z�|i|��WSty"Yn0�|i|��Sr��rc��args�kwds��cached�funcr]r^�inners
z+_tp_cache.<locals>.decorator.<locals>.inner)�	functools�	lru_cache�	_cleanupsrz�cache_clear�wraps)r�r�r�r�r^�	decorators
z_tp_cache.<locals>.decoratorNr])r�r�r�r]r�r^�	_tp_caches
r�cstt|t�r|�����St|ttf�rpt���fdd�|jD��}||jkrP|St|t�rft|j|�S|�|�S|S)z�Evaluate all forward references in the given type t.
    For use of globalns and localns see the docstring for get_type_hints().
    recursive_guard is used to prevent infinite recursion with a recursive
    ForwardRef.
    c3s|]}t|����VqdSr�)�
_eval_type�rt�a��globalns�localns�recursive_guardr]r^�	<genexpr>&ryz_eval_type.<locals>.<genexpr>)	rZr
�	_evaluaterarr}r�rb�	copy_with)rur�r�r��ev_argsr]r�r^r�s



r�c@seZdZdZdZdd�ZdS)�_FinalzMixin to prohibit subclassing)�__weakref__cOsd|vrtd��dS)N�_rootz&Cannot subclass special typing classesr���selfr�r�r]r]r^�__init_subclass__5sz_Final.__init_subclass__N)rprmrn�__doc__�	__slots__r�r]r]r]r^r�0sr�c@s$eZdZdZdZdd�Zdd�ZdS)�
_Immutablez3Mixin to indicate that object should not be copied.r]cCs|Sr�r]�r�r]r]r^�__copy__=sz_Immutable.__copy__cCs|Sr�r])r��memor]r]r^�__deepcopy__@sz_Immutable.__deepcopy__N)rprmrnr�r�r�r�r]r]r]r^r�9sr�c@sTeZdZdZdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
edd��ZdS)rd)�_namer��_getitemcCs||_|j|_|j|_dSr�)r�rpr�r�)r��getitemr]r]r^�__init__Isz_SpecialForm.__init__cCstd|����dS)NzCannot subclass r�)r��basesr]r]r^�__mro_entries__Nsz_SpecialForm.__mro_entries__cCs
d|jS�N�typing.�r�r�r]r]r^�__repr__Qsz_SpecialForm.__repr__cCs|jSr�r�r�r]r]r^�
__reduce__Tsz_SpecialForm.__reduce__cOstd|����dS)NzCannot instantiate r�r�r]r]r^�__call__Wsz_SpecialForm.__call__cCst|�d���dS)Nz! cannot be used with isinstance()r��r�rqr]r]r^�__instancecheck__Zsz_SpecialForm.__instancecheck__cCst|�d���dS)Nz! cannot be used with issubclass()r��r�r�r]r]r^�__subclasscheck__]sz_SpecialForm.__subclasscheck__cCs|�||�Sr�)r��r�r�r]r]r^�__getitem__`sz_SpecialForm.__getitem__N)
rprmrnr�r�r�r�r�r�r�r�r�r�r]r]r]r^rdFsrd)r�c@seZdZdd�ZdS)�_LiteralSpecialFormcCs"t|t�s|f}|j|g|�R�Sr�)rZr}r�r�r]r]r^r�fs
z_LiteralSpecialForm.__getitem__N)rprmrnr�r]r]r]r^r�esr�cCst|�d���dS)a`Special type indicating an unconstrained type.

    - Any is compatible with every type.
    - Any assumed to have all methods.
    - All values assumed to be instances of Any.

    Note that all the above statements are true from the point of view of
    static type checkers. At runtime, Any should not be used with instance
    or class checks.
    � is not subscriptableNr�r�r]r]r^r	lsr	cCst|�d���dS)aSpecial type indicating functions that never return.
    Example::

      from typing import NoReturn

      def stop() -> NoReturn:
          raise Exception('no way')

    This type is invalid in other positions, e.g., ``List[NoReturn]``
    will fail in static type checkers.
    r�Nr�r�r]r]r^rPzs
rPcCst||�d��}t||f�S)a3Special type construct to mark class variables.

    An annotation wrapped in ClassVar indicates that a given
    attribute is intended to be used as a class variable and
    should not be set on instances of that class. Usage::

      class Starship:
          stats: ClassVar[Dict[str, int]] = {} # class variable
          damage: int = 10                     # instance variable

    ClassVar accepts only types and cannot be further subscribed.

    Note that ClassVar is not a class itself, and should not
    be used with isinstance() or issubclass().
    � accepts only single type.�rira�r�r��itemr]r]r^r�srcCst||�d��}t||f�S)a�Special typing construct to indicate final names to type checkers.

    A final name cannot be re-assigned or overridden in a subclass.
    For example:

      MAX_SIZE: Final = 9000
      MAX_SIZE += 1  # Error reported by type checker

      class Connection:
          TIMEOUT: Final[int] = 10

      class FastConnector(Connection):
          TIMEOUT = 1  # Error reported by type checker

    There is no runtime checking of these properties.
    r�r�r�r]r]r^r�srcs`|dkrtd��t|t�s |f}d�t�fdd�|D��}t|�}t|�dkrV|dSt||�S)a'Union type; Union[X, Y] means either X or Y.

    To define a union, use e.g. Union[int, str].  Details:
    - The arguments must be types and there must be at least one.
    - None as an argument is a special case and is replaced by
      type(None).
    - Unions of unions are flattened, e.g.::

        Union[Union[int, str], float] == Union[int, str, float]

    - Unions of a single argument vanish, e.g.::

        Union[int] == int  # The constructor actually returns int

    - Redundant arguments are skipped, e.g.::

        Union[int, str, int] == Union[int, str]

    - When comparing unions, the argument order is ignored, e.g.::

        Union[int, str] == Union[str, int]

    - You cannot subclass or instantiate a union.
    - You can use Optional[X] as a shorthand for Union[X, None].
    r]z Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.c3s|]}t|��VqdSr��ri�rtr��rfr]r^r��ryzUnion.<locals>.<genexpr>r�r)rcrZr}r�r�r�r�r]r�r^r�s
rcCs t||�d��}t|td�fS)zEOptional type.

    Optional[X] is equivalent to Union[X, None].
    z requires a single type.N)rirrY)r�r�r\r]r]r^r�srcGsHt|�}z"tdd�ttt|���D��}Wnty<Yn0t||�S)a�Special typing form to define literal types (a.k.a. value types).

    This form can be used to indicate to type checkers that the corresponding
    variable or function parameter has a value equivalent to the provided
    literal (or one of several literals):

      def validate_simple(data: Any) -> Literal[True]:  # always returns True
          ...

      MODE = Literal['r', 'rb', 'w', 'wb']
      def open_helper(file: str, mode: MODE) -> str:
          ...

      open_helper('/some/path', 'r')  # Passes type check
      open_helper('/other/path', 'typo')  # Error in type checker

    Literal[...] cannot be subclassed. At runtime, an arbitrary value
    is allowed as type argument to Literal[...], but type checkers may
    impose restrictions.
    css|]\}}|VqdSr�r])rtr��_r]r]r^r��ryzLiteral.<locals>.<genexpr>)r�r}r��list�_value_and_type_iterrcr�r�r]r]r^r�s"rc@sDeZdZdZdZddd�dd�Zd	d
�Zdd�Zd
d�Zdd�Z	dS)r
z-Internal wrapper to hold a forward reference.)�__forward_arg__�__forward_code__�__forward_evaluated__�__forward_value__�__forward_is_argument__�__forward_is_class__�__forward_module__TNF)rXcCsxt|t�std|����zt|dd�}Wn tyHtd|����Yn0||_||_d|_d|_||_	||_
||_dS)Nz*Forward reference must be a string -- got z<string>�evalz/Forward reference must be an expression -- got F)rZr[rc�compile�SyntaxErrorr�r�r�r�r�r�r�)r�r\rgrWrX�coder]r]r^r�s
zForwardRef.__init__cCs�|j|vr|S|jr||ur�|dur6|dur6i}}n|durD|}n|durP|}|jdurrttj�|jd�d|�}tt|j	||�d|j
|jd�}t|||||jhB�|_
d|_|j
S)N�__dict__z*Forward references must evaluate to types.)rgrVT)r�r�r��getattr�sys�modules�getrir�r�r�r�r�r�)r�r�r�r��type_r]r]r^r�s0


���zForwardRef._evaluatecCsJt|t�stS|jr2|jr2|j|jko0|j|jkS|j|jkoH|j|jkSr�)rZr
�NotImplementedr�r�r�r��r��otherr]r]r^�__eq__5s

�
�zForwardRef.__eq__cCst|j|jf�Sr�)�hashr�r�r�r]r]r^�__hash__>szForwardRef.__hash__cCsd|j�d�S)NzForwardRef(�))r�r�r]r]r^r�AszForwardRef.__repr__)TN)
rprmrnr�r�r�r�r�r�r�r]r]r]r^r
s	r
c@s6eZdZdZdZdddd�dd�Zdd	�Zd
d�ZdS)ra�Type variable.

    Usage::

      T = TypeVar('T')  # Can be anything
      A = TypeVar('A', str, bytes)  # Must be 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 definitions.  See class Generic for more
    information on generic types.  Generic functions work as follows:

      def repeat(x: T, n: int) -> List[T]:
          '''Return a list containing n references to x.'''
          return [x]*n

      def longest(x: A, y: A) -> A:
          '''Return the longest of two strings.'''
          return x if len(x) >= len(y) else y

    The latter example's signature is essentially the overloading
    of (str, str) -> str and (bytes, bytes) -> bytes.  Also note
    that if the arguments are instances of some subclass of str,
    the return type is still plain str.

    At runtime, isinstance(x, T) and issubclass(C, T) will raise TypeError.

    Type variables defined with covariant=True or contravariant=True
    can be used to declare covariant or contravariant generic types.
    See PEP 484 for more details. By default generic types are invariant
    in all type variables.

    Type variables can be introspected. e.g.:

      T.__name__ == 'T'
      T.__constraints__ == ()
      T.__covariant__ == False
      T.__contravariant__ = False
      A.__constraints__ == (str, bytes)

    Note that only type variables defined in global scope can be pickled.
    )rp�	__bound__�__constraints__�
__covariant__�__contravariant__r�NF)�bound�	covariant�
contravariantc	s�||_|r|rtd��t|�|_t|�|_|r>|dur>td��|rVt|�dkrVtd��d�t�fdd�|D��|_|r�t	|d�|_
nd|_
zt�d�j
�d	d
�}Wnttfy�d}Yn0|dkr�||_dS)Nz"Bivariant types are not supported.z-Constraints cannot be combined with bound=...r�z"A single constraint is not allowedz:TypeVar(name, constraint, ...): constraints must be types.c3s|]}t|��VqdSr�r�rsr�r]r^r��ryz#TypeVar.__init__.<locals>.<genexpr>zBound must be a type.rp�__main__�typing)rp�
ValueError�boolr�r�rcr�r}r�rir�r��	_getframe�	f_globalsr��AttributeErrorrm)r��namer�r�r��constraints�def_modr]r�r^r�ts(


zTypeVar.__init__cCs&|jrd}n|jrd}nd}||jS)N�+�-�~)r�r�rp)r��prefixr]r]r^r��szTypeVar.__repr__cCs|jSr�)rpr�r]r]r^r��szTypeVar.__reduce__)rprmrnr�r�r�r�r�r]r]r]r^rEs+�	rcCs|�d�o|�d�S)N�__)�
startswith�endswith)�attrr]r]r^�
_is_dunder�srcsXeZdZdZddd�dd�Zdd�Zd	d
�Zdd�Z�fd
d�Zdd�Z	dd�Z
�ZS)�_BaseGenericAliasa�The central part of internal API.

    This represents a generic version of type 'origin' with type arguments 'params'.
    There are two kind of these aliases: user defined and special. The special ones
    are wrappers around builtin collections and ABCs in collections.abc. These must
    have 'name' always set. If 'inst' is False, then the alias can't be instantiated,
    this is used by e.g. typing.List and typing.Dict.
    TN��instrcCs||_||_||_d|_dSr�)�_instr�rbr�)r��originrrr]r]r^r��sz_BaseGenericAlias.__init__cOsT|js"td|j�d|jj�d���|j|i|��}z
||_WntyNYn0|S)NzType z cannot be instantiated; use z
() instead)rrcr�rbrp�__orig_class__r)r�r��kwargs�resultr]r]r^r��s�

z_BaseGenericAlias.__call__cCsdg}|j|vr|�|j�|�|�}||dd�D]}t|t�sLt|t�r4q\q4|�t�t|�S)Nr�)rbrz�indexrZr�
issubclassrr})r�r��res�i�br]r]r^r��s


z!_BaseGenericAlias.__mro_entries__cCs*d|jvrt|�st|j|�St|��dS)Nrb)r�rr�rbr)r�r
r]r]r^�__getattr__�sz_BaseGenericAlias.__getattr__cs2t|�s|dvr t��||�nt|j||�dS)N)r�r�_nparams)r�super�__setattr__�setattrrb)r�r
�val��	__class__r]r^r�sz_BaseGenericAlias.__setattr__cCs|�t|��Sr�)r�rYr�r]r]r^r��sz#_BaseGenericAlias.__instancecheck__cCstd��dS)NzBSubscripted generics cannot be used with class and instance checksr�r�r]r]r^r��sz#_BaseGenericAlias.__subclasscheck__)rprmrnr�r�r�r�rrr�r��
__classcell__r]r]r"r^r�srcsdeZdZddd��fdd�
Zdd�Zdd	�Zed
d��Zdd
�Zdd�Z	dd�Z
�fdd�Z�ZS)raTNrcsPt�j|||d�t|t�s"|f}tdd�|D��|_t|�|_|sL|j|_dS)Nrcss*|]"}|turdn|turdn|VqdS).r]N)�_TypingEllipsis�_TypingEmptyr�r]r]r^r��s�z)_GenericAlias.__init__.<locals>.<genexpr>)rr�rZr}r�r~r|rm)r�rr�rrr"r]r^r��s
�

z_GenericAlias.__init__cCs&t|t�stS|j|jko$|j|jkSr�)rZrar�rbr�r�r]r]r^r��s


�z_GenericAlias.__eq__cCst|j|jf�Sr�)r�rbr�r�r]r]r^r��sz_GenericAlias.__hash__cs�|jttfvrtd|����t|t�s,|f}d�t�fdd�|D��}t||t|j��t	t
|j|���g}|jD]X}t|t�r��|}n6t|t
tf�r�|j}|r�t�fdd�|D��}||}|�|�qr|�t|��S)Nz%Cannot subscript already-subscripted �*Parameters to generic types must be types.c3s|]}t|��VqdSr�r�r�r�r]r^r��ryz,_GenericAlias.__getitem__.<locals>.<genexpr>c3s|]}�|VqdSr�r])rt�x)�substr]r^r�
ry)rbrrrcrZr}r�r�r|�dict�zipr�rrarrzr�)r�r��new_argsr\�	subparams�subargsr])rfr)r^r��s&



z_GenericAlias.__getitem__cCs|j|j||j|jd�S�N)rr)r#rbr�r�r�r�r]r]r^r�sz_GenericAlias.copy_withcCsB|jrd|j}n
t|j�}d�dd�|jD��}|�d|�d�S)Nr��, cSsg|]}t|��qSr]�rrr�r]r]r^rxryz*_GenericAlias.__repr__.<locals>.<listcomp>�[�])r�rrrb�joinr�)r�rr�r]r]r^r�s

z_GenericAlias.__repr__cCsR|jrt�|j}n|j}t|j�}t|�dkrDt|dt�sD|\}tj||ffS�Nr�r)	r��globalsrbr}r�r�rZ�operatorr�)r�rr�r]r]r^r�s
z_GenericAlias.__reduce__csh|jrt��|�S|jtur`t|vr(dS|�|�}||dd�D]}t|t�rB||urBdSqB|jfS)Nr]r�)	r�rr�rbrrrrZr)r�r�rrr"r]r^r�$s

z_GenericAlias.__mro_entries__)
rprmrnr�r�r�r�r�r�r�r�r�r$r]r]r"r^ra�s

racsTeZdZddd��fdd�
Zedd��Zdd	�Zd
d�Z�fdd
�Zdd�Z	�Z
S)�_SpecialGenericAliasTNrcs^|dur|j}t�j|||d�||_|jdkrBd|j�d�|_nd|j�d|j�d�|_dS)NrrjzA generic version of r`)rprr�rrmrnr�)r�r�nparamsrrr"r]r^r�6s
z_SpecialGenericAlias.__init__csBt|t�s|f}d�t�fdd�|D��}t|||j�|�|�S)Nr'c3s|]}t|��VqdSr�r�r�r�r]r^r�Eryz3_SpecialGenericAlias.__getitem__.<locals>.<genexpr>)rZr}r�rr�r0r]r�r^r�@s
z _SpecialGenericAlias.__getitem__cCst|j||j|jd�Sr/)rarbr�rr0r]r]r^r�Is�z_SpecialGenericAlias.copy_withcCs
d|jSr�r�r�r]r]r^r�Msz_SpecialGenericAlias.__repr__cs:t|t�rt|j|j�St|t�s.t||j�St��|�Sr�)rZr9rrbrarr�r�r"r]r^r�Ps


z&_SpecialGenericAlias.__subclasscheck__cCs|jSr�r�r�r]r]r^r�Wsz_SpecialGenericAlias.__reduce__)rprmrnr�r�r�r�r�r�r�r$r]r]r"r^r95s

r9cs$eZdZ�fdd�Zdd�Z�ZS)�_CallableGenericAliascsj|jdksJ�t|j�dkr4|jdtur4t���Sdd�dd�|jdd�D���d	t|jd��d
�S)Nr
�rztyping.Callable[[r1cSsg|]}t|��qSr]r2r�r]r]r^rxaryz2_CallableGenericAlias.__repr__.<locals>.<listcomp>���z], r4)r�r�r��Ellipsisrr�r5rrr�r"r]r^r�\s
��z_CallableGenericAlias.__repr__cCsD|j}t|�dkr|ddus6t|dd��|df}tjt|ffS)Nr<r.r=)r�r�r�r8r�r
�r�r�r]r]r^r�dsz _CallableGenericAlias.__reduce__)rprmrnr�r�r$r]r]r"r^r;[sr;c@s(eZdZdd�Zdd�Zedd��ZdS)�
_CallableTypecCst|j||j|jd�Sr/)r;rbr�rr0r]r]r^r�ls�z_CallableType.copy_withcCsPt|t�rt|�dkrtd��|\}}t|t�r>t|�|f}n||f}|�|�S)Nr<z6Callable must be used as Callable[[arg, ...], result].)rZr}r�rcr��__getitem_inner__)r�r�r�rr]r]r^r�ps
z_CallableType.__getitem__cCsb|\}}d}t||�}|tur,|�t|f�St|t�s<|f}tdd�|D��}||f}|�|�S)Nz.Callable[args, result]: result must be a type.css|]}t|�VqdSr�)r_)rtr\r]r]r^r��ryz2_CallableType.__getitem_inner__.<locals>.<genexpr>)rir>r�r%rZr})r�r�r�rrfr]r]r^rA~s


z_CallableType.__getitem_inner__N)rprmrnr�r�r�rAr]r]r]r^r@ksr@c@seZdZedd��ZdS)�
_TupleTypecs�|dkr|�tf�St|t�s$|f}t|�dkr\|ddur\d�t|d��}|�|tf�Sd�t�fdd	�|D��}|�|�S)
Nr]r<r�.z Tuple[t, ...]: t must be a type.rz*Tuple[t0, t1, ...]: each t must be a type.c3s|]}t|��VqdSr�r�r�r�r]r^r��ryz)_TupleType.__getitem__.<locals>.<genexpr>)r�r&rZr}r�rir%)r�r�r�r]r�r^r��s
z_TupleType.__getitem__N)rprmrnr�r�r]r]r]r^rB�srBcs4eZdZdd�Zdd�Zdd�Z�fdd�Z�ZS)	r�cCst|Sr�)rr0r]r]r^r��sz_UnionGenericAlias.copy_withcCs"t|t�stSt|j�t|j�kSr�)rZr�r�r�r�r�r]r]r^r��s
z_UnionGenericAlias.__eq__cCstt|j��Sr�)r��	frozensetr�r�r]r]r^r��sz_UnionGenericAlias.__hash__csd|j}t|�dkrZ|dtd�ur6dt|d��d�S|dtd�urZdt|d��d�St���S)Nr<rztyping.Optional[r�r4)r�r�rYrrrr�r?r"r]r^r��sz_UnionGenericAlias.__repr__)rprmrnr�r�r�r�r$r]r]r"r^r��sr�cCsdd�|D�S)Ncss|]}|t|�fVqdSr�)rYr�r]r]r^r��ryz'_value_and_type_iter.<locals>.<genexpr>r])r�r]r]r^r��sr�c@seZdZdd�Zdd�ZdS)r�cCs*t|t�stStt|j��tt|j��kSr�)rZr�r�r�r�r�r�r]r]r^r��s
z_LiteralGenericAlias.__eq__cCsttt|j���Sr�)r�rCr�r�r�r]r]r^r��sz_LiteralGenericAlias.__hash__N)rprmrnr�r�r]r]r]r^r��sr�cs4eZdZdZdZdZedd��Z�fdd�Z�Z	S)raCAbstract base class for generic types.

    A generic type is typically declared by inheriting from
    this class parameterized with one or more type variables.
    For example, a generic mapping type might be defined as::

      class Mapping(Generic[KT, VT]):
          def __getitem__(self, key: KT) -> VT:
              ...
          # Etc.

    This class can then be used as follows::

      def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT:
          try:
              return mapping[key]
          except KeyError:
              return default
    r]Fcs�t|t�s|f}|s.|tur.td|j�d���d�t�fdd�|D��}|ttfvr�tdd�|D��sxtd|j�d���t	t
|��t	|�kr�td|j�d	���nt||t	|j��t
||�S)
NzParameter list to z[...] cannot be emptyr'c3s|]}t|��VqdSr�r�r�r�r]r^r��ryz,Generic.__class_getitem__.<locals>.<genexpr>css|]}t|t�VqdSr�)rZrr�r]r]r^r��ryzParameters to z [...] must all be type variablesz[...] must all be unique)rZr}rrcrnrr�allrpr�r�r�r|ra)r�r�r]r�r^�__class_getitem__�s&
���zGeneric.__class_getitem__c
st�j|i|��g}d|jvr,t|jv}nt|jvo>|jdk}|rLtd��d|jv�rt|j�}d}|jD].}t	|t
�rl|jturl|dur�td��|j}ql|du�rt
|�}t
|��|�k�sd��fdd�|D��}d�dd�|D��}	td	|�d
|	�d���|}t|�|_dS)N�__orig_bases__rz!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.r1c3s|]}|�vrt|�VqdSr��r[rs��gvarsetr]r^r�ryz,Generic.__init_subclass__.<locals>.<genexpr>css|]}t|�VqdSr�rG)rt�gr]r]r^r�ryzSome type variables (z) are not listed in Generic[r4)rr�r�rrF�	__bases__rprcr~rZrarbr|r�r5r})
r�r�rrw�error�gvars�base�tvarset�s_vars�s_argsr"rHr^r��s<



��


�
zGeneric.__init_subclass__)
rprmrnr�r��_is_protocolr�rEr�r$r]r]r"r^r�s
rc@seZdZdZdS)r&z�Internal placeholder for () or []. Used by TupleMeta and CallableMeta
    to allow empty list/tuple in specific places, without allowing them
    to sneak in where prohibited.
    N�rprmrnr�r]r]r]r^r&sr&c@seZdZdZdS)r%z(Internal placeholder for ... (ellipsis).NrSr]r]r]r^r%sr%)r|rFrrR�_is_runtime_protocol)�__abstractmethods__�__annotations__r�r�r�rm�__new__r��__subclasshook__r�rE�_MutableMapping__markercCsrt�}|jdd�D]X}|jdvr$qt|di�}t|j���t|���D] }|�d�sJ|tvrJ|�	|�qJq|S)z�Collect protocol members from a protocol class objects.

    This includes names actually defined in the class dictionary, as well
    as names that appear in annotations. Special names (above) are skipped.
    Nr=)rrrV�_abc_)
r��__mro__rpr�r�r��keysr�EXCLUDED_ATTRIBUTES�add)r��attrsrN�annotationsr
r]r]r^�_get_protocol_attrs)s
racst�fdd�t��D��S)Nc3s|]}tt�|d��VqdSr�)rer��rtr
�r�r]r^r�<ryz,_is_callable_members_only.<locals>.<genexpr>)rDrarcr]rcr^�_is_callable_members_only:srdcOstt|�}|jrtd��|jtur$dS|jD]$}|j�dt�}|tur*||_qXq*tj|_|j|g|�Ri|��dS)Nz Protocols cannot be instantiatedr�)	rYrRrcr��_no_init_or_replace_initr[r�r��object)r�r�rr�rN�initr]r]r^re?s

rec	Cs4zt�d�jddvWSttfy.YdS0dS)z�Allow instance and class checks for special stdlib modules.

    The abc and functools modules indiscriminately call isinstance() and
    issubclass() on the whole MRO of a user class, which may contain protocols.
    �rp)�abcr�TN)r�rrrr�r]r]r]r^�_allow_reckless_class_cheks]srj)
r
r'rrr)rr%rr+r.�AbstractContextManager�AbstractAsyncContextManager)zcollections.abc�
contextlibcseZdZ�fdd�Z�ZS)�
_ProtocolMetacsVt�dd�rt��r$t�j��r$dS�jrJt��fdd�t��D��rJdSt����S)NrRFTc3s8|]0}t�|�o.tt�|d��p.t�|�duVqdSr�)�hasattrrer�rb�r��instancer]r^r�}s�
z2_ProtocolMeta.__instancecheck__.<locals>.<genexpr>)	r�rdrr#rRrDrarr�rpr"rpr^r�us�
��z_ProtocolMeta.__instancecheck__)rprmrnr�r$r]r]r"r^rnrsrncs,eZdZdZdZdZdZ�fdd�Z�ZS)raZBase class for protocol classes.

    Protocol classes are defined as::

        class Proto(Protocol):
            def meth(self) -> int:
                ...

    Such classes are primarily used with static type checkers that recognize
    structural subtyping (static duck-typing), for example::

        class C:
            def meth(self) -> int:
                return 0

        def func(x: Proto) -> int:
            return x.meth()

        func(C())  # Passes static type check

    See PEP 544 for details. Protocol classes decorated with
    @typing.runtime_checkable act as simple-minded runtime protocols that check
    only the presence of given attributes, ignoring their type signatures.
    Protocol classes can be generic, they are defined as::

        class GenProto(Protocol[T]):
            def meth(self) -> T:
                ...
    r]TFcs�t�j|i|���j�dd�s6tdd��jD���_�fdd�}d�jvrR|�_�js\dS�jD]F}|tt	fvsb|j
tvr�|jt|j
vsbt
|t	�r�|jsbtd|��qbt�_dS)	NrRFcss|]}|tuVqdSr�)r)rtrr]r]r^r��ryz-Protocol.__init_subclass__.<locals>.<genexpr>cs��j�dd�stSt�dd�s0t�r(tStd��t��sJt�rBtStd��t|t�s\td��t	��D]v}|j
D]b}||jvr�|j|dur�tSqdt|di�}t|tjj
�rn||vrnt|t�rn|jrnqdqntSqddS)	NrRFrTzLInstance and class checks can only be used with @runtime_checkable protocolsz<Protocols with non-method members don't support issubclass()z"issubclass() arg 1 must be a classrVT)r�r�r�r�rjrcrdrZrYrar[�collectionsrirrrrR)r�r
rNr`rcr]r^�_proto_hook�s:


���
z/Protocol.__init_subclass__.<locals>._proto_hookrXz7Protocols can only inherit from other protocols, got %r)rr�r�r��anyrKrRrXrfrrm�_PROTO_WHITELISTrprrcrer�)r�r�rrsrNr"rcr^r��s,&

�����zProtocol.__init_subclass__)	rprmrnr�r�rRrTr�r$r]r]r"r^r�s
r)�	metaclasscsHeZdZdZ�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	�Z
S)�_AnnotatedAliasa7Runtime representation of an annotated type.

    At its core 'Annotated[t, dec1, dec2, ...]' is an alias for the type 't'
    with extra annotations. The alias behaves like a normal typing alias,
    instantiating is the same as instantiating the underlying type, binding
    it to types is also the same.
    cs2t|t�r|j|}|j}t��||�||_dSr�)rZrw�__metadata__rbrr�)r�r�metadatar"r]r^r��s


z_AnnotatedAlias.__init__cCs$t|�dksJ�|d}t||j�Sr6)r�rwrx)r�r��new_typer]r]r^r��sz_AnnotatedAlias.copy_withcCs$d�t|j�d�dd�|jD���S)Nztyping.Annotated[{}, {}]r1css|]}t|�VqdSr�)rlr�r]r]r^r��ryz+_AnnotatedAlias.__repr__.<locals>.<genexpr>)�formatrrrbr5rxr�r]r]r^r��s�z_AnnotatedAlias.__repr__cCstjt|jf|jffSr�)r8r�rrbrxr�r]r]r^r�s�z_AnnotatedAlias.__reduce__cCs&t|t�stS|j|jko$|j|jkSr�)rZrwr�rbrxr�r]r]r^r�s


�z_AnnotatedAlias.__eq__cCst|j|jf�Sr�)r�rbrxr�r]r]r^r�
sz_AnnotatedAlias.__hash__)rprmrnr�r�r�r�r�r�r�r$r]r]r"r^rw�srwc@s0eZdZdZdZdd�Zedd��Zdd�Zd	S)
ra�Add context specific metadata to a type.

    Example: Annotated[int, runtime_check.Unsigned] indicates to the
    hypothetical runtime_check module that this type is an unsigned int.
    Every other consumer of this type can ignore this metadata and treat
    this type as int.

    The first argument to Annotated must be a valid type.

    Details:

    - It's an error to call `Annotated` with less than two arguments.
    - Nested Annotated are flattened::

        Annotated[Annotated[T, Ann1, Ann2], Ann3] == Annotated[T, Ann1, Ann2, Ann3]

    - Instantiating an annotated type is equivalent to instantiating the
    underlying type::

        Annotated[C, Ann1](5) == C(5)

    - Annotated can be used as a generic type alias::

        Optimized = Annotated[T, runtime.Optimize()]
        Optimized[int] == Annotated[int, runtime.Optimize()]

        OptimizedList = Annotated[List[T], runtime.Optimize()]
        OptimizedList[int] == Annotated[List[int], runtime.Optimize()]
    r]cOstd��dS)Nz&Type Annotated cannot be instantiated.r��r�r�rr]r]r^rW2szAnnotated.__new__cCsNt|t�rt|�dkrtd��d}t|d|dd�}t|dd��}t||�S)Nr<zUAnnotated[...] should be used with at least two arguments (a type and an annotation).z$Annotated[t, ...]: t must be a type.rTrUr�)rZr}r�rcrirw)r�r�rfrryr]r]r^rE5szAnnotated.__class_getitem__cOstd�|j���dS)NzCannot subclass {}.Annotated)rcr{rmr|r]r]r^r�@s
�zAnnotated.__init_subclass__N)	rprmrnr�r�rWr�rEr�r]r]r]r^rs

rcCs&t|t�r|jstd|��d|_|S)a9Mark a protocol class as a runtime protocol.

    Such protocol can be used with isinstance() and issubclass().
    Raise TypeError if applied to a non-protocol class.
    This allows a simple-minded structural check very similar to
    one trick ponies in collections.abc such as Iterable.
    For example::

        @runtime_checkable
        class Closable(Protocol):
            def close(self): ...

        assert isinstance(open('/some/file'), Closable)

    Warning: this will check only the presence of the required methods,
    not their type signatures!
    zB@runtime_checkable can be only applied to protocol classes, got %rT)rrrRrcrTrcr]r]r^rRFs�rRcCs|S)z�Cast a value to a type.

    This returns the value unchanged.  To the type checker this
    signals that the return value has the designated type, but at
    runtime we intentionally don't check anything (we want this
    to be as fast as possible).
    r])�typr!r]r]r^rH_srHc
Cs�z
|j}Wnty iYS0|j}|j}|d|�}|jpBd}|j}|rVt|�ni}|t|�}t||d�|�D]\}}	||vs�J�|	||<qx|S)z:Internal helper to extract the default arguments, by name.Nr])	�__code__r�co_argcount�co_varnames�__defaults__�__kwdefaults__r*r�r+)
r�r��	pos_count�	arg_names�defaults�
kwdefaultsr�
pos_offsetr�valuer]r]r^�
_get_defaultsjs



r�cCs�t|dd�riSt|t�r�i}t|j�D]|}|durDtj|jj}n|}|j�	di�}|�
�D]D\}}	|	durvtd�}	t|	t�r�t|	ddd�}	t
|	||�}	|	||<q^q(|r�|Sdd�|�
�D�S|du�rt|tj�r�|j}n"|}
t|
d	�r�|
j}
q�t|
d
i�}|du�r|}n|du�r|}t|dd�}|du�rRt|t��rDiStd�|���t|�}t|�}|�
�D]t\}}	|	du�r�td�}	t|	t��r�t|	t|tj�dd�}	t
|	||�}	||v�r�||du�r�t|	}	|	||<�qj|�r�|Sdd�|�
�D�S)
aReturn type hints for an object.

    This is often the same as obj.__annotations__, but it handles
    forward references encoded as string literals, adds Optional[t] if a
    default value equal to None is set and recursively replaces all
    'Annotated[T, ...]' with 'T' (unless 'include_extras=True').

    The argument may be a module, class, method, or function. The annotations
    are returned as a dictionary. For classes, annotations include also
    inherited members.

    TypeError is raised if the argument is not of a type that can contain
    annotations, and an empty dictionary is returned if no annotations are
    present.

    BEWARE -- the behavior of globalns and localns is counterintuitive
    (unless you are familiar with how eval() and exec() work).  The
    search order is locals first, then globals.

    - If no dict arguments are passed, an attempt is made to use the
      globals from obj (or the respective module's globals for classes),
      and these are also used as the locals.  If the object does not appear
      to have globals, an empty dictionary is used.

    - If one dict argument is passed, it is used for both globals and
      locals.

    - If two dict arguments are passed, they specify globals and
      locals, respectively.
    �__no_type_check__NrVFT)rgrXcSsi|]\}}|t|��qSr]��_strip_annotations�rt�krur]r]r^�
<dictcomp>�ryz"get_type_hints.<locals>.<dictcomp>�__wrapped__�__globals__z1{!r} is not a module, class, method, or function.cSsi|]\}}|t|��qSr]r�r�r]r]r^r��ry)r�rZrY�reversedr[r�r�rmr�r��itemsr[r
r�rk�
ModuleTyperor��_allowed_typesrcr{r�r*r)rqr�r��include_extras�hintsrN�base_globals�annrr��nsobjr�r]r]r^rL�sf 






�
�rLcCs�t|t�rt|j�St|t�rJtdd�|jD��}||jkr@|S|�|�St|t�r�tdd�|jD��}||jkrv|St|j|�S|S)z.Strips the annotations from a given type.
    css|]}t|�VqdSr�r�r�r]r]r^r��ryz%_strip_annotations.<locals>.<genexpr>css|]}t|�VqdSr�r�r�r]r]r^r��ry)	rZrwr�rbrar}r�r�r)ru�
stripped_argsr]r]r^r��s






r�cCs2t|t�rtSt|ttf�r"|jS|tur.tSdS)a�Get the unsubscripted version of a type.

    This supports generic types, Callable, Tuple, Union, Literal, Final, ClassVar
    and Annotated. Return None for unsupported types. Examples::

        get_origin(Literal[42]) is Literal
        get_origin(int) is None
        get_origin(ClassVar[int]) is ClassVar
        get_origin(Generic) is Generic
        get_origin(Generic[T]) is Generic
        get_origin(Union[T, int]) is Union
        get_origin(List[Tuple[T, T]][int]) == list
    N)rZrwrrrrbr)�tpr]r]r^rK�s
rKcCsft|t�r|jf|jSt|ttf�rb|j}|jtjj	ur^|dt
ur^t|dd��|df}|SdS)a�Get type arguments with all substitutions performed.

    For unions, basic simplifications used by Union constructor are performed.
    Examples::
        get_args(Dict[str, int]) == (str, int)
        get_args(int) == ()
        get_args(Union[int, Union[T, int], str][int]) == (int, str)
        get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int])
        get_args(Callable[[], T][int]) == ([], int)
    rNr=r])rZrwrbrxrarr�rrrir
r>r�)r�rr]r]r^rJ	s
rJcCs�t|t�rt|j��}|j��D]"\}}||j|fvr|�|�q|��D](}t|tj	�r`d|_
t|t�rJt|�qJz
d|_
Wnty�Yn0|S)aIDecorator to indicate that annotations are not type hints.

    The argument must be a class or function; if it is a class, it
    applies recursively to all methods and classes defined in that class
    (but not to methods defined in its superclasses or subclasses).

    This mutates the function(s) or class(es) in place.
    T)
rZrYr��copyr�rK�pop�valuesrkror�rNrc)r\�	arg_attrsr
r!rqr]r]r^rNs	




rNcst����fdd��}|S)z�Decorator to give another decorator the @no_type_check effect.

    This wraps the decorator with something that wraps the decorated
    function in @no_type_check.
    cs�|i|��}t|�}|Sr�)rN)r�r�r��r�r]r^�wrapped_decorator?sz2no_type_check_decorator.<locals>.wrapped_decorator)r�r�)r�r�r]r�r^rO8srOcOstd��dS)z*Helper for @overload to raise when called.z�You should not call an overloaded function. A series of @overload-decorated functions outside a stub module should always be followed by an implementation that is not @overload-ed.N)�NotImplementedErrorr�r]r]r^�_overload_dummyHs�r�cCstS)a
Decorator for overloaded functions/methods.

    In a stub file, place two or more stub definitions for the same
    function in a row, each decorated with @overload.  For example:

      @overload
      def utf8(value: None) -> None: ...
      @overload
      def utf8(value: bytes) -> bytes: ...
      @overload
      def utf8(value: str) -> bytes: ...

    In a non-stub file (i.e. a regular .py file), do the same but
    follow it with an implementation.  The implementation should *not*
    be decorated with @overload.  For example:

      @overload
      def utf8(value: None) -> None: ...
      @overload
      def utf8(value: bytes) -> bytes: ...
      @overload
      def utf8(value: str) -> bytes: ...
      def utf8(value):
          # implementation goes here
    )r�)r�r]r]r^rQQsrQcCs|S)aVA decorator to indicate final methods and final classes.

    Use this decorator to indicate to type checkers that the decorated
    method cannot be overridden, and decorated class cannot be subclassed.
    For example:

      class Base:
          @final
          def done(self) -> None:
              ...
      class Sub(Base):
          def done(self) -> None:  # Error reported by type checker
                ...

      @final
      class Leaf:
          ...
      class Other(Leaf):  # Error reported by type checker
          ...

    There is no runtime checking of these properties.
    r])�fr]r]r^rInsrI�T�KT�VT�T_co)r��V_co�VT_co�T_contra)r��CT_co)r�r�rGr�rhr<a�Callable type; Callable[[int], str] is a function of (int) -> str.

    The subscription syntax must always be used with exactly two
    values: the argument list and the return type.  The argument list
    must be a list of types or ellipsis; the return type must be a single type.

    There is no syntax to indicate optional or keyword arguments,
    such function types are rarely used as callback types.
    r)rr=rra@Tuple type; Tuple[X, Y] is the cross-product type of X and Y.

    Example: Tuple[T1, T2] is a tuple of two elements corresponding
    to type variables T1 and T2.  Tuple[int, float, str] is a tuple
    of an int, a float and a string.

    To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
    r;r8r=r>rr-r9r:ra�A special construct usable to annotate class objects.

    For example, suppose we have the following classes::

      class User: ...  # Abstract base for User classes
      class BasicUser(User): ...
      class ProUser(User): ...
      class TeamUser(User): ...

    And a function that takes a class argument that's a subclass of
    User and returns an instance of the corresponding class::

      U = TypeVar('U', bound=User)
      def new_user(user_class: Type[U]) -> U:
          user = user_class()
          # (Here we could write the user object to a database)
          return user

      joe = new_user(BasicUser)

    At this point the type checker knows that joe has type BasicUser.
    c@s&eZdZdZdZeed�dd��ZdS)r4z(An ABC with one abstract method __int__.r]��returncCsdSr�r]r�r]r]r^�__int__�szSupportsInt.__int__N)rprmrnr�r�r�intr�r]r]r]r^r4�sr4c@s&eZdZdZdZeed�dd��ZdS)r2z*An ABC with one abstract method __float__.r]r�cCsdSr�r]r�r]r]r^�	__float__�szSupportsFloat.__float__N)rprmrnr�r�r�floatr�r]r]r]r^r2�sr2c@s&eZdZdZdZeed�dd��ZdS)r1z,An ABC with one abstract method __complex__.r]r�cCsdSr�r]r�r]r]r^�__complex__	szSupportsComplex.__complex__N)rprmrnr�r�r�complexr�r]r]r]r^r1sr1c@s&eZdZdZdZeed�dd��ZdS)r0z*An ABC with one abstract method __bytes__.r]r�cCsdSr�r]r�r]r]r^�	__bytes__szSupportsBytes.__bytes__N)rprmrnr�r�r�bytesr�r]r]r]r^r0sr0c@s&eZdZdZdZeed�dd��ZdS)r3z*An ABC with one abstract method __index__.r]r�cCsdSr�r]r�r]r]r^�	__index__szSupportsIndex.__index__N)rprmrnr�r�rr�r�r]r]r]r^r3sr3c@s&eZdZdZdZeed�dd��ZdS)r/zMAn ABC with one abstract method __abs__ that is covariant in its return type.r]r�cCsdSr�r]r�r]r]r^�__abs__'szSupportsAbs.__abs__N)rprmrnr�r�rr�r�r]r]r]r^r/"sr/c@s*eZdZdZdZedeed�dd��ZdS)	r5zOAn ABC with one abstract method __round__ that is covariant in its return type.r]r)�ndigitsr�cCsdSr�r])r�r�r]r]r^�	__round__1szSupportsRound.__round__N)r)	rprmrnr�r�rr�r�r�r]r]r]r^r5,sr5r]cCs@dd�|D�}dd�|D�}tj||||d�}||_|j_|S)NcSsg|]\}}|�qSr]r]�rt�nrur]r]r^rx7ryz!_make_nmtuple.<locals>.<listcomp>cSs$i|]\}}|t|d|�d���qS)zfield z annotation must be a typer�r�r]r]r^r�8s�z!_make_nmtuple.<locals>.<dictcomp>�r�rW)rr�
namedtuplerVrW)rrkrWr��fields�nm_tplr]r]r^�
_make_nmtuple6s��r�>
r��_field_defaults�_sourcer��_asdict�_make�_fieldsrW�__getnewargs__�_replace>rprVrmc@seZdZdd�ZdS)�NamedTupleMetac	
s�|dtusJ���di�}g}|D]L}|�vr<|�|�q$|r$td|�dt|�dkrZdnd�dd	�|�����q$t||���fd
d�|D��dd
�}�D]<}|tvr�t	d|��q�|t
vr�||jvr�t||�|�q�|S)NrrVzNon-default namedtuple field z cannot follow default fieldr��s�� r1csg|]}�|�qSr]r])rtr���nsr]r^rxWryz*NamedTupleMeta.__new__.<locals>.<listcomp>rmr�z&Cannot overwrite NamedTuple attribute )
�_NamedTupler�rzrcr�r5r�r��_prohibitedr�_specialr�r )	r��typenamer�r�rk�
default_names�
field_namer��keyr]r�r^rWJs,
��

�zNamedTupleMeta.__new__N)rprmrnrWr]r]r]r^r�Hsr�c	Ks`|dur|��}n|rtd��zt�d�j�dd�}WnttfyPd}Yn0t|||d�S)a�Typed version of namedtuple.

    Usage in Python versions >= 3.6::

        class Employee(NamedTuple):
            name: str
            id: int

    This is equivalent to::

        Employee = collections.namedtuple('Employee', ['name', 'id'])

    The resulting class has an extra __annotations__ attribute, giving a
    dict that maps field names to types.  (The field names are also in
    the _fields attribute, which is part of the namedtuple API.)
    Alternative equivalent keyword syntax is also accepted::

        Employee = NamedTuple('Employee', name=str, id=int)

    In Python versions <= 3.5 use::

        Employee = NamedTuple('Employee', [('name', str), ('id', int)])
    NzIEither list of fields or keywords can be provided to NamedTuple, not bothr�rpr��rW)	r�rcr�rrr�rr�r�)r�r�rrWr]r]r^r?bs

r?cCs*t|�dkrtd��|dtus$J�tfS)Nr�z5Multiple inheritance with NamedTuple is not supportedr)r�rcr?r��r�r]r]r^�_namedtuple_mro_entries�sr�c@s&eZdZddd�ZeZdd�ZeZdS)�_TypedDictMetaTcs|D]}t|�turtd��qt�t|tf|��i}|�di�}t|���}d���fdd�|��D�}t�}	t�}
|D]@}|�	|j
�di��|	�	|j
�dd��|
�	|j
�dd��qx|�	|�|r�|	�	|�n
|
�	|�|�_t|	��_
t|
��_t�d	��s
|�_�S)
a5Create new typed dict class object.

        This method is called when TypedDict is subclassed,
        or when TypedDict is instantiated. This way
        TypedDict supports all three syntax forms described in its docstring.
        Subclasses and instances of TypedDict return actual dictionaries.
        zHcannot inherit from both a TypedDict type and a non-TypedDict base classrVz?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typecs"i|]\}}|t|��jd��qS)r�)rirm)rtr�r��rf�tp_dictr]r^r��s�z*_TypedDictMeta.__new__.<locals>.<dictcomp>�__required_keys__r]�__optional_keys__�	__total__)rYr�rcrWr*r�r�r\r��updater�rVrCr�r�ror�)r�rr�r��totalrNr`�own_annotations�own_annotation_keys�
required_keys�
optional_keysr]r�r^rW�s6
�



z_TypedDictMeta.__new__cCstd��dS)Nz4TypedDict does not support instance and class checksr�)r�r�r]r]r^r��sz _TypedDictMeta.__subclasscheck__N)T)rprmrnrWr*r�r�r�r]r]r]r^r��s
+r��r�c	Ksj|dur|}n|rtd��dt|�i}zt�d�j�dd�|d<WnttfyXYn0t|d||d	�S)
aSA simple typed namespace. At runtime it is equivalent to a plain dict.

    TypedDict creates a dictionary type that expects all of its
    instances to have a certain set of keys, where each key is
    associated with a value of a consistent type. This expectation
    is not checked at runtime but is only enforced by type checkers.
    Usage::

        class Point2D(TypedDict):
            x: int
            y: int
            label: str

        a: Point2D = {'x': 1, 'y': 2, 'label': 'good'}  # OK
        b: Point2D = {'z': 3, 'label': 'bad'}           # Fails type check

        assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')

    The type info can be accessed via the Point2D.__annotations__ dict, and
    the Point2D.__required_keys__ and Point2D.__optional_keys__ frozensets.
    TypedDict supports two additional equivalent forms::

        Point2D = TypedDict('Point2D', x=int, y=int, label=str)
        Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})

    By default, all keys must be present in a TypedDict. It is possible
    to override this by specifying totality.
    Usage::

        class point2D(TypedDict, total=False):
            x: int
            y: int

    This means that a point2D TypedDict can have any of the keys omitted.A type
    checker is only expected to support a literal False or True as the value of
    the total argument. True is the default, and makes all items defined in the
    class body be required.

    The class syntax is only supported in Python 3.6+, while two other
    syntax forms work for Python 2.7 and 3.2+
    Nz@TypedDict takes either a dict or keyword arguments, but not bothrVr�rpr�rmr]r�)	rcr*r�rrr�rr�r�)r�r�r�rr�r]r]r^r@�s*r@cCstfSr�)�
_TypedDictr�r]r]r^�<lambda>�ryr�cCsdd�}||_||_|S)a%NewType creates simple unique types with almost zero
    runtime overhead. NewType(name, tp) is considered a subtype of tp
    by static type checkers. At runtime, NewType(name, tp) returns
    a dummy function that simply returns its argument. Usage::

        UserId = NewType('UserId', int)

        def name_by_id(user_id: UserId) -> str:
            ...

        UserId('user')          # Fails type check

        name_by_id(42)          # Fails type check
        name_by_id(UserId(42))  # OK

        num = UserId(5) + 1     # type: int
    cSs|Sr�r])r(r]r]r^rzszNewType.<locals>.new_type)rp�
__supertype__)rr�rzr]r]r^rMsrMc@s�eZdZdZdZeeed�dd���Zeeed�dd���Z	edd�d	d
��Z
eeed�dd���Zee
d�d
d��Zedd�dd��Zeed�dd��Zed7e
ed�dd��Zeed�dd��Zed8e
ed�dd��Zed9e
eed�dd��Zed:e
e
e
d �d!d"��Zeed�d#d$��Zee
d�d%d&��Zed;e
e
d'�d(d)��Zeed�d*d+��Zeee
d,�d-d.��Zeeedd/�d0d1��Zed2d�d3d4��Zedd�d5d6��ZdS)<rCa�Generic base class for TextIO and BinaryIO.

    This is an abstract, generic version of the return of open().

    NOTE: This does not distinguish between the different possible
    classes (text vs. binary, read vs. write vs. read/write,
    append-only, unbuffered).  The TextIO and BinaryIO subclasses
    below capture the distinctions between text vs. binary, which is
    pervasive in the interface; however we currently do not offer a
    way to track the other distinctions in the type system.
    r]r�cCsdSr�r]r�r]r]r^�mode4szIO.modecCsdSr�r]r�r]r]r^r9szIO.nameNcCsdSr�r]r�r]r]r^�close>szIO.closecCsdSr�r]r�r]r]r^�closedBsz	IO.closedcCsdSr�r]r�r]r]r^�filenoGsz	IO.filenocCsdSr�r]r�r]r]r^�flushKszIO.flushcCsdSr�r]r�r]r]r^�isattyOsz	IO.isattyr=)r�r�cCsdSr�r])r�r�r]r]r^�readSszIO.readcCsdSr�r]r�r]r]r^�readableWszIO.readable)�limitr�cCsdSr�r])r�r�r]r]r^�readline[szIO.readline)�hintr�cCsdSr�r])r�r�r]r]r^�	readlines_szIO.readlinesr)�offset�whencer�cCsdSr�r])r�r�r�r]r]r^�seekcszIO.seekcCsdSr�r]r�r]r]r^�seekablegszIO.seekablecCsdSr�r]r�r]r]r^�tellkszIO.tell)�sizer�cCsdSr�r])r�r�r]r]r^�truncateoszIO.truncatecCsdSr�r]r�r]r]r^�writablesszIO.writable�r�r�cCsdSr�r]�r�r�r]r]r^�writewszIO.write)�linesr�cCsdSr�r])r�rr]r]r^�
writelines{sz
IO.writelinesz
IO[AnyStr]cCsdSr�r]r�r]r]r^�	__enter__szIO.__enter__cCsdSr�r])r�rYr��	tracebackr]r]r^�__exit__�szIO.__exit__)r=)r=)r=)r)N) rprmrnr�r��propertyrr[r�rr�r�r�r�r�r�r�rGr�r�r�r;r�r�r�r�r�r�rrrrr]r]r]r^rC%sZrCc@sBeZdZdZdZeeeefe	d�dd��Z
edd�dd��Zd	S)
rBz5Typed version of the return of open() in binary mode.r]r�cCsdSr�r]r�r]r]r^r�szBinaryIO.writer�cCsdSr�r]r�r]r]r^r�szBinaryIO.__enter__N)rprmrnr�r�rrr��	bytearrayr�rrr]r]r]r^rB�srBc@s�eZdZdZdZeeed�dd���Zeee	d�dd���Z
eeee	d�dd	���Zeee
d�d
d���Zeeed�dd
���Zedd�dd��ZdS)rFz3Typed version of the return of open() in text mode.r]r�cCsdSr�r]r�r]r]r^�buffer�sz
TextIO.buffercCsdSr�r]r�r]r]r^�encoding�szTextIO.encodingcCsdSr�r]r�r]r]r^�errors�sz
TextIO.errorscCsdSr�r]r�r]r]r^�line_buffering�szTextIO.line_bufferingcCsdSr�r]r�r]r]r^�newlines�szTextIO.newlinescCsdSr�r]r�r]r]r^r�szTextIO.__enter__N)rprmrnr�r�rrrBrr[r	rr
r�rr	rrr]r]r]r^rF�s&rFc@s$eZdZdZgd�ZeZeZeZdS)�ioz)Wrapper namespace for IO generic classes.)rCrFrBN)rprmrnr��__all__rCrFrBr]r]r]r^r
�s
r
z.ioc@s eZdZdZddgZeZeZdS)�rez&Wrapper namespace for re type aliases.rErDN)rprmrnr�rrErDr]r]r]r^r�srz.re)N)TN)N)NNF)r])N)N)�r�rirrrr�collections.abcrmr�r8r�	stdlib_rer�rkrrrrrr_rirrr~r�r�r�r�r�r�rCr�r�r�rdr�r	rPrrrrrr
rrrrar9r;r@rBr�r�r�rr&r%�_TYPING_INTERNALS�_SPECIAL_NAMESr]rardrerjrurnrrwrrRrHr�ro�BuiltinFunctionType�
MethodTyper�r�rLr�rKrJrNrOr�rQrIr�r�r�r�r�r�r�rYr�r�r[rG�_aliasrr'r*r)r(rrr.r%rr+r
r=rr#rr!r$r"rr}rr�r;�dequer8r�r>r rrr&rkrrlr-r*r9�defaultdictr:r<r7r6rAr,rr4r2r1r0r3r/r5r�r�r�r�r?rWr�r�r�r�r@r�rMrSrTrCrBrFr
rpr�rErDr]r]r]r^�<module>sh`	!	






%
!ATFS&!Q
�	b)5�
]	�
�	�							

#59
c#