Your IP : 18.118.30.153


Current Path : /opt/alt/python38/lib64/python3.8/__pycache__/
Upload File :
Current File : //opt/alt/python38/lib64/python3.8/__pycache__/typing.cpython-38.pyc

U

i�fb
�G@s�dZddlmZmZddlZddlZddlZddlZddlZddl	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@dAdBdCdDdEdFdGdHdIdJdKgGZd�dMdN�ZdOdP�ZdQdR�ZdSdT�ZdUdV�ZdWdX�ZgZdYdZ�Zd[d\�ZGd]d^�d^�ZGd_d`�d`�ZGdadb�dbeedLdc�Zedddde�ZedGdfde�Zeddgde�Zeddhde�Z eddide�Z!eddjde�Z"eddkde�Z#Gdld	�d	edLdc�Z$Gdmd�deedLdc�Z%d7dd5d9d:d4d6dddn�	Z&dodp�Z'Gdqdr�dredLdc�Z(Gdsdt�dte(dLdc�Z)Gdud
�d
�Z*Gdvdw�dw�Z+Gdxdy�dy�Z,dzd{d|d}d~gZ-dd�d�d�d�d�d�d�d�d�g
Z.e-e.d�gZ/d�d��Z0d�d��Z1d�d��Z2d�d��Z3dd#ddd%dd!dd'd*g
d�d�gd��Z4Gd�d��d�e�Z5Gd�d
�d
e*e5d��Z6d�dI�Z7d�d?�Z8d�d��Z9ej:ej;ej<ej=e
eefZ>d�d�dC�Z?d�dB�Z@d�dA�ZAd�dE�ZBd�dF�ZCd�d��ZDd�dH�ZEd�d@�ZFe%d��ZGe%d��ZHe%d��ZIe%d�dLd��ZJe%d�dLd��ZKe%d�dLd��ZLe%d�dLd��ZMe%d�dLeNd��ZOe%d>ePeQ�ZRd�d�d��ZSeSejjTd��ZTeSejjUeJ�ZUeSejjVeJeMeKf�ZVeSejjWeJ�ZWeSejjXeJ�ZXeSejjYeJ�ZYeSejjZeJ�ZZeSejj[eJ�Z[eSejj\d��Z\eSejj]eJ�Z]eSejj^eJ�Z^e)ejj_d�dLd��Z_d�e__eSejj`eJ�ZaeSejjbeG�ZbeSejjceHeLf�ZceSejjdeHeIf�ZdeSejjeeJ�ZeeSejjfeG�ZfeSejjgd��Zge)ehd�d�dLd��Zid�ei_eSejeGd�d��ZkeSejleG�ZmeSeneGd�d��Z`eSeoeJd�d��ZpeSejjqeJ�ZqeSejjreH�ZreSejjseHeLf�ZseSejjteL�ZteSejueJ�ZveSejweJ�ZxeSeyeHeIfd�d��ZzeSej{eHeIf�Z|eSej}eHeIf�Z}eSej~eG�Z~eSejeHeIf�ZeSejj�eJeMeKf�Z�eSejj�eJeMf�Z�eSeNeOd�d��Z�d�e�_e7Gd�d0�d0e6��Z�e7Gd�d.�d.e6��Z�e7Gd�d-�d-e6��Z�e7Gd�d,�d,e6��Z�e7Gd�d/�d/e6��Z�e7Gd�d+�d+e6eJ��Z�e7Gd�d1�d1e6eJ��Z�d�dÄZ�d�Z�d�Z�Gd�dDŽd�eN�Z�Gd�d;�d;e�d��Z�d�dʄZ�d�dLd˜d�d̈́Z�d�dτZ�Gd�dфd�eN�Z�Gd�d<�d<eye�d��Z�d�dD�Z�eQZ�d�Z�Gd�dՄd�e*eR�Z�Gd�dׄd�e�eP�Z�Gd�dلd�e�eQ�Z�Gd�dۄdۃZ�e�d�e�_�e�ej�e�j�<eSe
j�eR�Z�eSe
j�eR�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�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�AnyStr�cast�final�get_args�
get_origin�get_type_hints�NewType�
no_type_check�no_type_check_decorator�NoReturn�overload�runtime_checkable�Text�
TYPE_CHECKINGTcCs�ttf}|r|ttf}|dkr(td�St|t�r:t|�St|t�r\|j	|kr\t
|�d���t|t�rr|tt
fks~|ttfkr�t
d|�d���t|tttf�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rr	r
�type�
isinstance�strr�
_GenericAlias�
__origin__�	TypeError�_SpecialFormrrIr�callable)�arg�msg�is_argumentZinvalid_generic_forms�rZ�+/opt/alt/python38/lib64/python3.8/typing.py�_type_checkxs(

�
�r\cCsRt|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).
    �builtinsrN.z...)rPrO�
