ok

Mini Shell

Direktori : /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.pyc

B

�x�cv��>@s�dZddlZddlmZmZddlZddlZddlZddlZddlZddl	Z
ddlZddlZddlm
Z
mZmZddddd	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@dAdBg>Zd�dDdE�ZdFdG�ZdHdI�ZdJdK�ZdLdM�ZdNdO�ZgZdPdQ�ZdRdS�ZGdTdU�dU�ZGdVdW�dW�ZGdXdY�dYeedCdZ�Zedd[d\�Zed?d]d\�Zedd^d\�Zedd_d\�Z ed
d`d\�Z!Gdad�dedCdZ�Z"Gdbd
�d
eedCdZ�Z#d3dd1d5d6d0d2dddc�	Z$ddde�Z%Gdfdg�dgedCdZ�Z&Gdhdi�die&dCdZ�Z'Gdjd	�d	�Z(Gdkdl�dl�Z)Gdmdn�dn�Z*dod:�Z+dpdq�Z,ej-ej.ej/ej0e
eefZ1d�drd;�Z2dsd=�Z3dtd>�Z4dudv�Z5dwd@�Z6Gdxdy�dye7�Z8Gdzd{�d{e(e8d|�Z9e#d}�Z:e#d~�Z;e#d�Z<e#d�dCd��Z=e#d�dCd��Z>e#d�dCd��Z?e#d�dCd��Z@e#d�dCe7d��ZAe#d9eBeC�ZDd�d�d��ZEeEejjFd��ZFeEejjGe=�ZGeEejjHe=e@e>f�ZHeEejjIe=�ZIeEejjJe=�ZJeEejjKe=�ZKeEejjLe=�ZLeEejjMe=�ZMeEejjNd��ZNeEejjOe=�ZOeEejjPe=�ZPe'ejjQd�dCd��ZQd�eQ_eEejjRe=�ZSeEejjTe:�ZTeEejjUe;e?f�ZUeEejjVe;e<f�ZVeEejjWe=�ZWeEejjXe:�ZXeEejjYd��ZYe'eZd�d�dCd��Z[d�e[_eEe\e:d�d��Z]eEej^e:�Z_eEe`e:d�d��ZReEeae=d�d��ZbeEejjce=�ZceEejjde;�ZdeEejjee;e?f�ZeeEejjfe?�ZfeEejge=�ZheEejie=�ZjeEeke;e<fd�d��ZleEejme;e<f�ZneEejoe;e<f�ZoeEejpe:�ZpeEejqe;e<f�ZqeEejjre=e@e>f�ZreEejjse=e@f�ZseEe7eAd�d��Ztd�et_Gd�d,�d,e9�ZuGd�d+�d+e9�ZvGd�d*�d*e9�ZwGd�d)�d)e9�ZxGd�d(�d(e9e=�ZyGd�d-�d-e9e=�Zzd�d��Z{d�Z|d�Z}Gd�d��d�e7�Z~Gd�d7�d7e~d|�Zd�d<�Z�eCZ�d�Z�Gd�d��d�e(eD�Z�Gd�d��d�e�eB�Z�Gd�d��d�e�eC�Z�Gd�d��d��Z�e�d�e�_�e�ej�e�j�<eEe
j�eD�Z�eEe
j�eD�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
  (the latter is currently private, but will be made public after PEP 544 acceptance).
* 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 (may be added soon).
* Wrapper submodules for re and io related types.
�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)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).
    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)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).
    �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)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|]}|�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)zjSubstitute type variables 'tvars' with substitutions 'subs'.
    These two must have the same length.
    )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)	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 ZmanyZfewz parameters for z	; actual z, expected N)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|}|r�t|��t|�S)zyAn internal helper for Union creation and substitution: flatten Unions
    among parameters, then remove duplicates.
    r�N)rHrJrKrrdrirfrprb�set�remove�AssertionError)rr�params�pZ
all_paramsZ
new_paramsr_rRrRrS�_remove_dups_flatten�s"
"

rzcs4t�����t��j�t�����fdd��}|S)zInternal wrapper caching __getitem__ of generic types with a fallback to
    original function for non-hashable arguments.
    cs*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~rrR)r}r~rS�	_tp_cache�sr�csbt|t�r|����St|t�r^t��fdd�|jD��}||jkrH|S|�|�}|j|_|S|S)z�Evaluate all forward reverences in the given type t.
    For use of globalns and localns see the docstring for get_type_hints().
    c3s|]}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@seZdZdZdZdd�ZdS)�_FinalzMixin to prohibit subclassing)�__weakref__cOsd|krtd��dS)N�_rootz&Cannot subclass special typing classes)rL)�selfr{r|rRrRrS�__init_subclass__sz_Final.__init_subclass__N)rZrVrW�__doc__�	__slots__r�rRrRrRrSr�sr�c@s eZdZdZdd�Zdd�ZdS)�
