Your IP : 18.218.1.38


Current Path : /proc/self/root/opt/alt/python37/lib64/python3.7/__pycache__/
Upload File :
Current File : //proc/self/root/opt/alt/python37/lib64/python3.7/__pycache__/typing.cpython-37.opt-2.pyc

B

YI~dv��>@s�ddlZddlmZmZddlZddlZddlZddlZddlZddlZ	ddl
Z
ddlZddlmZm
Z
mZdddddd	d
ddd
ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;d<d=d>d?d@dAg>Zd�dCdD�ZdEdF�ZdGdH�ZdIdJ�ZdKdL�ZdMdN�ZgZdOdP�ZdQdR�ZGdSdT�dT�ZGdUdV�dV�ZGdWdX�dXeedBdY�ZeddZd[�Zed>d\d[�Zedd]d[�Zed
d^d[�Zed	d_d[�Z Gd`d�dedBdY�Z!Gdad�deedBdY�Z"d2d
d0d4d5d/d1dddb�	Z#dcdd�Z$Gdedf�dfedBdY�Z%Gdgdh�dhe%dBdY�Z&Gdid�d�Z'Gdjdk�dk�Z(Gdldm�dm�Z)dnd9�Z*dodp�Z+ej,ej-ej.ej/ee
efZ0d�dqd:�Z1drd<�Z2dsd=�Z3dtdu�Z4dvd?�Z5Gdwdx�dxe6�Z7Gdydz�dze'e7d{�Z8e"d|�Z9e"d}�Z:e"d~�Z;e"ddBd��Z<e"d�dBd��Z=e"d�dBd��Z>e"d�dBd��Z?e"d�dBe6d��Z@e"d8eAeB�ZCd�d�d��ZDeDejjEd��ZEeDejjFe<�ZFeDejjGe<e?e=f�ZGeDejjHe<�ZHeDejjIe<�ZIeDejjJe<�ZJeDejjKe<�ZKeDejjLe<�ZLeDejjMd��ZMeDejjNe<�ZNeDejjOe<�ZOe&ejjPd�dBd��ZPd�eP_QeDejjRe<�ZSeDejjTe9�ZTeDejjUe:e>f�ZUeDejjVe:e;f�ZVeDejjWe<�ZWeDejjXe9�ZXeDejjYd��ZYe&eZd�d�dBd��Z[d�e[_QeDe\e9d�d��Z]eDej^e9�Z_eDe`e9d�d��ZReDeae<d�d��ZbeDejjce<�ZceDejjde:�ZdeDejjee:e>f�ZeeDejjfe>�ZfeDejge<�ZheDejie<�ZjeDeke:e;fd�d��ZleDejme:e;f�ZneDejoe:e;f�ZoeDejpe9�ZpeDejqe:e;f�ZqeDejjre<e?e=f�ZreDejjse<e?f�ZseDe6e@d�d��Ztd�et_QGd�d+�d+e8�ZuGd�d*�d*e8�ZvGd�d)�d)e8�ZwGd�d(�d(e8�ZxGd�d'�d'e8e<�ZyGd�d,�d,e8e<�Zzd�d��Z{d�Z|d�Z}Gd�d��d�e6�Z~Gd�d6�d6e~d{�Zd�d;�Z�eBZ�d�Z�Gd�d��d�e'eC�Z�Gd�d��d�e�eA�Z�Gd�d��d�e�eB�Z�Gd�d��d��Z�e�d�e�_�e�e
j�e�j�<eDe	j�eC�Z�eDe	j�eC�Z�Gd�d��d��Ze�d�e_�ee
j�ej�<dS)��N)�abstractmethod�abstractproperty)�WrapperDescriptorType�MethodWrapperType�MethodDescriptorType�Any�Callable�ClassVar�
ForwardRef�Generic�Optional�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�SupportsInt�
SupportsRound�ChainMap�Counter�Deque�Dict�DefaultDict�List�OrderedDict�Set�	FrozenSet�
NamedTuple�	Generator�AnyStr�cast�get_type_hints�NewType�
no_type_check�no_type_check_decorator�NoReturn�overload�Text�
TYPE_CHECKINGTcCs�ttf}|r|tf}|dkr&td�St|t�r8t|�St|t�rZ|j|krZt	|�d���t|t
�rp|ttfks||ttfkr�t	d|�d���t|tt
tf�r�|St|�s�t	|�d|d�d���|S)Nz is not valid as type argumentzPlain z Got z.100�.)r�	_Protocolr	�type�
isinstance�strr
�
_GenericAlias�
__origin__�	TypeError�_SpecialFormrrAr�callable)�arg�msg�is_argumentZinvalid_generic_forms�rR�+/opt/alt/python37/lib64/python3.7/typing.py�_type_checkqs$