__module__�__qualname__�types�FunctionType�__name__�repr)�objrZrZr[�
_type_repr�s

recs\g�|D]J}t|t�r(|�kr(��|�t|t�r|js���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|]}|�kr|�qSrZrZ��.0�t��tvarsrZr[�
<listcomp>�sz&_collect_type_vars.<locals>.<listcomp>)rPr�appendrR�_special�extend�__parameters__�tuple)r`rhrZrir[�_collect_type_vars�s
rqcCs�t|t�s|St|j�}t|j�D]J\}}t|t�r\t|�D]\}}||kr<||||<q<q"t|||�||<q"|jtkr�tt	|�S|�
t	|��S)zjSubstitute type variables 'tvars' with substitutions 'subs'.
    These two must have the same length.
    )rPrR�list�__args__�	enumerater�_subs_tvarsrSrrp�	copy_with)�tprjZsubsZnew_args�arW�iZtvarrZrZr[ru�s



ruc	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)rorT�len)�cls�
parametersZalenZelenrZrZr[�_check_generic�s
r}cCs�g}|D]f}t|t�r.|jtkr.|�|j�qt|t�rdt|�dkrd|dtkrd|�|dd��q|�|�qt	|�}t|�t|�kr�g}|D] }||kr�|�|�|�
|�q�|}|r�t|��t|�S)zyAn internal helper for Union creation and substitution: flatten Unions
    among parameters, then remove duplicates.
    r�N)rPrRrSrrnrsrprzrl�set�remove�AssertionError)r|�params�pZ
all_paramsZ
new_paramsrhrZrZr[�_remove_dups_flatten�s""
r�cs4t�����t��j�t�����fdd��}|S)zInternal wrapper caching __getitem__ of generic types with a fallback to
    original function for non-hashable arguments.
    cs,z�||�WStk
r YnX�||�S�N�rT��args�kwds��cached�funcrZr[�inner�s
z_tp_cache.<locals>.inner)�	functools�	lru_cache�	_cleanupsrl�cache_clear�wraps)r�r�rZr�r[�	_tp_cache�s
r�csbt|t�r|����St|t�r^t��fdd�|jD��}||jkrH|S|�|�}|j|_|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().
    c3s|]}t|���VqdSr�)�
_eval_type�rgrx��globalns�localnsrZr[�	<genexpr>sz_eval_type.<locals>.<genexpr>)rPr�	_evaluaterRrprsrvrm)rhr�r�Zev_args�resrZr�r[r�	s



r�c@seZdZdZdZdd�ZdS)�_FinalzMixin to prohibit subclassing)�__weakref__cOsd|krtd��dS)N�_rootz&Cannot subclass special typing classesr���selfr�r�rZrZr[�__init_subclass__sz_Final.__init_subclass__N)rbr^r_�__doc__�	__slots__r�rZrZrZr[r�sr�c@s eZdZdZdd�Zdd�ZdS)�
_Immutablez3Mixin to indicate that object should not be copied.cCs|Sr�rZ�r�rZrZr[�__copy__%sz_Immutable.__copy__cCs|Sr�rZ)r�ZmemorZrZr[�__deepcopy__(sz_Immutable.__deepcopy__N)rbr^r_r�r�r�rZrZrZr[r�"sr�cspeZdZdZdZ�fdd�Zdd�Zdd�Zd	d
�Zdd�Z	d
d�Z
dd�Zdd�Zdd�Z
edd��Z�ZS)rUzhInternal indicator of special typing constructs.
    See _doc instance attribute for specific docs.
    ��_nameZ_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).
        �rr~zCannot subclass )rzrPrQrprT�super�__new__)r{r�r���	__class__rZr[r�3s��z_SpecialForm.__new__cCs||_||_dSr�r�)r��name�docrZrZr[�__init__@sz_SpecialForm.__init__cCst|t�stS|j|jkSr�)rPrU�NotImplementedr��r��otherrZrZr[�__eq__Ds
z_SpecialForm.__eq__cCst|jf�Sr�)�hashr�r�rZrZr[�__hash__Isz_SpecialForm.__hash__cCs
d|jS)N�typing.�r�r�rZrZr[�__repr__Lsz_SpecialForm.__repr__cCs|jSr�r�r�rZrZr[�
__reduce__Osz_SpecialForm.__reduce__cOstd|����dS)NzCannot instantiate r�r�rZrZr[�__call__Rsz_SpecialForm.__call__cCst|�d���dS)Nz! cannot be used with isinstance()r��r�rdrZrZr[�__instancecheck__Usz_SpecialForm.__instancecheck__cCst|�d���dS)Nz! cannot be used with issubclass()r��r�r{rZrZr[�__subclasscheck__Xsz_SpecialForm.__subclasscheck__cs�|jdkr(t||j�d��}t||f�S|jdkr�|dkrBtd��t|t�sR|f}d�t�fdd�|D��}t|�}t|�d	kr�|d
St||�S|jdkr�t|d�}t|t	d�fS|jd
kr�t||�St|�d���dS)N)r	r
z accepts only single type.rrZz Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.c3s|]}t|��VqdSr��r\�rgr��rXrZr[r�fsz+_SpecialForm.__getitem__.<locals>.<genexpr>r~rrz#Optional[t] requires a single type.r
z is not subscriptable)
r�r\rRrTrPrpr�rzrrO)r�r|�itemrWrZr�r[�__getitem__[s(







z_SpecialForm.__getitem__)rbr^r_r�r�r�r�r�r�r�r�r�r�r�r�r��
__classcell__rZrZr�r[rU,s
rU)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�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.
    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].
    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.
    c@s>eZdZdZdZddd�Zdd�Zdd	�Zd
d�Zdd
�Z	dS)rz-Internal wrapper to hold a forward reference.)�__forward_arg__�__forward_code__�__forward_evaluated__�__forward_value__�__forward_is_argument__TcCsnt|t�std|����zt|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)
rPrQrT�compile�SyntaxErrorr�r�r�r�r�)r�rWrY�coderZrZr[r��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.�rYT)r�r\r�r�r�r�)r�r�r�rZrZr[r��s
�zForwardRef._evaluatecCs>t|t�stS|jr2|jr2|j|jko0|j|jkS|j|jkSr�)rPrr�r�r�r�r�rZrZr[r�s

�zForwardRef.__eq__cCs
t|j�Sr�)r�r�r�rZrZr[r�szForwardRef.__hash__cCsd|j�d�S)NzForwardRef(�))r�r�rZrZr[r�szForwardRef.__repr__N)T)
rbr^r_r�r�r�r�r�r�r�rZrZrZr[r�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.
    )rb�	__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|_
zt�d�j
�d	d
�}Wnttfk
r�d}YnX|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�rfr�rZr[r�Vsz#TypeVar.__init__.<locals>.<genexpr>zBound must be a type.rb�__main__�typing)rb�
ValueError�boolr�r�rTrzrpr�r\r��sys�	_getframe�	f_globals�get�AttributeErrorr^)r�r�r�r�r�ZconstraintsZdef_modrZr�r[r�Js(


zTypeVar.__init__cCs&|jrd}n|jrd}nd}||jS)N�+�-�~)r�r�rb)r��prefixrZrZr[r�bszTypeVar.__repr__cCs|jSr�)rbr�rZrZr[r�kszTypeVar.__reduce__)rbr^r_r�r�r�r�r�rZrZrZr[rs+�	)	rrrp�dictr�	frozenset�deque�defaultdictrOr;cCs|�d�o|�d�S)N�__)�
startswith�endswith)�attrrZrZr[�
_is_dunder�sr�cs�eZdZdZdddd�dd�Zedd	��Zd
d�Zdd
�Zdd�Z	dd�Z
dd�Zdd�Zdd�Z
�fdd�Zdd�Zdd�Zdd�Z�ZS) rRa�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).rZN)�_TypingEllipsis�_TypingEmptyr�rZrZr[r��s�z)_GenericAlias.__init__.<locals>.<genexpr>)�_instrmrb�_normalize_aliasr�r�rPrprSrsrqror�r^)r��originr�r�r�r�Z	orig_namerZrZr[r��s 
�

z_GenericAlias.__init__cs^|jttfkrtd|����t|t�s,|f}d�t�fdd�|D��}t||�t||j|�S)Nz%Cannot subscript already-subscripted �*Parameters to generic types must be types.c3s|]}t|��VqdSr�r�r�r�rZr[r��sz,_GenericAlias.__getitem__.<locals>.<genexpr>)	rSrrrTrPrpr}ruro�r�r�rZr�r[r��s

z_GenericAlias.__getitem__cCst|j||j|jd�S)N)r�r�)rRrSr�r�r�rZrZr[rv�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�rr��[�, cSsg|]}t|��qSrZ�rer�rZrZr[rk�sz*_GenericAlias.__repr__.<locals>.<listcomp>�]�ztyping.Callableztyping.Callable[[cSsg|]}t|��qSrZr�r�rZrZr[rk�s���z], )r�rzrs�EllipsisrerSrm�join)r�r�r�rZrZr[r��s
��
 z_GenericAlias.__repr__cCsRt|t�stS|j|jkrdS|jtkrF|jtkrFt|j�t|j�kS|j|jkS)NF)rPrRr�rSrr�rsr�rZrZr[r��s
z_GenericAlias.__eq__cCs,|jtkrttt|j�f�St|j|jf�Sr�)rSrr�r�rsr�rZrZr[r��s
z_GenericAlias.__hash__cOsT|js$td|j�d|j���d���|j||�}z
||_Wntk
rNYnX|S)N�Type z cannot be instantiated; use z
() instead)r�rTr��lowerrS�__orig_class__r�)r�r��kwargs�resultrZrZr[r��s
z_GenericAlias.__call__cCs�|jrZg}|j|kr |�|j�|�|�}tdd�||dd�D��sR|�t�t|�S|jtkr�t|krpdS|�|�}||dd�D]}t|t	�r�||k	r�dSq�|jfS)Ncss"|]}t|t�pt|t�VqdSr�)rPrR�
issubclassr�rg�brZrZr[r��s�z0_GenericAlias.__mro_entries__.<locals>.<genexpr>r~rZ)
r�rSrl�index�anyrrprrPrR)r��basesr�ryrrZrZr[�__mro_entries__�s$

�


z_GenericAlias.__mro_entries__cCs*d|jkrt|�st|j|�St|��dS)NrS)�__dict__r��getattrrSr�)r�r�rZrZr[�__getattr__�sz_GenericAlias.__getattr__cs2t|�s|dkr t��||�nt|j||�dS)N)r�r�rm)r�r��__setattr__�setattrrS)r�r��valr�rZr[r�sz_GenericAlias.__setattr__cCs|�t|��Sr�)r�rOr�rZrZr[r�sz_GenericAlias.__instancecheck__cCs<|jr0t|t�st||j�S|jr0t|j|j�Std��dS)NzBSubscripted generics cannot be used with class and instance checks)rmrPrRrrSrTr�rZrZr[r�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�r~)
rmr��globalsrSrrzrsr�rrrprP�operator�getitem)r�r�r�rZrZr[r�s��
z_GenericAlias.__reduce__)rbr^r_r�r�r�r�rvr�r�r�r�rrrr�r�r�r�rZrZr�r[rR�s
		rRcs,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�rm�__getitem_inner__rPrprzrTr�rr)r�r�r�rrZrZr[r�"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)
NrZr�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�rZr[r�>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|��VqdSr�r�)rgrWr�rZr[r�Gs)rSrprmrvr�rPrzr\r��collections�abcrr�r�r�)r�r�r�r�rr�r�r[r2s.




z'_VariadicGenericAlias.__getitem_inner__)rbr^r_r�r�r�rr�rZrZr�r[rsrcs@eZdZdZdZdZ�fdd�Zedd��Z�fdd	�Z	�Z
S)
raCAbstract 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
    rZFcs^|ttfkrtd|j�d���t�jtjkrF|jtjk	rFt��|�}nt�j|f|�|�}|S)Nrz< cannot be instantiated; it can be used only as a base class)rrrTrbr�r��objectr�)r{r�r�rdr�rZr[r�dszGeneric.__new__cs�t|t�s|f}|s.|tk	r.td|j�d���d�t�fdd�|D��}|ttfkr�tdd�|D��sxtd|j�d���t	t
|��t	|�kr�td|j�d	���n
t||�t||�S)
NzParameter list to z[...] cannot be emptyr�c3s|]}t|��VqdSr�r�r�r�rZr[r�vsz,Generic.__class_getitem__.<locals>.<genexpr>css|]}t|t�VqdSr�)rPrr�rZrZr[r�yszParameters to z [...] must all be type variablesz[...] must all be unique)
rPrprrTr_rr�allrbrzrr}rR)r{r�rZr�r[�__class_getitem__ns&
���
zGeneric.__class_getitem__c
s
t�j||�g}d|jkr(t|jk}nt|jko:|jdk}|rHtd��d|jkr�t|j�}d}|jD].}t	|t
�rf|jtkrf|dk	r�td��|j}qf|dk	r�t
|�}t
|��|�ks�d��fdd�|D��}d�dd�|D��}	td	|�d
|	�d���|}t|�|_dS)N�__orig_bases__rz!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.r�c3s|]}|�krt|�VqdSr��rQrf�ZgvarsetrZr[r��sz,Generic.__init_subclass__.<locals>.<genexpr>css|]}t|�VqdSr�r)rg�grZrZr[r��szSome type variables (z) are not listed in Generic[r�)r�r�r
rr�	__bases__rbrTrqrPrRrSrorrrp)
r{r�rrj�errorZgvars�baseZtvarsetZs_varsZs_argsr�rr[r��s8




��zGeneric.__init_subclass__)rbr^r_r�r��_is_protocolr�r�rr�r�rZrZr�r[rMs

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�rbr^r_r�rZrZrZr[r��sr�c@seZdZdZdS)r�z(Internal placeholder for ... (ellipsis).Nr%rZrZrZr[r��sr�rorrr$�_is_runtime_protocol�__abstractmethods__�__annotations__r
r�r�r^r�r��__subclasshook__r��_MutableMapping__markercCsrt�}|jdd�D]X}|jdkr$qt|di�}t|j���t|���D] }|�d�sJ|tkrJ|�	|�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�)rrr(Z_abc_)
r�__mro__rbrrrr
�keysr��EXCLUDED_ATTRIBUTES�add)r{�attrsr#�annotationsr�rZrZr[�_get_protocol_attrs�s
r1cst�fdd�t��D��S)Nc3s|]}tt�|d��VqdSr�)rVr�rgr��r{rZr[r��sz,_is_callable_members_only.<locals>.<genexpr>)rr1r3rZr3r[�_is_callable_members_only�sr4cOst|�jrtd��dS)Nz Protocols cannot be instantiated)rOr$rT)r�r�rrZrZr[�_no_init�s
r5c	Cs6zt�d�jddkWSttfk
r0YdSXdS)z�Allow instnance 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.
    r�rb)rr�TN)r�r�r�r�r�rZrZrZr[�_allow_reckless_class_cheks�sr6�AbstractContextManager�AbstractAsyncContextManager)zcollections.abc�
contextlibcseZdZ�fdd�Z�ZS)�
_ProtocolMetacsVt�dd�rt��r$t�j��r$dS�jrJt��fdd�t��D��rJdSt����S)Nr$FTc3s8|]0}t�|�o.tt�|d��p.t�|�dk	VqdSr�)�hasattrrVrr2�r{�instancerZr[r��s�
z2_ProtocolMeta.__instancecheck__.<locals>.<genexpr>)	rr4rr�r$rr1r�r�r<r�r<r[r��s�
��z_ProtocolMeta.__instancecheck__)rbr^r_r�r�rZrZr�r[r:�sr:cs,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:
                ...
    rZTFcs�t�j||��j�dd�s2tdd��jD���_�fdd�}d�jkrN|�_�jsXdS�jD]F}|tt	fks^|j
tkr�|jt|j
ks^t
|t	�r�|js^td|��q^t�_dS)	Nr$Fcss|]}|tkVqdSr�)rrrZrZr[r�)sz-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}||jkr�|j|dkr�tSqdt|di�}t|tjj
�rn||krnt|t�rn|jrnqdqntSqddS)	Nr$Fr&zLInstance 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 classr(T)r
r�r�rr6rTr4rPrOr1r+rrrrrr$)r�r�r#r0r3rZr[�_proto_hook,s:


���
z/Protocol.__init_subclass__.<locals>._proto_hookr)z7Protocols can only inherit from other protocols, got %r)r�r�r
r�r
r!r$r)rrr^�_PROTO_WHITELISTrbrrTr5r�)r{r�rr>r#r�r3r[r�$s,&

�����zProtocol.__init_subclass__)	rbr^r_r�r�r$r&r�r�rZrZr�r[rs
)�	metaclasscCs&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)rrr$rTr&r3rZrZr[rKds�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).
    rZ)�typrrZrZr[rA}sc
Cs�z
|j}Wntk
r"iYSX|j}|j}|d|�}|jpDd}|j}|rXt|�ni}|t|�}t||d�|�D]\}}	||ks�t	�|	||<qz|S)z:Internal helper to extract the default arguments, by name.NrZ)
�__code__r��co_argcount�co_varnames�__defaults__�__kwdefaults__r�rz�zipr�)
r�r�Z	pos_countZ	arg_names�defaultsZ
kwdefaultsr�Z
pos_offsetr��valuerZrZr[�
_get_defaults�s



rJcCs�t|dd�riSt|t�r�i}t|j�D]z}|dkrDtj|jj}n|}|j�	di�}|�
�D]B\}}|dkrvtd�}t|t�r�t|dd�}t
|||�}|||<q^q(|S|dkr�t|tj�r�|j}n"|}	t|	d�r�|	j}	q�t|	di�}|dkr�|}n|dk�r|}t|dd�}|dk�r6t|t��r(iStd�|���t|�}
t|�}|�
�D]d\}}|dk�rhtd�}t|t��r|t|�}t
|||�}||
k�r�|
|dk�r�t|}|||<�qN|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__Nr(Fr��__wrapped__�__globals__z1{!r} is not a module, class, method, or function.)rrPrO�reversedr+r��modulesr^r
r��itemsrQrr�r`�
ModuleTyper;rL�_allowed_typesrT�formatrJr�r)rdr�r�Zhintsr#Zbase_globals�annr�rIZnsobjrHrZrZr[rE�s^