_Immutablez3Mixin to indicate that object should not be copied.cCs|S)NrR)r�rRrRrS�__copy__sz_Immutable.__copy__cCs|S)NrR)r��memorRrRrS�__deepcopy__!sz_Immutable.__deepcopy__N)rZrVrWr�r�r�rRrRrRrSr�sr�cspeZdZdZdZ�fdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
edd��Z�ZS)rMzhInternal indicator of special typing constructs.
    See _doc instance attribute for specific docs.
    )�_name�_doccsBt|�dkr6t|dt�r6t|dt�r6td|����t��|�S)z�Constructor.

        This only exists to give a better error message in case
        someone tries to subclass a special typing object (not a good idea).
        �rrtzCannot subclass )rprHrIrfrL�super�__new__)rqr{r|)�	__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�r{r|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^ry)rPrRrSr�_sz+_SpecialForm.__getitem__.<locals>.<genexpr>rtrrz#Optional[t] requires a single type.z is not subscriptable)
r�rTrJrLrHrfrzrprrG)r�rr�itemrOrR)rPrS�__getitem__Ts$






z_SpecialForm.__getitem__)rZrVrWr�r�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>eZdZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)r
z-Internal wrapper to hold a forward reference.)�__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�r�rRrRrRrSr
�s

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.
    )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�r�rRrRrRrSr�s*	)	rhrf�dictru�	frozenset�deque�defaultdictrGr7cCs|�d�o|�d�S)N�__)�
startswith�endswith)�attrrRrRrS�
_is_dunderSsr�cs�eZdZdZdddd�dd�Zedd	��Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
�fdd�Zdd�Zdd�Zdd�Z�ZS) rJa�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.
    TFN)�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��originrxr�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^ry)rPrRrSr�zsz,_GenericAlias.__getitem__.<locals>.<genexpr>)	rKrrFrLrHrfrsrkre)r�rxrR)rPrSr�rs

z_GenericAlias.__getitem__cCst|j||j|jd�S)N)r�r�)rJrKr�r�)r�rxrRrRrSrl~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�r{rRrRrSr��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�r{�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�r{rRrRrSr��s
z_GenericAlias.__reduce__)rZrVrWr�r�r�r�rlr�r�r�r�r�r�r�r�r�r�r�rRrR)r�rSrJWs		rJcs,eZdZdZdd�Ze�fdd��Z�ZS)�_VariadicGenericAliasz�Same as _GenericAlias above but for variadic aliases. Currently,
    this is used only by special internal aliases: Tuple and Callable.
    cCs�|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�rxr{r�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^ry)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�rxryr{r�)r�)rPrSr��s.




z'_VariadicGenericAlias.__getitem_inner__)rZrVrWr�r�r�r�r�rRrR)r�rSr��sr�cs<eZdZdZdZ�fdd�Zedd��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
    rRcsP|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�)rqr{r|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^ry)rPrRrSr�@sz,Generic.__class_getitem__.<locals>.<genexpr>css|]}t|t�VqdS)N)rHr)r^ryrRrRrSr�Csz5Parameters to Generic[...] must all be type variablesz-Parameters to Generic[...] must all be unique)rHrfr