rTcCsRt|t�r,|jdkr|jS|j�d|j��S|dkr8dSt|tj�rJ|jSt|�S)N�builtinsrE.z...)rHrG�
__module__�__qualname__�types�FunctionType�__name__�repr)�objrRrRrS�
_type_repr�s

r]cs`g�xR|D]J}t|t�r*|�kr*��|�t|t�r
|js
���fdd�|jD��q
Wt��S)Ncsg|]}|�kr|�qSrRrR)�.0�t)�tvarsrRrS�
<listcomp>�sz&_collect_type_vars.<locals>.<listcomp>)rHr�appendrJ�_special�extend�__parameters__�tuple)rXr_rR)r`rS�_collect_type_vars�s

rgcCs�t|t�s|St|j�}x\t|j�D]N\}}t|t�rbx:t|�D]\}}||kr@||||<q@Wq$t|||�||<q$W|jtkr�tt	|�S|�
t	|��S)N)rHrJ�list�__args__�	enumerater�_subs_tvarsrKrrf�	copy_with)�tpr`ZsubsZnew_args�arO�iZtvarrRrRrSrk�s



rkc	Cs^|jst|�d���t|�}t|j�}||krZtd||kr>dnd�d|�d|�d|����dS)Nz is not a generic classzToo ZmanyZfewz parameters for z	; actual z, expected )rerL�len)�cls�
parametersZalenZelenrRrRrS�_check_generic�s
rscCs�g}xn|D]f}t|t�r0|jtkr0|�|j�q
t|t�rft|�dkrf|dtkrf|�|dd��q
|�|�q
Wt	|�}t|�t|�kr�g}x(|D] }||kr�|�|�|�
|�q�W|}t|�S)Nr�)rHrJrKrrdrirfrprb�set�remove)rr�params�pZ
all_paramsZ
new_paramsr_rRrRrS�_remove_dups_flatten�s 
"

rycs4t�����t��j�t�����fdd��}|S)Ncs*y
�||�Stk
rYnX�||�S)N)rL)�args�kwds)�cached�funcrRrS�inner�s

z_tp_cache.<locals>.inner)�	functools�	lru_cache�	_cleanupsrb�cache_clear�wraps)r}r~rR)r|r}rS�	_tp_cache�sr�csbt|t�r|����St|t�r^t��fdd�|jD��}||jkrH|S|�|�}|j|_|S|S)Nc3s|]}t|���VqdS)N)�
_eval_type)r^rn)�globalns�localnsrRrS�	<genexpr>	sz_eval_type.<locals>.<genexpr>)rHr
�	_evaluaterJrfrirlrc)r_r�r�Zev_args�resrR)r�r�rSr�s



r�c@seZdZdZdd�ZdS)�_Final)�__weakref__cOsd|krtd��dS)N�_rootz&Cannot subclass special typing classes)rL)�selfrzr{rRrRrS�__init_subclass__sz_Final.__init_subclass__N)rZrVrW�	__slots__r�rRrRrRrSr�sr�c@seZdZdd�Zdd�ZdS)�
_ImmutablecCs|S)NrR)r�rRrRrS�__copy__sz_Immutable.__copy__cCs|S)NrR)r�ZmemorRrRrS�__deepcopy__!sz_Immutable.__deepcopy__N)rZrVrWr�r�rRrRrRrSr�sr�csleZdZdZ�fdd�Zdd�Zdd�Zdd	�Zd
d�Zdd
�Z	dd�Z
dd�Zdd�Ze
dd��Z�ZS)rM)�_name�_doccsBt|�dkr6t|dt�r6t|dt�r6td|����t��|�S)N�rrtzCannot subclass )rprHrIrfrL�super�__new__)rqrzr{)�	__class__rRrSr�,s
z_SpecialForm.__new__cCs||_||_dS)N)r�r�)r��name�docrRrRrS�__init__9sz_SpecialForm.__init__cCst|t�stS|j|jkS)N)rHrM�NotImplementedr�)r��otherrRrRrS�__eq__=s
z_SpecialForm.__eq__cCst|jf�S)N)�hashr�)r�rRrRrS�__hash__Bsz_SpecialForm.__hash__cCs
d|jS)Nztyping.)r�)r�rRrRrS�__repr__Esz_SpecialForm.__repr__cCs|jS)N)r�)r�rRrRrS�
__reduce__Hsz_SpecialForm.__reduce__cOstd|����dS)NzCannot instantiate )rL)r�rzr{rRrRrS�__call__Ksz_SpecialForm.__call__cCst|�d���dS)Nz! cannot be used with isinstance())rL)r�r\rRrRrS�__instancecheck__Nsz_SpecialForm.__instancecheck__cCst|�d���dS)Nz! cannot be used with issubclass())rL)r�rqrRrRrS�__subclasscheck__Qsz_SpecialForm.__subclasscheck__cs�|jdkr t|d�}t||f�S|jdkr�|dkr:td��t|t�sJ|f}d�t�fdd�|D��}t|�}t|�d	kr�|d
St||�S|jdkr�t|d�}t|t	d�fSt|�d
���dS)Nr	z"ClassVar accepts only single type.rrRz Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.c3s|]}t|��VqdS)N)rT)r^rx)rPrRrSr�_sz+_SpecialForm.__getitem__.<locals>.<genexpr>rtrrz#Optional[t] requires a single type.z is not subscriptable)
r�rTrJrLrHrfryrprrG)r�rr�itemrOrR)rPrS�__getitem__Ts$






z_SpecialForm.__getitem__)rZrVrWr�r�r�r�r�r�r�r�r�r�r�r��
__classcell__rRrR)r�rSrM%s
rM)r�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.
    )r�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.
    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().
    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].
    zEOptional type.

    Optional[X] is equivalent to Union[X, None].
    c@s:eZdZdZddd�Zdd�Zdd�Zd	d
�Zdd�Zd
S)r
)�__forward_arg__�__forward_code__�__forward_evaluated__�__forward_value__�__forward_is_argument__TcCsnt|t�std|����yt|dd�}Wn"tk
rJtd|����YnX||_||_d|_d|_||_	dS)Nz*Forward reference must be a string -- got z<string>�evalz/Forward reference must be an expression -- got F)
rHrIrL�compile�SyntaxErrorr�r�r�r�r�)r�rOrQ�coderRrRrSr��s
zForwardRef.__init__cCsj|jr||k	rd|dkr(|dkr(i}}n|dkr6|}n|dkrB|}tt|j||�d|jd�|_d|_|jS)Nz*Forward references must evaluate to types.)rQT)r�rTr�r�r�r�)r�r�r�rRrRrSr��s
zForwardRef._evaluatecCs>t|t�stS|jr2|jr2|j|jko0|j|jkS|j|jkS)N)rHr
r�r�r�r�)r�r�rRrRrSr��s
zForwardRef.__eq__cCs
t|j�S)N)r�r�)r�rRrRrSr��szForwardRef.__hash__cCsd|j�d�S)NzForwardRef(�))r�)r�rRrRrSr��szForwardRef.__repr__N)T)	rZrVrWr�r�r�r�r�r�rRrRrRrSr
�s

c@s2eZdZdZdddd�dd�Zdd�Zd	d
�ZdS)r)rZ�	__bound__�__constraints__�
__covariant__�__contravariant__NF)�bound�	covariant�
contravariantc	s�||_|r|rtd��t|�|_t|�|_|r>|dk	r>td��|rVt|�dkrVtd��d�t�fdd�|D��|_|r�t	|d�|_
nd|_
yt�d�j
�d	d
�}Wnttfk
r�d}YnX|dkr�||_dS)Nz"Bivariant types are not supported.z-Constraints cannot be combined with bound=...rtz"A single constraint is not allowedz:TypeVar(name, constraint, ...): constraints must be types.c3s|]}t|��VqdS)N)rT)r^r_)rPrRrSr�#sz#TypeVar.__init__.<locals>.<genexpr>zBound must be a type.rZ�__main__�typing)rZ�
ValueError�boolr�r�rLrprfr�rTr��sys�	_getframe�	f_globals�get�AttributeErrorrV)r�r�r�r�r�ZconstraintsZdef_modrR)rPrSr�s(


zTypeVar.__init__cCs&|jrd}n|jrd}nd}||jS)N�+�-�~)r�r�rZ)r��prefixrRrRrSr�/szTypeVar.__repr__cCs|jS)N)rZ)r�rRrRrSr�8szTypeVar.__reduce__)rZrVrWr�r�r�r�rRrRrRrSr�s
,	)	rhrf�dictru�	frozenset�deque�defaultdictrGr7cCs|�d�o|�d�S)N�__)�
startswith�endswith)�attrrRrRrS�
_is_dunderSsr�cs�eZdZdddd�dd�Zedd��Zd	d
�Zdd�Zd
d�Zdd�Z	dd�Z
dd�Zdd�Z�fdd�Z
dd�Zdd�Zdd�Z�ZS)rJTFN)�inst�specialr�cCsz||_||_|r*|dkr*|j}t�||�}||_t|t�s@|f}||_tdd�|D��|_	t
|�|_d|_|sv|j
|_
dS)Ncss*|]"}|tkrdn|tkrdn|VqdS).rRN)�_TypingEllipsis�_TypingEmpty)r^rnrRrRrSr�jsz)_GenericAlias.__init__.<locals>.<genexpr>)�_instrcrZ�_normalize_aliasr�r�rHrfrKrirgrer�rV)r��originrwr�r�r�Z	orig_namerRrRrSr�`s