�
cCs t|t�r|jS|tkrtSdS)a�Get the unsubscripted version of a type.

    This supports generic types, Callable, Tuple, Union, Literal, Final and ClassVar.
    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)rPrRrSr)rwrZrZr[rD�s

cCsRt|t�rN|jsN|j}t|�tjjkrJ|dtk	rJt	|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�rZ)
rPrRrmrsrDrrrr�rr)rwr�rZrZr[rCscCs�t|t�rt|j��}|j��D]"\}}||j|fkr|�|�q|��D](}t|tj	�r`d|_
t|t�rJt|�qJz
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)
rPrOr
�copyrPr!�pop�valuesr`rarKrGrT)rWZ	arg_attrsr�rrdrZrZr[rGs	




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|�}|Sr�)rG)r�r�r���	decoratorrZr[�wrapped_decorator@s
z2no_type_check_decorator.<locals>.wrapped_decorator)r�r�)rYrZrZrXr[rH9scOs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�rZrZr[�_overload_dummyIs�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�rZrZr[rJRscCs|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.
    rZ)�frZrZr[rBos�T�KT�VT�T_co)r��V_co�VT_co�T_contra)r��CT_co)r�r�cCst||d|d�S)NT)r�r�)rR)r�r�r�rZrZr[�_alias�srfrZ)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)r2z(An ABC with one abstract method __int__.rZ��returncCsdSr�rZr�rZrZr[�__int__�szSupportsInt.__int__N)rbr^r_r�r�r�intrirZrZrZr[r2�sc@s&eZdZdZdZeed�dd��ZdS)r0z*An ABC with one abstract method __float__.rZrgcCsdSr�rZr�rZrZr[�	__float__szSupportsFloat.__float__N)rbr^r_r�r�r�floatrkrZrZrZr[r0�sc@s&eZdZdZdZeed�dd��ZdS)r/z,An ABC with one abstract method __complex__.rZrgcCsdSr�rZr�rZrZr[�__complex__
szSupportsComplex.__complex__N)rbr^r_r�r�r�complexrmrZrZrZr[r/sc@s&eZdZdZdZeed�dd��ZdS)r.z*An ABC with one abstract method __bytes__.rZrgcCsdSr�rZr�rZrZr[�	__bytes__szSupportsBytes.__bytes__N)rbr^r_r�r�r�bytesrorZrZrZr[r.sc@s&eZdZdZdZeed�dd��ZdS)r1z*An ABC with one abstract method __index__.rZrgcCsdSr�rZr�rZrZr[�	__index__szSupportsIndex.__index__N)rbr^r_r�r�rrjrqrZrZrZr[r1sc@s&eZdZdZdZeed�dd��ZdS)r-zMAn ABC with one abstract method __abs__ that is covariant in its return type.rZrgcCsdSr�rZr�rZrZr[�__abs__(szSupportsAbs.__abs__N)rbr^r_r�r�rrarrrZrZrZr[r-#sc@s*eZdZdZdZedeed�dd��ZdS)	r3zOAn ABC with one abstract method __round__ that is covariant in its return type.rZr)�ndigitsrhcCsdSr�rZ)r�rsrZrZr[�	__round__2szSupportsRound.__round__N)r)	rbr^r_r�r�rrjrartrZrZrZr[r3-sc	std��fdd�|D�}t�|dd�|D��}t|�|_|_zt�d�j�dd�|_	Wnt
tfk
rnYnX|S)NzDNamedTuple('Name', [(f0, t0), (f1, t1), ...]); each t must be a typecsg|]\}}|t|��f�qSrZr��rg�nrhr�rZr[rk9sz!_make_nmtuple.<locals>.<listcomp>cSsg|]\}}|�qSrZrZrurZrZr[rk:sr�rbr�)r�
namedtupler�r(�_field_typesr�r�r�r�r^r�r�)r�r`�nm_tplrZr�r[�
_make_nmtuple7srz)r�r�r��__getnewargs__�_fields�_field_defaultsrx�_make�_replace�_asdictZ_source)r^rbr(cseZdZ�fdd�Z�ZS)�NamedTupleMetacs�|�dd�rt��||||�S|�di�}t||���}g}i}|D]H}||krl||}	|�|	�|	||<qD|rDtdj|d�|�	��d���qDt
|�|j_t|�|j_
||_|D]<}
|
tkr�td|
��q�|
tkr�|
|jkr�t||
||
�q�|S)Nr�Fr(zXNon-default namedtuple field {field_name} cannot follow default field(s) {default_names}r�)�
field_nameZ
default_namesz&Cannot overwrite NamedTuple attribute )r�r�r�rzrPrlrTrSrr,r�r(rprEr}�_prohibitedr�rmr|r)r{�typenamer�nsr`ryrHZ
defaults_dictr�Z
default_value�keyr�rZr[r�Os2

�
zNamedTupleMeta.__new__)rbr^r_r�r�rZrZr�r[r�Msr�c@s"eZdZdZdZdd�Zde_dS)r=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)])
    TcOs�|std��|^}}|r"|^}}n4d|krN|�d�}ddl}|jdtdd�ntd��|r�z
|\}Wq�tk
r�tdt|�d�d	��d�Yq�Xn<d
|kr�t|�dkr�|�d
�}ddl}|jdtdd�nd}|dkr�|��}n|r�td
��t||�S)Nz*NamedTuple.__new__(): not enough argumentsr�rz4Passing 'typename' as keyword argument is deprecatedr�)�
stacklevelzGNamedTuple.__new__() missing 1 required positional argument: 'typename'z@NamedTuple.__new__() takes from 2 to 3 positional arguments but z were given�fieldsr~z2Passing 'fields' as keyword argument is deprecatedzIEither list of fields or keywords can be provided to NamedTuple, not both)	rTrV�warnings�warn�DeprecationWarningr�rzrPrz)r�rr{r�r�r�rZrZr[r��sB

�
�

�
zNamedTuple.__new__z*($cls, typename, fields=None, /, **kwargs)N)rbr^r_r�r�r��__text_signature__rZrZrZr[r=ls#cOs
t||�Sr�)r�)r{r�rrZrZr[�	_dict_new�sr�)�totalc	Ksj|dkr|}n|rtd��t|�|d�}zt�d�j�dd�|d<Wnttfk
r\YnXt|d|�S)Nz@TypedDict takes either a dict or keyword arguments, but not both)r(�	__total__r~rbr�r^rZ)	rTr�r�r�r�r�r�r��_TypedDictMeta)r{r�r�r�rr�rZrZr[�_typeddict_new�sr�cCstd��dS)Nz4TypedDict does not support instance and class checksr�)r{r�rZrZr[�_check_fails�sr�cs&eZdZd�fdd�	ZeZZ�ZS)r�Tcs�|dkrtnt|d<tt|��||tf|�}|�di�}d��fdd�|��D�}|D]}|�|j	�di��qV||_
t|d�s�||_|S)agCreate new typed dict class object.

        This method is called directly when TypedDict is subclassed,
        or via _typeddict_new when TypedDict is instantiated. This way
        TypedDict supports all three syntax forms described in its docstring.
        Subclasses and instances of TypedDict return actual dictionaries
        via _dict_new.
        r>r�r(z?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typecsi|]\}}|t|���qSrZr�)rgrvrwr�rZr[�
<dictcomp>�sz*_TypedDictMeta.__new__.<locals>.<dictcomp>r�)
r�r�r�r�r�r�r�rP�updater
r(r;r�)r{r�rr�r�Ztp_dictZannsr#r�r�r[r��s	
z_TypedDictMeta.__new__)T)rbr^r_r�r�r�r�r�rZrZr�r[r��sr�c@seZdZdZdS)r>a�A 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 Point2D.__annotations__. 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+
    Nr%rZrZrZr[r>�scCsdd�}||_||_|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�rZ)�xrZrZr[�new_typeszNewType.<locals>.new_type)rbZ
__supertype__)r�rwr�rZrZr[rFsc@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)<�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.
    rZrgcCsdSr�rZr�rZrZr[�mode=szIO.modecCsdSr�rZr�rZrZr[r�BszIO.nameNcCsdSr�rZr�rZrZr[�closeGszIO.closecCsdSr�rZr�rZrZr[�closedKsz	IO.closedcCsdSr�rZr�rZrZr[�filenoPsz	IO.filenocCsdSr�rZr�rZrZr[�flushTszIO.flushcCsdSr�rZr�rZrZr[�isattyXsz	IO.isattyr�)rvrhcCsdSr�rZ)r�rvrZrZr[�read\szIO.readcCsdSr�rZr�rZrZr[�readable`szIO.readable)�limitrhcCsdSr�rZ)r�r�rZrZr[�readlinedszIO.readline)�hintrhcCsdSr�rZ)r�r�rZrZr[�	readlineshszIO.readlinesr)�offset�whencerhcCsdSr�rZ)r�r�r�rZrZr[�seeklszIO.seekcCsdSr�rZr�rZrZr[�seekablepszIO.seekablecCsdSr�rZr�rZrZr[�telltszIO.tell)�sizerhcCsdSr�rZ)r�r�rZrZr[�truncatexszIO.truncatecCsdSr�rZr�rZrZr[�writable|szIO.writable��srhcCsdSr�rZ�r�r�rZrZr[�write�szIO.write)�linesrhcCsdSr�rZ)r�r�rZrZr[�
writelines�sz
IO.writelinesz
IO[AnyStr]cCsdSr�rZr�rZrZr[�	__enter__�szIO.__enter__cCsdSr�rZ)r�rOrI�	tracebackrZrZr[�__exit__�szIO.__exit__)r�)r�)r�)r)N) rbr^r_r�r��propertyrrQr�r�r�r�r�rjr�r�r�r@r�r�r�r9r�r�r�r�r�r�r�r�r�r�rZrZrZr[r�.sZr�c@sBeZdZdZdZeeeefe	d�dd��Z
edd�dd��Zd	S)
�BinaryIOz5Typed version of the return of open() in binary mode.rZr�cCsdSr�rZr�rZrZr[r��szBinaryIO.writergcCsdSr�rZr�rZrZr[r��szBinaryIO.__enter__N)rbr^r_r�r�rrrp�	bytearrayrjr�r�rZrZrZr[r��sr�c@s�eZdZdZdZeeed�dd���Zeee	d�dd���Z
eeee	d�dd	���Zeee
d�d
d���Zeeed�dd
���Zedd�dd��ZdS)�TextIOz3Typed version of the return of open() in text mode.rZrgcCsdSr�rZr�rZrZr[�buffer�sz
TextIO.buffercCsdSr�rZr�rZrZr[�encoding�szTextIO.encodingcCsdSr�rZr�rZrZr[�errors�sz
TextIO.errorscCsdSr�rZr�rZrZr[�line_buffering�szTextIO.line_bufferingcCsdSr�rZr�rZrZr[�newlines�szTextIO.newlinescCsdSr�rZr�rZrZr[r��szTextIO.__enter__N)rbr^r_r�r�r�rr�r�rQr�rr�r�r�rr�r�rZrZrZr[r��s&r�c@s&eZdZdZdddgZeZeZeZdS)�ioz)Wrapper namespace for IO generic classes.r�r�r�N)rbr^r_r��__all__r�r�r�rZrZrZr[r��s

r�z.ioc@s eZdZdZddgZeZeZdS)�rez&Wrapper namespace for re type aliases.�Pattern�MatchN)rbr^r_r�r�r�r�rZrZrZr[r��sr�z.re)T)NN)T)N)�r�rrrrZcollections.abcr9r�rr�Z	stdlib_rer�r`rrrr�r\rerqrur}r�r�r�r�r�r�rUrrIr	r
rrr
rrr�r�rRrrr�r�Z_TYPING_INTERNALSZ_SPECIAL_NAMESr-r1r4r5r6r?r:rrKrArJra�BuiltinFunctionType�
MethodTyperQrRrErDrCrGrHr\rJrBr^r_r`rarbrcrdrOrerprQr@rfrr%r(r'r&rrr,r#rr)rr;rr!rrr"r rrprrrr9r�r6rr�r<rrrr$r7rr8r+r�r7r�r8r:r5r4r?r*rr2r0r/r.r1r-r3rzr�rmr�r=r�r�r�r�r>rFrLrMr�r�r�r�rbrOr�r�rZrZrZr[�<module>s(�X
!
	
I��
�����2a�
/[����	b�
V	
�
�	�							@+c#	



?>