rLrWr�allrprurFrsrJ)rqrxrR)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)
rqr{r�r`�errorZgvars�baseZtvarsetZs_varsZs_args)r�)r�rSr�Qs6





zGeneric.__init_subclass__)
rZrVrWr�r�r�r�r�r�r�rRrR)r�rSrs

c@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)rZrVrWr�rRrRrRrSr�wsr�c@seZdZdZdS)r�z(Internal placeholder for ... (ellipsis).N)rZrVrWr�rRrRrRrSr�~sr�cCs|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).
    rR)�typr�rRrRrSr<�sc
Cs�y
|j}Wntk
riSX|j}|j}|d|�}|jp@d}|j}|rTt|�ni}|t|�}x2t||d�|�D]\}}	||ks�t	�|	||<qxW|S)z:Internal helper to extract the default arguments, by name.NrR)
�__code__r��co_argcount�co_varnames�__defaults__�__kwdefaults__r�rp�ziprw)
r~r�Z	pos_countZ	arg_names�defaultsZ
kwdefaultsr�Z
pos_offsetr��valuerRrRrS�
_get_defaults�s

r
cCs�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)	a�Return type hints for an object.

    This is often the same as obj.__annotations__, but it handles
    forward references encoded as string literals, and if necessary
    adds Optional[t] if a default value equal to None is set.

    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__N�__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�formatr
r�r)r\r�r�ZhintsrZbase_globals�annr�r	ZnsobjrrRrRrSr=�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)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)
rHrGr��copyrr��pop�valuesrXrYrr?rL)rOZ	arg_attrsr�r�r\rRrRrSr?�s	



cst����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�||�}t|�}|S)N)r?)r{r|r~)�	decoratorrRrS�wrapped_decorators
z2no_type_check_decorator.<locals>.wrapped_decorator)r�r�)rrrR)rrSr@scOs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)�NotImplementedError)r{r|rRrRrS�_overload_dummy&srcCstS)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~rRrRrSrB/scs0eZdZdZ�fdd�Zdd�Zdd�Z�ZS)�
_ProtocolMetaz~Internal metaclass for _Protocol.

    This exists so _Protocol classes can be generic without deriving
    from Generic.
    cs"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)Nr!FrFZ_abc_�__abstractmethods__rr�Z_gorgr�rir�r"Z__next_in_mro__rerKr�Z	__extra__Z
__tree_hash__rV)	rr�rZrbrur��keysr��add)r�Zprotocol_bases�cr#rr�rRrRrSr"is<
z!_ProtocolMeta._get_protocol_attrs)rZrVrWr�r�r�r"r�rRrR)r�rSrLsrcs(eZdZdZdZdZ�fdd�Z�ZS)rFz�Internal base class for protocol classes.

    This implements a simple-minded structural issubclass check
    (similar but more general than the one-offs in collections.abc
    such as Hashable).
    rRTcst��|�S)N)r�r�)rqrx)r�rRrSr��sz_Protocol.__class_getitem__)rZrVrWr�r�r!r�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�rxr�rRrRrS�_alias�sr1rR)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&eZdZdZdZeed�dd��ZdS)r.z(An ABC with one abstract method __int__.rR)�returncCsdS)NrR)r�rRrRrS�__int__szSupportsInt.__int__N)rZrVrWr�r�r�intr3rRrRrRrSr.sc@s&eZdZdZdZeed�dd��ZdS)r-z*An ABC with one abstract method __float__.rR)r2cCsdS)NrR)r�rRrRrS�	__float__szSupportsFloat.__float__N)rZrVrWr�r�r�floatr5rRrRrRrSr-sc@s&eZdZdZdZeed�dd��ZdS)r,z,An ABC with one abstract method __complex__.rR)r2cCsdS)NrR)r�rRrRrS�__complex__szSupportsComplex.__complex__N)rZrVrWr�r�r�complexr7rRrRrRrSr,sc@s&eZdZdZdZeed�dd��ZdS)r+z*An ABC with one abstract method __bytes__.rR)r2cCsdS)NrR)r�rRrRrS�	__bytes__'szSupportsBytes.__bytes__N)rZrVrWr�r�r�bytesr9rRrRrRrSr+#sc@s&eZdZdZdZeed�dd��ZdS)r*zMAn ABC with one abstract method __abs__ that is covariant in its return type.rR)r2cCsdS)NrR)r�rRrRrS�__abs__0szSupportsAbs.__abs__N)rZrVrWr�r�rr,r;rRrRrRrSr*,sc@s*eZdZdZdZedeed�dd��ZdS)	r/zOAn ABC with one abstract method __round__ that is covariant in its return type.rRr)�ndigitsr2cCsdS)NrR)r�r<rRrRrS�	__round__9szSupportsRound.__round__N)r)	rZrVrWr�r�rr4r,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>srB)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�rBrrbrLrr�r%r�r6rrfrrE�_prohibitedr�rcrDr�)rq�typenamer��nsrXrArZ
defaults_dictrJZ
default_value�key)r�rRrSr�Vs0



zNamedTupleMeta.__new__)rZrVrWr�r�rRrR)r�rSrITsrIc@s"eZdZdZdZdd�Zde_dS)r9a4Typed 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 extra __annotations__ and _field_types
    attributes, giving an ordered dict mapping field names to types.
    __annotations__ should be preferred, while _field_types
    is kept to maintain pre PEP 526 compatibility. (The field names
    are 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)])
    TcOs�|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 argumentsrLzGNamedTuple.__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�rprrB)r{r�rqrLrOrRrRrSr��s,


zNamedTuple.__new__z*($cls, typename, fields=None, /, **kwargs)N)rZrVrWr�r�r��__text_signature__rRrRrRrSr9sscCsdd�}||_||_|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|S)NrR)�xrRrRrS�new_type�szNewType.<locals>.new_type)rZZ
__supertype__)r�rmrRrRrRrSr>�sc@s�eZdZdZdZeed�dd��Zeed�dd��Ze	dd�d	d
��Z
eed�dd��Ze	e
d�d
d��Ze	dd�dd��Ze	ed�dd��Ze	d7e
ed�dd��Ze	ed�dd��Ze	d8e
ed�dd��Ze	d9e
eed�dd��Ze	d:e
e
e
d �d!d"��Ze	ed�d#d$��Ze	e
d�d%d&��Ze	d;e
e
d'�d(d)��Ze	ed�d*d+��Ze	ee
d,�d-d.��Ze	eedd/�d0d1��Ze	d2d�d3d4��Ze	dd�d5d6��ZdS)<�IOa�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.
    rR)r2cCsdS)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>r2cCsdS)NrR)r�r>rRrRrS�read�szIO.readcCsdS)NrR)r�rRrRrS�readableszIO.readable)�limitr2cCsdS)NrR)r�r\rRrRrS�readlineszIO.readline)�hintr2cCsdS)NrR)r�r^rRrRrS�	readlines	szIO.readlinesr)�offset�whencer2cCsdS)NrR)r�r`rarRrRrS�seek
szIO.seekcCsdS)NrR)r�rRrRrS�seekableszIO.seekablecCsdS)NrR)r�rRrRrS�tellszIO.tell)�sizer2cCsdS)NrR)r�rerRrRrS�truncateszIO.truncatecCsdS)NrR)r�rRrRrS�writableszIO.writable)�sr2cCsdS)NrR)r�rhrRrRrS�write!szIO.write)�linesr2cCsdS)NrR)r�rjrRrRrS�
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�r�rrIrTr�rrUr�rVr4rWrXrYr;rZr[r]r5r_rbrcrdrfrgrirkrlrnrRrRrRrSrS�sTrSc@sBeZdZdZdZeeeefe	d�dd��Z
edd�dd��Zd	S)
�BinaryIOz5Typed version of the return of open() in binary mode.rR)rhr2cCsdS)NrR)r�rhrRrRrSri7szBinaryIO.write)r2cCsdS)NrR)r�rRrRrSrl;szBinaryIO.__enter__N)rZrVrWr�r�rrr:�	bytearrayr4rirlrRrRrRrSro2sroc@s�eZdZdZdZeed�dd��Zeed�dd��Z	ee
ed�dd	��Zeed�d
d��Z
eed�dd
��Zedd�dd��ZdS)�TextIOz3Typed version of the return of open() in text mode.rR)r2cCsdS)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�rRrRrSrlYszTextIO.__enter__N)rZrVrWr�r�rrorrrIrsrrtr�rurrvrrlrRrRrRrSrq@srqc@s&eZdZdZdddgZeZeZeZdS)�ioz)Wrapper namespace for IO generic classes.rSrqroN)rZrVrWr��__all__rSrqrorRrRrRrSrw^s

rwz.ioc@s eZdZdZddgZeZeZdS)�rez&Wrapper namespace for re type aliases.�Pattern�MatchN)rZrVrWr�rxrzr{rRrRrRrSrymsryz.re)T)NN)T)�r�r�rrr�Zcollections.abc�
contextlibr�r�ryZ	stdlib_rer�rXrrrrxrTr]rgrkrsrzr�r�r�r�r�rMrrAr	rrr
rr�r�rJr�rr�r�r<r
rY�BuiltinFunctionType�
MethodTyperrr=r?r@rrBrGrrFr)r*r+r,r-r.r/r0r:rIr;r1rr"r%r$r#rrr)r rr&rr7rrrrrrrrfr
rhr5r�r2rur�r8rrrr!�AbstractContextManagerr�AbstractAsyncContextManagerr(r�r3r�r4r6r1r0r:r'rr.r-r,r+r*r/rBrKrcrIr9r>rCrDrSrorqrwrZrrzr{rRrRrRrS�<module>s�
!
	
E
2a/_

V	D

							<`	



Zerion Mini Shell 1.0