z_GenericAlias.__init__cs^|jttfkrtd|����t|t�s,|f}d�t�fdd�|D��}t||�t||j|�S)Nz%Cannot subscript already-subscripted z*Parameters to generic types must be types.c3s|]}t|��VqdS)N)rT)r^rx)rPrRrSr�zsz,_GenericAlias.__getitem__.<locals>.<genexpr>)	rKrrFrLrHrfrsrkre)r�rwrR)rPrSr�rs

z_GenericAlias.__getitem__cCst|j||j|jd�S)N)r�r�)rJrKr�r�)r�rwrRrRrSrl~sz_GenericAlias.copy_withcCs�|jdks&t|j�dkrx|jdtkrx|jr8d|j}n
t|j�}|jshdd�dd�|jD���d	�}nd
}|�|��S|jr�dSdd�d
d�|jdd�D���dt|jd��d	�S)Nr�rztyping.�[z, cSsg|]}t|��qSrR)r])r^rnrRrRrSra�sz*_GenericAlias.__repr__.<locals>.<listcomp>�]�ztyping.Callableztyping.Callable[[cSsg|]}t|��qSrR)r])r^rnrRrRrSra�s���z], )r�rpri�Ellipsisr]rKrc�join)r�r�rzrRrRrSr��s

 z_GenericAlias.__repr__cCsRt|t�stS|j|jkrdS|jtkrF|jtkrFt|j�t|j�kS|j|jkS)NF)rHrJr�rKrr�ri)r�r�rRrRrSr��s
z_GenericAlias.__eq__cCs,|jtkrttt|j�f�St|j|jf�S)N)rKrr�r�ri)r�rRrRrSr��s
z_GenericAlias.__hash__cOsT|js$td|j�d|j���d���|j||�}y
||_Wntk
rNYnX|S)NzType z cannot be instantiated; use z
() instead)r�rLr��lowerrKZ__orig_class__r�)r�rz�kwargs�resultrRrRrSr��s
z_GenericAlias.__call__cCs�|jrZg}|j|kr |�|j�|�|�}tdd�||dd�D��sR|�t�t|�S|jtkr�|�|�}x.||dd�D]}t|t�r�||k	r�dSq�W|jfS)Ncss"|]}t|t�pt|t�VqdS)N)rHrJ�
issubclassr)r^�brRrRrSr��sz0_GenericAlias.__mro_entries__.<locals>.<genexpr>rtrR)	r�rKrb�index�anyrrfrHrJ)r��basesr�ror�rRrRrS�__mro_entries__�s




z_GenericAlias.__mro_entries__cCs*d|jkrt|�st|j|�St|��dS)NrK)�__dict__r��getattrrKr�)r�r�rRrRrS�__getattr__�sz_GenericAlias.__getattr__cs2t|�s|dkr t��||�nt|j||�dS)N)r�r�rc)r�r��__setattr__�setattrrK)r�r��val)r�rRrSr��sz_GenericAlias.__setattr__cCs|�t|��S)N)r�rG)r�r\rRrRrSr��sz_GenericAlias.__instancecheck__cCs<|jr0t|t�st||j�S|jr0t|j|j�Std��dS)NzBSubscripted generics cannot be used with class and instance checks)rcrHrJr�rKrL)r�rqrRrRrSr��s
z_GenericAlias.__subclasscheck__cCs�|jr|jS|jr t�|j}n|j}|tkrht|j�dkrJ|jdtksht|jdd��|jdf}n*t	|j�}t|�dkr�t
|dt	�s�|\}tj||ffS)Nr�rr�rt)
rcr��globalsrKrrprir�rhrfrH�operator�getitem)r�r�rzrRrRrSr��s
z_GenericAlias.__reduce__)rZrVrWr�r�r�rlr�r�r�r�r�r�r�r�r�r�r�rRrR)r�rSrJWs			rJcs(eZdZdd�Ze�fdd��Z�ZS)�_VariadicGenericAliascCs�|jdks|js|�|�St|t�r0t|�dkr8td��|\}}|tkrRt|f}n$t|t�sjtd|����t|�|f}|�|�S)Nrr�z6Callable must be used as Callable[[arg, ...], result].z1Callable[args, result]: args must be a list. Got )	r�rc�__getitem_inner__rHrfrprLr�rh)r�rwrzr�rRrRrSr��s


z!_VariadicGenericAlias.__getitem__cs
|jtkr�|jr�|dkr$|�tf�St|t�s4|f}t|�dkrl|ddkrld�t|d��}|�|tf�Sd�t�fdd	�|D��}|�|�S|jt	j
jkr�|jr�|\}}d
�t|��}|tkr�|�t|f�Sd�t�fdd	�|D��}||f}|�|�St
��|�S)
NrRr�rt.z Tuple[t, ...]: t must be a type.rz*Tuple[t0, t1, ...]: each t must be a type.c3s|]}t|��VqdS)N)rT)r^rx)rPrRrSr�	sz:_VariadicGenericAlias.__getitem_inner__.<locals>.<genexpr>z.Callable[args, result]: result must be a type.z6Callable[[arg, ...], result]: each arg must be a type.c3s|]}t|��VqdS)N)rT)r^rO)rPrRrSr�s)rKrfrcrlr�rHrprTr��collections�abcrr�r�r�)r�rwrxrzr�)r�)rPrSr��s.




z'_VariadicGenericAlias.__getitem_inner__)rZrVrWr�r�r�r�rRrR)r�rSr��sr�cs8eZdZdZ�fdd�Zedd��Z�fdd�Z�ZS)rrRcsP|tkrtd��t�jtjkr8|jtjk	r8t��|�}nt�j|f|�|�}|S)NzHType Generic cannot be instantiated; it can be used only as a base class)rrLr�r��objectr�)rqrzr{r\)r�rRrSr�.szGeneric.__new__cs�t|t�s|f}|s.|tk	r.td|j�d���d�t�fdd�|D��}|tkr�tdd�|D��sjtd��tt|��t|�kr�td��n|t	kr�n
t
||�t||�S)	NzParameter list to z[...] cannot be emptyz*Parameters to generic types must be types.c3s|]}t|��VqdS)N)rT)r^rx)rPrRrSr�@sz,Generic.__class_getitem__.<locals>.<genexpr>css|]}t|t�VqdS)N)rHr)r^rxrRrRrSr�Csz5Parameters to Generic[...] must all be type variablesz-Parameters to Generic[...] must all be unique)rHrfr
rLrWr�allrprurFrsrJ)rqrwrR)rPrS�__class_getitem__8s$

zGeneric.__class_getitem__c
st�j||�g}d|jkr(t|jk}nt|jko:|jdk}|rHtd��d|jk�r
t|j�}d}x8|jD].}t	|t
�rj|jtkrj|dk	r�td��|j}qjW|dkr�|}n`t
|�}t
|��|�k�sd��fdd�|D��}d�dd�|D��}	td	|�d
|	�d���|}t|�|_dS)N�__orig_bases__rFz!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.z, c3s|]}|�krt|�VqdS)N)rI)r^r_)�gvarsetrRrSr�osz,Generic.__init_subclass__.<locals>.<genexpr>css|]}t|�VqdS)N)rI)r^�grRrRrSr�pszSome type variables (z) are not listed in Generic[r�)r�r�r�rr��	__bases__rZrLrgrHrJrKrerur�rf)
rqrzr�r`�errorZgvars�baseZtvarsetZs_varsZs_args)r�)r�rSr�Qs6





zGeneric.__init_subclass__)	rZrVrWr�r�r�r�r�r�rRrR)r�rSrs
c@seZdZdS)r�N)rZrVrWrRrRrRrSr�wsr�c@seZdZdS)r�N)rZrVrWrRrRrRrSr�~sr�cCs|S)NrR)�typr�rRrRrSr<�sc
Cs�y
|j}Wntk
riSX|j}|j}|d|�}|jp@d}|j}|rTt|�ni}|t|�}x&t||d�|�D]\}}	|	||<qxW|S)NrR)	�__code__r��co_argcount�co_varnames�__defaults__�__kwdefaults__r�rp�zip)
r}r�Z	pos_countZ	arg_names�defaultsZ
kwdefaultsr�Z
pos_offsetr��valuerRrRrS�
_get_defaults�s

rcCs�t|dd�riSt|t�r�i}x�t|j�D]~}|dkrFtj|jj}n|}|j�	di�}xN|�
�D]B\}}|dkrztd�}t|t�r�t|dd�}t
|||�}|||<qbWq*W|S|dk�rt|tj�r�|j}n&|}	xt|	d�r�|	j}	q�Wt|	di�}|dk�r|}n|dk�r|}t|dd�}|dk�rFt|t��r8iStd�|���t|�}
t|�}xp|�
�D]d\}}|dk�rztd�}t|t��r�t|�}t
|||�}||
k�r�|
|dk�r�t|}|||<�q`W|S)N�__no_type_check__�__annotations__F)rQ�__wrapped__�__globals__z1{!r} is not a module, class, method, or function.)r�rHrG�reversed�__mro__r��modulesrVr�r��itemsrIr
r�rX�
ModuleType�hasattrr
�_allowed_typesrL�formatrr�r)r\r�r�Zhintsr�Zbase_globals�annr�rZnsobjrrRrRrSr=�s\







cCs�t|t�r||j��}x0|j��D]"\}}||j|fkr |�|�q Wx4|��D](}t|tj	�rfd|_
t|t�rPt|�qPWy
d|_
Wntk
r�YnX|S)NT)
rHrGr��copyrr��pop�valuesrXrYrr?rL)rOZ	arg_attrsr�r�r\rRrRrSr?�s	



cst����fdd��}|S)Ncs�||�}t|�}|S)N)r?)rzr{r})�	decoratorrRrS�wrapped_decorators
z2no_type_check_decorator.<locals>.wrapped_decorator)rr�)rrrR)rrSr@scOstd��dS)Nz�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.)�NotImplementedError)rzr{rRrRrS�_overload_dummy&srcCstS)N)r)r}rRrRrSrB/scs,eZdZ�fdd�Zdd�Zdd�Z�ZS)�
_ProtocolMetacs"t|jkrt��|�Std��dS)Nz+Protocols cannot be used with isinstance().)rFr�r�r�rL)r�r\)r�rRrSr�Ss
z_ProtocolMeta.__instancecheck__csL|js
tS|tkrdS|��}x(|D] �t�fdd�|jD��s$dSq$WdS)NTc3s|]}�|jkVqdS)N)r�)r^�d)r�rRrSr�esz2_ProtocolMeta.__subclasscheck__.<locals>.<genexpr>F)�_is_protocolr�rF�_get_protocol_attrsr�r
)r�rq�attrsrR)r�rSr�Xs
z_ProtocolMeta.__subclasscheck__cCs&g}x.|jD]$}t|dd�r|jdkr|�|�qWt�}�x�|D]�}x�|j��D]�}x�|jD]$}||k	r^||jkr^t|dd�s^Pq^W|�d�sR|dkrR|dkrR|dkrR|dkrR|dkrR|d	krR|d
krR|dkrR|dkrR|d
krR|dkrR|dkrR|dkrR|dkrR|dkrR|dkrR|�|�qRWqBW|S)NrFrFZ_abc_�__abstractmethods__r	r�Z_gorgr�rir�rZ__next_in_mro__rerKr�Z	__extra__Z
__tree_hash__rV)	r
r�rZrbrur��keysr��add)r�Zprotocol_bases�cr r�r�rRrRrSris<
z!_ProtocolMeta._get_protocol_attrs)rZrVrWr�r�rr�rRrR)r�rSrLsrcs$eZdZdZdZ�fdd�Z�ZS)rFrRTcst��|�S)N)r�r�)rqrw)r�rRrSr��sz_Protocol.__class_getitem__)rZrVrWr�rr�r�rRrR)r�rSrF�srF)�	metaclass�T�KT�VT�T_co)r��V_co�VT_co�T_contra)r��CT_co)r�r�cCst||d|d�S)NT)r�r�)rJ)r�rwr�rRrRrS�_alias�sr.rR)r�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.
    F)r�r�a@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�a�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"eZdZdZeed�dd��ZdS)r.rR)�returncCsdS)NrR)r�rRrRrS�__int__szSupportsInt.__int__N)rZrVrWr�r�intr0rRrRrRrSr.sc@s"eZdZdZeed�dd��ZdS)r-rR)r/cCsdS)NrR)r�rRrRrS�	__float__szSupportsFloat.__float__N)rZrVrWr�r�floatr2rRrRrRrSr-sc@s"eZdZdZeed�dd��ZdS)r,rR)r/cCsdS)NrR)r�rRrRrS�__complex__szSupportsComplex.__complex__N)rZrVrWr�r�complexr4rRrRrRrSr,sc@s"eZdZdZeed�dd��ZdS)r+rR)r/cCsdS)NrR)r�rRrRrS�	__bytes__'szSupportsBytes.__bytes__N)rZrVrWr�r�bytesr6rRrRrRrSr+#sc@s"eZdZdZeed�dd��ZdS)r*rR)r/cCsdS)NrR)r�rRrRrS�__abs__0szSupportsAbs.__abs__N)rZrVrWr�rr)r8rRrRrRrSr*,sc@s&eZdZdZedeed�dd��ZdS)r/rRr)�ndigitsr/cCsdS)NrR)r�r9rRrRrS�	__round__9szSupportsRound.__round__N)r)rZrVrWr�rr1r)r:rRrRrRrSr/5sc	svd��fdd�|D�}t�|dd�|D��}t�|�|_|_yt�d�j�dd�|_	Wnt
tfk
rpYnX|S)NzDNamedTuple('Name', [(f0, t0), (f1, t1), ...]); each t must be a typecsg|]\}}|t|��f�qSrR)rT)r^�nr_)rPrRrSra@sz!_make_nmtuple.<locals>.<listcomp>cSsg|]\}}|�qSrRrR)r^r;r_rRrRrSraAsr�rZr�)r��
namedtupler6r	�_field_typesr�r�r�r�rVr�r�)r�rX�nm_tplrR)rPrS�
_make_nmtuple>sr?)r�r�r��__getnewargs__�_fields�_field_defaultsr=�_make�_replace�_asdictZ_source)rVrZr	cseZdZ�fdd�Z�ZS)�NamedTupleMetacs�|�dd�rt��||||�S|�di�}t||���}g}i}xP|D]H}||krn||}	|�|	�|	||<qF|rFtdj|d�|�	��d���qFWt
�|�|j_t
|�|j_||_xD|D]<}
|
tkr�td|
��q�|
tkr�|
|jkr�t||
||
�q�W|S)Nr�Fr	zXNon-default namedtuple field {field_name} cannot follow default field(s) {default_names}z, )�
field_nameZ
default_namesz&Cannot overwrite NamedTuple attribute )r�r�r�r?rrbrLrr�r"r�r6r	rfrrB�_prohibitedr�rcrAr�)rq�typenamer��nsrXr>rZ
defaults_dictrGZ
default_value�key)r�rRrSr�Vs0



zNamedTupleMeta.__new__)rZrVrWr�r�rRrR)r�rSrFTsrFc@seZdZdZdd�Zde_dS)r9TcOs�|std��|^}}|r"|^}}nd|kr6|�d�}ntd��|r~y
|\}Wq�tk
rztdt|�d�d��d�Yq�Xn$d|kr�t|�dkr�|�d�}nd}|dkr�|��}n|r�td	��t||�S)
Nz*NamedTuple.__new__(): not enough argumentsrIzGNamedTuple.__new__() missing 1 required positional argument: 'typename'z@NamedTuple.__new__() takes from 2 to 3 positional arguments but r�z were given�fieldsrtzIEither list of fields or keywords can be provided to NamedTuple, not both)rLrr�rprr?)rzr�rqrIrLrRrRrSr��s,


zNamedTuple.__new__z*($cls, typename, fields=None, /, **kwargs)N)rZrVrWr�r��__text_signature__rRrRrRrSr9sscCsdd�}||_||_|S)NcSs|S)NrR)�xrRrRrS�new_type�szNewType.<locals>.new_type)rZZ
__supertype__)r�rmrOrRrRrSr>�sc@s�eZdZdZeed�dd��Zeed�dd��Zedd�dd	��Z	ee
d�d
d��Zeed�dd
��Z
edd�dd��Zee
d�dd��Zed6eed�dd��Zee
d�dd��Zed7eed�dd��Zed8eeed�dd��Zed9eeed�d d!��Zee
d�d"d#��Zeed�d$d%��Zed:eed&�d'd(��Zee
d�d)d*��Zeeed+�d,d-��Zeeedd.�d/d0��Zed1d�d2d3��Zedd�d4d5��ZdS);�IOrR)r/cCsdS)NrR)r�rRrRrS�mode�szIO.modecCsdS)NrR)r�rRrRrSr��szIO.nameNcCsdS)NrR)r�rRrRrS�close�szIO.closecCsdS)NrR)r�rRrRrS�closed�sz	IO.closedcCsdS)NrR)r�rRrRrS�fileno�sz	IO.filenocCsdS)NrR)r�rRrRrS�flush�szIO.flushcCsdS)NrR)r�rRrRrS�isatty�sz	IO.isattyr�)r;r/cCsdS)NrR)r�r;rRrRrS�read�szIO.readcCsdS)NrR)r�rRrRrS�readableszIO.readable)�limitr/cCsdS)NrR)r�rYrRrRrS�readlineszIO.readline)�hintr/cCsdS)NrR)r�r[rRrRrS�	readlines	szIO.readlinesr)�offset�whencer/cCsdS)NrR)r�r]r^rRrRrS�seek
szIO.seekcCsdS)NrR)r�rRrRrS�seekableszIO.seekablecCsdS)NrR)r�rRrRrS�tellszIO.tell)�sizer/cCsdS)NrR)r�rbrRrRrS�truncateszIO.truncatecCsdS)NrR)r�rRrRrS�writableszIO.writable)�sr/cCsdS)NrR)r�rerRrRrS�write!szIO.write)�linesr/cCsdS)NrR)r�rgrRrRrS�
writelines%sz
IO.writelinesz
IO[AnyStr]cCsdS)NrR)r�rRrRrS�	__enter__)szIO.__enter__cCsdS)NrR)r�rGr�	tracebackrRrRrS�__exit__-szIO.__exit__)r�)r�)r�)r)N)rZrVrWr�rrIrQr�rrRr�rSr1rTrUrVr;rWrXrZr5r\r_r`rarcrdrfrhrirkrRrRrRrSrP�sR
rPc@s>eZdZdZeeeefed�dd��Z	edd�dd��Z
dS)	�BinaryIOrR)rer/cCsdS)NrR)r�rerRrRrSrf7szBinaryIO.write)r/cCsdS)NrR)r�rRrRrSri;szBinaryIO.__enter__N)rZrVrWr�rrr7�	bytearrayr1rfrirRrRrRrSrl2s
rlc@s�eZdZdZeed�dd��Zeed�dd��Zee	ed�dd��Z
eed�d	d
��Zee
d�dd��Zedd�d
d��ZdS)�TextIOrR)r/cCsdS)NrR)r�rRrRrS�bufferEsz
TextIO.buffercCsdS)NrR)r�rRrRrS�encodingIszTextIO.encodingcCsdS)NrR)r�rRrRrS�errorsMsz
TextIO.errorscCsdS)NrR)r�rRrRrS�line_bufferingQszTextIO.line_bufferingcCsdS)NrR)r�rRrRrS�newlinesUszTextIO.newlinescCsdS)NrR)r�rRrRrSriYszTextIO.__enter__N)rZrVrWr�rrlrorIrprrqr�rrrrsrrirRrRrRrSrn@srnc@s"eZdZdddgZeZeZeZdS)�iorPrnrlN)rZrVrW�__all__rPrnrlrRrRrRrSrt^s
rtz.ioc@seZdZddgZeZeZdS)�re�Pattern�MatchN)rZrVrWrurwrxrRrRrRrSrvmsrvz.re)T)NN)T)�r�rrr�Zcollections.abc�
contextlibrr�rvZ	stdlib_rer�rXrrrrurTr]rgrkrsryr�r�r�r�r�rMrrAr	rrr
rr�r�rJr�rr�r�r<rrY�BuiltinFunctionType�
MethodTyperrr=r?r@rrBrGrrFr&r'r(r)r*r+r,r-r7rIr;r.rr"r%r$r#rrr)r rr&r�__doc__r7rrrrrrrrfr
rhr5r�r2rur�r8rrrr!�AbstractContextManagerr�AbstractAsyncContextManagerr(r�r3r�r4r6r1r0r:r'rr.r-r,r+r*r/r?rHrcrFr9r>rCrDrPrlrnrtrZrrwrxrRrRrRrS�<module>s�
!
	
E
2a/_

V	D

							<`	



?>