o
    ^+)hmT                    @   sn
  d dl Z d dlZd dlZd dlZd dlZd dlZejdd dkZer&eZ	nd dlm	Z	m
Z
 dd Zdd Zg d	ZerCeg d
 eedrLejZnG dd dejddZeddZedZedZedZejdddZejdddZejZeedrejdd dkrejZn+ejdd dkrG dd dejddZedddZnG dd dejddZeddZeed rejZnd!d  Zd"d# Zeed$rej Z n+ejdd dkrG d%d& d&ejddZ!e!d$d'dZ nG d(d) d)ejddZ"e"ddZ ej#Z#ej$Z$ej%Z%G d*d+ d+e	Z&ej'Z'ej(Z(ej)Z)ej*Z*eed,r%ej+Z+nG d-d, d,ej,ej-e e&ej,d.Z+ej.Z.eed/rCej/Z/nd d0l0m1Z2 G d1d/ d/ej3e Z/ej4Z4eed2raej5Z5n0dejdd   krrd3k r~n n
e6ej5eefZ5nG d4d2 d2ej5ej7eef e&ej5d.Z5eed5rej8Z8nG d6d5 d5ej8ej9ee:f e&ej8d.Z8eed7rej;Z;need7rG d8d7 d7ej;ej7eef e&ej;d.Z;eed9rej<Z<nG d:d9 d9e*e ej3eef e&ej j<d.Z<ej=Z=ej>Z>ej?Z?d;d< Z@g d=ZAd>d? ZBd@dA ZCeedBrejDZDn=er3d dClmEZE dDdE ZFG dFdG dGe jGZHG dHdB dBeHdIZDnd dJlmIZImJZJ dKdE ZFG dLdG dGe	ZHG dMdB dBeHdIZDeedNrZejKZKndOdN ZKeKZLeedPrjejMZMn
eKG dQdP dPeDZMejdRkr~ejNZNn*dSdT ZOdUdV ZPdWeP_QddXdYdZZRd[eR_QG d\d] d]eZSeSd^eTfi ZNeUeN_Vd_eN_Weed`rejXZXejYZYejZZZn5erG dadb dbej[ddZZG dcd` d`ZXddde Z\ddgdhZYndidj Z]G dkdl dlej	Z^G dmd` d`e^dIZXejdd dnkrej_Z_ej`Z`n7er5zd dolmaZa W n eby   ej[ZaY nw zd dplmcZc W n eby,   ej[ZcY nw dqdr Z_dsdt Z`eedur?ejdZdnRejdd dvkr[G dwdx dxejddZeeedydu Zdn6ejdd dkrwG dzdx dxejddZeeedud{dZdnG d|d} d}ejfZgG d~d dejegddZhehddZdeedrejiZiejjZjnG dd dZkG dd dekZiG dd dekZjeedrejlZlnG dd demZleedsG dd demZnejodd ZpeedrejqZqejnZnnGejdd dvkreedd Zqn6ejdd dkrG dd dejddZrerdddZqnG dd dejfZsG dd dejesddZtetddZqeedr:ejuZunHejdd dvkrVG dd dejddZvevdd Zun,ejdd dkrrG dd dejddZvevdddZunG dd dejddZwewddZueedrejxZxn,ejdd dkrG dd dejddZedd ZxnG dd dejddZyeyddZxeedrejzZzej{Z{dS ejdd dvkrG dd dejddZ|e|dd Zze|dd Z{dS ejdd dkrG dd dejddZ}e}dddZze}dddZ{dS G dd dejddZ~G dd de~ddZG dd de~ddZeddZzeddZ{dS )    N   )r      r   )GenericMeta
_type_varsc                 C   s.   t | }d|v r|d D ]}||d  q|S )N	__slots__)dictpop)dctZ	dict_copyZslot r
   cC:\Users\User\Downloads\Proyecto_IoT\venv\Lib\site-packages\setuptools/_vendor/typing_extensions.py_no_slots_copy   s
   r   c              	   C   s^   | j s
t|  dt|}t| j }||kr-td||krdnd d|  d| d| d S )Nz is not a generic classzToo manyfewz arguments for z	; actual z, expected )__parameters__	TypeErrorlen)cls
parametersalenelenr
   r
   r   _check_generic   s   
r   )!ClassVarConcatenateFinal	ParamSpecSelfType	AwaitableAsyncIteratorAsyncIterable	CoroutineAsyncGeneratorAsyncContextManagerChainMapContextManagerCounterDequeDefaultDictOrderedDict	TypedDictSupportsIndex	AnnotatedfinalIntVarLiteralNewTypeoverloadProtocolruntimeruntime_checkableText	TypeAlias	TypeGuardTYPE_CHECKING)get_args
get_originget_type_hintsNoReturnc                   @   $   e Zd ZdZdZdd Zdd ZdS )	_NoReturna7  Special type indicating functions that never return.
        Example::

          from typing import NoReturn

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

        This type is invalid in other positions, e.g., ``List[NoReturn]``
        will fail in static type checkers.
        r
   c                 C      t d)Nz*NoReturn cannot be used with isinstance().r   selfobjr
   r
   r   __instancecheck__m      z_NoReturn.__instancecheck__c                 C   r>   )Nz*NoReturn cannot be used with issubclass().r?   rA   r   r
   r
   r   __subclasscheck__p   rD   z_NoReturn.__subclasscheck__N__name__
__module____qualname____doc__r   rC   rF   r
   r
   r
   r   r=   _   s
    r=   T_rootTKTVTT_co)	covariantT_contra)contravariantr      )r   r   c                   @      e Zd Zdd Zdd ZdS )
_FinalFormc                 C   
   d| j  S Nztyping_extensions._namerA   r
   r
   r   __repr__      
z_FinalForm.__repr__c                 C   "   t || j d}t | |fS )N accepts only single typetyping_type_checkr[   _GenericAliasrA   r   itemr
   r
   r   __getitem__      
z_FinalForm.__getitem__NrH   rI   rJ   r]   rg   r
   r
   r
   r   rW          rW   aW  A special typing construct to indicate that a 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.)docc                       N   e Zd ZdZdZdddZdd Zdd	 Z fd
dZdd Z	dd Z
  ZS )_Finala  A special typing construct to indicate that a 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.
        __type__Nc                 K   
   || _ d S Nrn   rA   tpkwdsr
   r
   r   __init__   r^   z_Final.__init__c                 C   N   t | }| jd u r|t||jdd   dddS t|jdd   d)N    accepts only single type.TrL    cannot be further subscriptedtypero   rb   rc   rH   r   rA   rf   r   r
   r
   r   rg         
z_Final.__getitem__c                 C   .   t | j||}|| jkr| S t| |ddS NTrL   rb   
_eval_typero   r{   rA   globalnslocalnsZnew_tpr
   r
   r   r         
z_Final._eval_typec                    0   t   }| jd ur|dt| j d7 }|S N[]superr]   ro   rb   
_type_reprrA   r	__class__r
   r   r]         

z_Final.__repr__c                 C      t t| j| jfS rq   hashr{   rH   ro   r\   r
   r
   r   __hash__      z_Final.__hash__c                 C   ,   t |tstS | jd ur| j|jkS | |u S rq   )
isinstancerm   NotImplementedro   rA   otherr
   r
   r   __eq__   
   

z_Final.__eq__rq   rH   rI   rJ   rK   r   ru   rg   r   r]   r   r   __classcell__r
   r
   r   r   rm      s    
rm   r,   c                 C      | S )au  This decorator can be used to indicate to type checkers that
        the decorated method cannot be overridden, and decorated class
        cannot be subclassed. For example:

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

        There is no runtime checking of these properties.
        r
   )fr
   r
   r   r,      s   c                 C   
   t | S rq   )rb   TypeVarnamer
   r
   r   r-      r^   r-   r.   c                   @   rV   )_LiteralFormc                 C   rX   rY   rZ   r\   r
   r
   r   r]      r^   z_LiteralForm.__repr__c                 C   s   t | |S rq   )rb   rd   rA   r   r
   r
   r   rg         z_LiteralForm.__getitem__Nri   r
   r
   r
   r   r      rj   r   ao  A type that can be used to indicate to type checkers
                           that the corresponding value has a value literally equivalent
                           to the provided parameter. For example:

                               var: Literal[4] = 4

                           The type checker understands that 'var' is literally equal to
                           the value 4 and no other value.

                           Literal[...] cannot be subclassed. There is no runtime
                           checking verifying that the parameter is actually a value
                           instead of a type.c                       rl   )_Literala  A type that can be used to indicate to type checkers that the
        corresponding value has a value literally equivalent to the
        provided parameter. For example:

            var: Literal[4] = 4

        The type checker understands that 'var' is literally equal to the
        value 4 and no other value.

        Literal[...] cannot be subclassed. There is no runtime checking
        verifying that the parameter is actually a value instead of a type.
        
__values__Nc                 K   rp   rq   r   )rA   valuesrt   r
   r
   r   ru   !  r^   z_Literal.__init__c                 C   sF   t | }| jd u rt|ts|f}||ddS t|jdd   d)NTrL   rw   ry   )r{   r   r   tupler   rH   )rA   r   r   r
   r
   r   rg   $  s   

z_Literal.__getitem__c                 C   r   rq   r
   )rA   r   r   r
   r
   r   r   ,     z_Literal._eval_typec                    s8   t   }| jd ur|ddttj| j d7 }|S )Nr   , r   )r   r]   r   joinmaprb   r   r   r   r
   r   r]   /  s   

 z_Literal.__repr__c                 C   r   rq   )r   r{   rH   r   r\   r
   r
   r   r   5  r   z_Literal.__hash__c                 C   r   rq   )r   r   r   r   r   r
   r
   r   r   8  r   z_Literal.__eq__rq   r   r
   r
   r   r   r     s    
r   c                          e Zd Z fddZ  ZS )_ExtensionsGenericMetac                    s   | j durtdjd dvrtddS | jst |S | j|}|t	ur*|S | j|j
v r2dS | j D ]}t|tr?q7t||rG dS q7dS )a*  This mimics a more modern GenericMeta.__subclasscheck__() logic
        (that does not have problems with recursion) to work around interactions
        between collections, typing, and typing_extensions on older
        versions of Python, see https://github.com/python/typing/issues/501.
        Nrw   rH   abc	functoolsCParameterized generics cannot be used with class or instance checksFT)
__origin__sys	_getframe	f_globalsr   	__extra__r   rF   __subclasshook__r   __mro____subclasses__r   r   
issubclass)rA   subclassressclsr   r
   r   rF   N  s$   


z(_ExtensionsGenericMeta.__subclasscheck__)rH   rI   rJ   rF   r   r
   r
   r   r   r   M  s    r   r&   c                   @      e Zd ZdZdd ZdS )r&   r
   c                 O   s6   | j tu rtj|i |S tjtj| g|R i |S rq   )_gorgr&   collectionsdequerb   _generic_newr   argsrt   r
   r
   r   __new__w     
zDeque.__new__NrH   rI   rJ   r   r   r
   r
   r
   r   r&   r  s    )	metaclassextrar"   )_check_methodsc                   @   s2   e Zd ZdZdd Zejdd Zedd Z	dS )	r"   r
   c                    s   | S rq   r
   r\   r
   r
   r   
__aenter__  s   zAsyncContextManager.__aenter__c                    s   d S rq   r
   )rA   exc_type	exc_value	tracebackr
   r
   r   	__aexit__  s   zAsyncContextManager.__aexit__c                 C   s   | t u r
t|ddS tS )Nr   r   )r"   _check_methods_in_mror   )r   Cr
   r
   r   r     s   z$AsyncContextManager.__subclasshook__N)
rH   rI   rJ   r   r   r   abstractmethodr   classmethodr   r
   r
   r
   r   r"     s    
r(   )r   r   rU   c                   @   r   )r(   r
   c                 O   6   | j tu rtj|i |S tjtj| g|R i |S rq   )r   r(   r   rb   r   r   r
   r
   r   r     r   zOrderedDict.__new__Nr   r
   r
   r
   r   r(         r%   c                   @   r   )r%   r
   c                 O   r   rq   )r   r%   r   rb   r   r   r
   r
   r   r     r   zCounter.__new__Nr   r
   r
   r
   r   r%     r   r#   c                   @   r   )r#   r
   c                 O   r   rq   )r   r#   r   rb   r   r   r
   r
   r   r     r   zChainMap.__new__Nr   r
   r
   r
   r   r#     r   r!   c                   @      e Zd ZdZdS )r!   r
   N)rH   rI   rJ   r   r
   r
   r
   r   r!     s    c                 C   s<   t | tsJ t| dr| jS | jdur| j} | jdus| S )z@This function exists for compatibility with old typing versions.r   N)r   r   hasattrr   r   r   r
   r
   r   r     s   


r   )Callabler   IterableIteratorr   r   HashableSized	Container
Collection
Reversibler$   r"   c                 C   sr   t  }| jd d D ],}|jdv rq
t|di }t|j t|  D ]}|ds5|dvr5|| q%q
|S )N)r1   Generic__annotations___abc_)__abstractmethods__r   __weakref___is_protocol_is_runtime_protocol__dict____args__r   __next_in_mro__r   r   __orig_bases__r   __tree_hash__rK   r   ru   r   rI   _MutableMapping__markerr   )	setr   rH   getattrlistr   keys
startswithadd)r   attrsbaseannotationsattrr
   r
   r   _get_protocol_attrs  s   


r   c                    s   t  fddt D S )Nc                 3   s     | ]}t t |d V  qd S rq   )callabler   .0r   r   r
   r   	<genexpr>      z,_is_callable_members_only.<locals>.<genexpr>)allr   r   r
   r   r   _is_callable_members_only  s   r  r1   )_collect_type_varsc                 O      t | jr	tdd S Nz Protocols cannot be instantiatedr{   r   r   rA   r   kwargsr
   r
   r   _no_init     
r  c                       r   )_ProtocolMetac                    sV   t  ddr
t rtj rdS  jr%t fddt D r%dS t S )Nr   FTc                 3   s:    | ]}t |ott |d  pt|d uV  qd S rq   r   r   r   r  r   instancer
   r   r        

2_ProtocolMeta.__instancecheck__.<locals>.<genexpr>)	r   r  r   r   r   r  r   r   rC   r  r   r  r   rC     s   
_ProtocolMeta.__instancecheck__)rH   rI   rJ   rC   r   r
   r
   r   r   r  	  s    r  c                       s>   e Zd ZdZdZdZ fddZejdd Z	dd	 Z
  ZS )
r1   a  Base 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_extensions.runtime act as simple-minded runtime protocol that checks
        only the presence of given attributes, ignoring their type signatures.

        Protocol classes can be generic, they are defined as::

            class GenProto(Protocol[T]):
                def meth(self) -> T:
                    ...
        r
   Tc                    s   | t u rtdt | S )NzIType Protocol cannot be instantiated; it can only be used as a base class)r1   r   r   r   r   r   r
   r   r   >  s   Protocol.__new__c                    s   t |ts|f}|s| tjurtd| j dd t fdd|D }| tu retdd |D sVd}t || tjrH|d7 }t || tjs<td	|d  d
||  t	t
|t	|krdtdnt| | t| |S )NParameter list to [...] cannot be empty*Parameters to generic types must be types.c                 3       | ]	}t | V  qd S rq   rb   rc   r  pmsgr
   r   r  L      z-Protocol.__class_getitem__.<locals>.<genexpr>c                 s       | ]	}t |tjV  qd S rq   r   rb   r   r  r
   r
   r   r  O  r   r   rw   zBParameters to Protocol[...] must all be type variables. Parameter z is z.Parameters to Protocol[...] must all be unique)r   r   rb   Tupler   rJ   r1   r  r   r   r   r   rd   )r   paramsir
   r  r   __class_getitem__D  s8   

zProtocol.__class_getitem__c                    s  g }d j v rtj jv }ntj jv }|rtdd j v rt j}d } jD ]}t|tjrH|j	tjt
fv rH|j	j}|d urEtd|j}q)|d u rP|}n2t|}t||ksdfdd|D }	ddd |D }
td|	 d	| d
|
 d|}t| _ j dd stdd  jD  _ fdd}d j vr| _ jsd S  jD ]$}|ttjfv s|jdkr|jtv st|tr|jstdt| qt _d S )Nr   !Cannot inherit from plain GenericzECannot inherit from Generic[...] and/or Protocol[...] multiple types.r   c                 3        | ]}| vrt |V  qd S rq   strr  tgvarsetr
   r   r  ~  r  z-Protocol.__init_subclass__.<locals>.<genexpr>c                 s       | ]}t |V  qd S rq   r)  r  gr
   r
   r   r        Some type variables () are not listed in r   r   r   c                 s   s    | ]}|t u V  qd S rq   )r1   r  br
   r
   r   r    r2  c                    s    j dd s	tS t ddstdjd dv rtS tdt s3tdjd dv r/tS tdt	| t
s<td	t D ]:}| jD ]0}||j v r[|j | d u rYt    S  nt|d
i }t	|tjru||v rut	| tru| jru nqEt  S q@dS )Nr   r   FrU   rH   r   BInstance and class checks can only be used with @runtime protocols<Protocols with non-method members don't support issubclass()"issubclass() arg 1 must be a classr   T)r   getr   r   r   r   r   r   r  r   r{   r   r   rb   Mappingr  r   r   r   r   r   r   r
   r   _proto_hook  s<   


z/Protocol.__init_subclass__.<locals>._proto_hookr   collections.abc5Protocols can only inherit from other protocols, got )r   rb   r   r   	__bases__r   r  r   rd   r   r1   rH   r   r   r   r   r:  anyr   r   objectrI   _PROTO_WHITELISTr  reprr  ru   )r   r   r  tvarserrorgvarsr   Zthe_basetvarsets_varss_argsr=  r
   )r   r.  r   __init_subclass__^  sj   











zProtocol.__init_subclass__)rH   rI   rJ   rK   r   r   r   rb   	_tp_cacher&  rK  r   r
   r
   r   r   r1     s    
)r   )_next_in_mrorc   c                 O   r  r	  r
  r  r
   r
   r   r    r  c                       sV   e Zd ZdZ	d fdd	Z fddZ fddZ fd	d
Zej	dd Z
  ZS )r  zInternal metaclass for Protocol.

        This exists so Protocol classes can be generic without deriving
        from Generic.
        Nc	                    sT  |d u sJ |d ur|d usJ t dd |D sJ |nrt|}d }	|D ]#}
|
tju r1tdt|
trI|
jtjtfv rI|	d urFtd|
j	}	q&|	d u rQ|}	n?t
|}t
|	 | ksd fdd|D }ddd |	D }tdd |D r~d	nd
}td| d| d| d|	}|}|d urt|tju r||vr|f| }tdd |D }tdd |D rtdd |D }|||d tt| j| |||dd}tt|d|s|nt| ||_	|rtdd |D nd |_t||_|d u r||_n|d ur|j|_|j|_t|dr(|r t| ntt| |_ |S )Nc                 s   r!  rq   r"  r+  r
   r
   r   r    r   z(_ProtocolMeta.__new__.<locals>.<genexpr>r'  zACannot inherit from Generic[...] or Protocol[...] multiple times.r   c                 3   r(  rq   r)  r+  r-  r
   r   r    r  c                 s   r/  rq   r)  r0  r
   r
   r   r    r2  c                 s   s    | ]	}|j tju V  qd S rq   )r   rb   r   r5  r
   r
   r   r    s    r   r1   r3  r4  r   r   c                 s   s&    | ]}t |trt|n|V  qd S rq   )r   r   r   r5  r
   r
   r   r    s    c                 s   s$    | ]}t |to|tjuV  qd S rq   )r   r   rb   r   r5  r
   r
   r   r    s   " c                 s   s    | ]
}|t jur|V  qd S rq   )rb   r   r5  r
   r
   r   r    s    )r   r   TrL   r   c                 s   s0    | ]}|t ju rd n|t ju rdn|V  qdS ).r
   N)rb   _TypingEllipsis_TypingEmptyr  ar
   r
   r   r    s    

_subs_tree)!r  r   rb   r   r   r   r   r   r1   r   r   r   rA  r{   r   ABCMetar   updater   r   __setattr__r   r   rM  r   r   _abc_registry
_abc_cacher   r   rR  r   r   )r   r   bases	namespacerE  r   originr   
orig_basesrG  r   rH  rI  rJ  cls_nameZinitial_basesrA   r   r-  r   r     s   








z_ProtocolMeta.__new__c                    s   t  j|i |  jdd stdd  jD  _ jrY jdd  D ]0}|tt	j
fv sU|jdkr8|jtv sUt|t	jrA|jsUt|trL|jt	j
u sUtdt| q%t _ fdd}d	 jvri| _d S d S )
Nr   c                 s   s,    | ]}|t u pt|to|jt u V  qd S rq   )r1   r   r  r   r5  r
   r
   r   r  
  s    

z)_ProtocolMeta.__init__.<locals>.<genexpr>rw   r>  r?  c                    s    j dd s	tS t| tstdt D ]:}| jD ]0}||j v r1|j | d u r/t    S  nt|di }t|t	j
rK||v rKt| trK| jrK nqt  S qdS )Nr   r9  r   T)r   r:  r   r   r{   r   r   r   r   rb   r;  r  r   r<  r   r
   r   r=    s,   


z+_ProtocolMeta.__init__.<locals>._proto_hookr   )r   ru   r   r:  rA  r@  r   r   rB  rb   r   rI   rH   rC  r   
TypingMetar   r   r   rD  r  r   )r   r   r  r   r=  r   r   r   ru     s4   





z_ProtocolMeta.__init__c                    sZ   t ddr
trt jrdS jr%t fddtD r%dS tt	 S )Nr   FTc                 3   s:    | ]}t  |ott|d  pt |d uV  qd S rq   r  r  r  rA   r
   r   r  ;  r  r  )
r   r  r   r   r   r  r   r   r   rC   )rA   r  r   r^  r   rC   3  s   
r  c                    s   | j d urtdjd dvrtddS | jdd r3| jdd s3tdjd dv r/dS td	| jdd rTt| sTtdjd dv rPtt	| 
|S td
tt	| 
|S )Nrw   rH   r   r   Fr   r   r   r   rb   r7  r8  )r   r   r   r   r   r   r:  r  r   r   rF   rE   r   r
   r   rF   B  s"   
z_ProtocolMeta.__subclasscheck__c              
      sJ  t |ts|f}|st| tjurtd| j dd t fdd|D }| tjtfv rZt	dd |D sAtdt
|  dtt|t|krUtdt
|  d	|}|}n+| tjtjfv rit|}|}n| jtjtfv rztd
t
|  t| | t|}|}| jd u r| fnd}| j| j|| j t| j||| | j| jdS )Nr  r  r  c                 3   s    | ]}t | V  qd S rq   )rc   r  r  r
   r   r  d  s    z,_ProtocolMeta.__getitem__.<locals>.<genexpr>c                 s   r!  rq   r"  r  r
   r
   r   r  f  r   zParameters to z [...] must all be type variablesz[...] must all be uniquez%Cannot subscript already-subscripted r
   )rE  r   rZ  r   r[  )r   r   r   rb   r#  r   rJ   r   r1   r  rD  r   r   r   r   r   r   r   rH   r@  r   r   r   r   )rA   r$  rE  r   prependr
   r  r   rg   Z  sJ   

z_ProtocolMeta.__getitem__)NNNNN)rH   rI   rJ   rK   r   ru   rC   rF   rb   rL  rg   r   r
   r
   r   r   r    s    @,c                   @   s    e Zd ZdZdZdZdd ZdS )r1   a  Base 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_extensions.runtime act as simple-minded runtime protocol that checks
        only the presence of given attributes, ignoring their type signatures.

        Protocol classes can be generic, they are defined as::

          class GenProto(Protocol[T]):
              def meth(self) -> T:
                  ...
        r
   Tc                 O   s0   t | tu r
tdtj| j| g|R i |S )NzIType Protocol cannot be instantiated; it can be used only as a base class)r   r1   r   rb   r   r   r   r
   r
   r   r     s   r  N)rH   rI   rJ   rK   r   r   r   r
   r
   r
   r   r1     s
    r3   c                 C   s(   t | tr| jstd| d| _| S )a4  Mark a protocol class as a runtime protocol, so that it
        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 the
        one-offs in collections.abc such as Hashable.
        z@@runtime_checkable can be only applied to protocol classes, got T)r   r  r   r   r   r   r
   r
   r   r3     s   r*   c                   @   s$   e Zd ZdZejdefddZdS )r*   r
   returnc                 C      d S rq   r
   r\   r
   r
   r   	__index__  s   zSupportsIndex.__index__N)rH   rI   rJ   r   r   r   intrc  r
   r
   r
   r   r*     s    )r   	   rU   c              	   C   s<   zt djd dvrtdW dS  ttfy   Y dS w )Nrw   rH   r_  z4TypedDict does not support instance and class checksF)r   r   r   r   AttributeError
ValueError)r   r   r
   r
   r   _check_fails  s   rh  c                  O   s0   | st d| d | dd  }} t| i |S )N)TypedDict.__new__(): not enough argumentsr   rw   )r   r   )r   r  _r
   r
   r   	_dict_new  s   rk  z,($cls, _typename, _fields=None, /, **kwargs)totalc              	   O   sN  |st d|d |dd  }}|r|d |dd  }}nd|v r5|d}dd l}|jdtdd nt d|rTz|\}W n1 tyS   t d	t|d  d
w d|v rpt|dkrp|d}dd l}|jdtdd nd }|d u ry|}n|rt ddt|i}zt	dj
dd|d< W n ttfy   Y nw t|d|| dS )Nri  r   rw   Z	_typenamez5Passing '_typename' as keyword argument is deprecatedrU   )
stacklevelzGTypedDict.__new__() missing 1 required positional argument: '_typename'z?TypedDict.__new__() takes from 2 to 3 positional arguments but z were given_fieldsz3Passing '_fields' as keyword argument is deprecatedz@TypedDict takes either a dict or keyword arguments, but not bothr   rH   __main__rI   r
   rl  )r   r   warningswarnDeprecationWarningrg  r   r   r   r   r   r:  rf  _TypedDictMeta)rm  r   r  rj  typenamerq  fieldsnsr
   r
   r   _typeddict_new  sL   




rx  z;($cls, _typename, _fields=None, /, *, total=True, **kwargs)c                       s4   e Zd Zd fdd	Zd fdd	Ze ZZ  ZS )rt  Tc                    s   t  ||| d S rq   )r   ru   )r   r   rX  rw  rm  r   r
   r   ru     r   z_TypedDictMeta.__init__c                    s  |dkrt nt|d< t | |tf|}i }|di }t| }d  fdd| D }t }	t }
|D ] }|	|j
di  |		|j
dd |
	|j
d	d q7|	| |re|		| n|
	| ||_t|	|_t|
|_t|d
s||_|S )Nr)   r   r   z?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typec                    s   i | ]\}}|t | qS r
   r  )r  nrs   r  r
   r   
<dictcomp>*  s    z*_TypedDictMeta.__new__.<locals>.<dictcomp>__required_keys__r
   __optional_keys__	__total__)rx  rk  r   r   r   r:  r   r   itemsrT  r   r   	frozensetr{  r|  r   r}  )r   r   rX  rw  rm  tp_dictr   own_annotationsown_annotation_keysrequired_keysoptional_keysr   r   r  r   r     s2   





z_TypedDictMeta.__new__)T)	rH   rI   rJ   ru   r   rh  rC   rF   r   r
   r
   r   r   rt    s    &rt  r)   a  A simple typed name space. 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, with each key
        associated with a value of a consistent type. This expectation
        is not checked at runtime but is only enforced by type checkers.
        Usage::

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

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

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

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

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

        The class syntax is only supported in Python 3.6+, while two other
        syntax forms work for Python 2.7 and 3.2+
        r+   c                       sH   e Zd ZdZ fddZdd Zdd Zdd	 Zd
d Zdd Z	  Z
S )_AnnotatedAliasaK  Runtime representation of an annotated type.

        At its core 'Annotated[t, dec1, dec2, ...]' is an alias for the type 't'
        with extra annotations. The alias behaves like a normal typing alias,
        instantiating is the same as instantiating the underlying type, binding
        it to types is also the same.
        c                    s2   t |tr|j| }|j}t || || _d S rq   )r   r  __metadata__r   r   ru   )rA   rZ  metadatar   r
   r   ru   v  s
   


z_AnnotatedAlias.__init__c                 C   s$   t |dksJ |d }t|| jS )Nrw   r   )r   r  r  )rA   r$  new_typer
   r
   r   	copy_with}  s   z_AnnotatedAlias.copy_withc                 C   s,   dt | j dddd | jD  dS )Nztyping_extensions.Annotated[r   c                 s   r/  rq   rD  rP  r
   r
   r   r    r2  z+_AnnotatedAlias.__repr__.<locals>.<genexpr>r   )rb   r   r   r   r  r\   r
   r
   r   r]     s   z_AnnotatedAlias.__repr__c                 C   s   t jt| jf| j ffS rq   )operatorgetitemr+   r   r  r\   r
   r
   r   
__reduce__  s   z_AnnotatedAlias.__reduce__c                 C   s*   t |tstS | j|jkrdS | j|jkS )NF)r   r  r   r   r  r   r
   r
   r   r     s
   
z_AnnotatedAlias.__eq__c                 C      t | j| jfS rq   )r   r   r  r\   r
   r
   r   r        z_AnnotatedAlias.__hash__)rH   rI   rJ   rK   ru   r  r]   r  r   r   r   r
   r
   r   r   r  n  s    r  c                   @   s2   e Zd ZdZdZdd Zejdd Zdd Z	d	S )
r+   a  Add context specific metadata to a type.

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

        The first argument to Annotated must be a valid type (and will be in
        the __origin__ field), the remaining arguments are kept as a tuple in
        the __extra__ field.

        Details:

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

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

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

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

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

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

            OptimizedList = Annotated[List[T], runtime.Optimize()]
            OptimizedList[int] == Annotated[List[int], runtime.Optimize()]
        r
   c                 O   r>   )Nz&Type Annotated cannot be instantiated.r?   r   r   r  r
   r
   r   r     rD   zAnnotated.__new__c                 C   sL   t |trt|dk rtdd}t|d |}t|dd  }t||S )NrU   zUAnnotated[...] should be used with at least two arguments (a type and an annotation).$Annotated[t, ...]: t must be a type.r   rw   )r   r   r   r   rb   rc   r  )r   r$  r  rZ  r  r
   r
   r   r&    s   
zAnnotated.__class_getitem__c                 O   s   t d| j d)NCannot subclass z
.Annotated)r   rI   r  r
   r
   r   rK    s   zAnnotated.__init_subclass__N)
rH   rI   rJ   rK   r   r   rb   rL  r&  rK  r
   r
   r
   r   r+     s     

c                 C   s\   t | tr
t| jS t | tjr,tdd | jD }|| jkr!| S | |}| j	|_	|S | S )z2Strips the annotations from a given type.
        c                 s   r/  rq   _strip_annotationsrP  r
   r
   r   r    r2  z%_strip_annotations.<locals>.<genexpr>)
r   r  r  r   rb   rd   r   r   r  _special)r,  stripped_argsr   r
   r
   r   r    s   



r  Fc                 C   s*   t j| ||d}|r|S dd | D 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, adds Optional[t] if a
        default value equal to None is set and recursively replaces all
        'Annotated[T, ...]' with 'T' (unless 'include_extras=True').

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

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

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

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

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

        - If two dict arguments are passed, they specify globals and
          locals, respectively.
        )r   r   c                 S   s   i | ]	\}}|t |qS r
   r  )r  kr,  r
   r
   r   rz    s    z"get_type_hints.<locals>.<dictcomp>)rb   r:   r~  )rB   r   r   include_extrashintr
   r
   r   r:     s   r:   c                 C   s    t | dko| do| dS )z3Returns True if name is a __dunder_variable_name__.   __)r   r   endswithr   r
   r
   r   
_is_dunder  s    r  c                       s   e Zd ZdZ fddZedd Zdd Zd fd	d
	Zdd Z	e
j fddZdd Zdd Z fddZdd Zdd Z  ZS )AnnotatedMetazMetaclass for Annotatedc                    s<   t dd |D rtdtt t j| |||fi |S )Nc                 s   s    | ]}|t uV  qd S rq   )rB  r5  r
   r
   r   r    r2  z(AnnotatedMeta.__new__.<locals>.<genexpr>r  )rA  r   r*  r+   r   r   )r   r   rX  rY  r  r   r
   r   r   
  s   zAnnotatedMeta.__new__c                 C   s   |   d S )NrU   )rR  r\   r
   r
   r   r       zAnnotatedMeta.__metadata__c                 C   sX   |\}}}t |tst|}n|d |}ddd |D }| d| d| dS )Nr   r   c                 s   r/  rq   r  r  argr
   r
   r   r    r2  z+AnnotatedMeta._tree_repr.<locals>.<genexpr>r   r   )r   r   rb   r   
_tree_reprr   )rA   treer   rZ  r  Ztp_reprZmetadata_reprsr
   r
   r   r    s   

zAnnotatedMeta._tree_reprNc                    sh   | t u rt S t j||d}t|d tr2|d d t u r2|d d }|d d }t |||d  fS |S )N)rE  r   rw   r   rU   )r+   r   rR  r   r   )rA   rE  r   r   Zsub_tpZ	sub_annotr   r
   r   rR    s   zAnnotatedMeta._subs_treec                 C   sd   | j du r	td|  }t|tr'|d tu r'|d }t|tr'|d tu st|tr0|d S |S )z6Return the class used to create instance of this type.NzCCannot get the underlying type of a non-specialized Annotated type.r   rw   )r   r   rR  r   r   r+   )rA   r  r
   r
   r   	_get_cons'  s   

zAnnotatedMeta._get_consc                    s   t |ts|f}| jd urt |S t |trt|dk r"tdd}t|d |}t|dd  }| j	| j
| jt| jt|f||f| dS )NrU   z]Annotated[...] should be instantiated with at least two arguments (a type and an annotation).r  r   rw   )rE  r   rZ  )r   r   r   r   rg   r   r   rb   rc   r   rH   r@  r   r   r   )rA   r$  r  rs   r  r   r
   r   rg   4  s"   

zAnnotatedMeta.__getitem__c                 O   s8   |   }||i |}z| |_W |S  ty   Y |S w rq   )r  __orig_class__rf  )rA   r   r  Zconsresultr
   r
   r   __call__L  s   zAnnotatedMeta.__call__c                 C   s(   | j d urt|st|  |S t|rq   )r   r  r   r  rf  )rA   r   r
   r
   r   __getattr__U  s   zAnnotatedMeta.__getattr__c                    sJ   t |s	|drt || d S | jd u rt|t|  || d S )Nr   )r  r   r   rU  r   rf  setattrr  )rA   r   valuer   r
   r   rU  [  s
   
zAnnotatedMeta.__setattr__c                 C   r>   )Nz+Annotated cannot be used with isinstance().r?   r@   r
   r
   r   rC   c  rD   zAnnotatedMeta.__instancecheck__c                 C   r>   )Nz+Annotated cannot be used with issubclass().r?   rE   r
   r
   r   rF   f  rD   zAnnotatedMeta.__subclasscheck__)NN)rH   rI   rJ   rK   r   propertyr  r  rR  r  rb   rL  rg   r  r  rU  rC   rF   r   r
   r
   r   r   r    s    
		r  c                   @   r   )r+   av  Add context specific metadata to a type.

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

        The first argument to Annotated must be a valid type, the remaining
        arguments are kept as a tuple in the __metadata__ field.

        Details:

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

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

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

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

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

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

            OptimizedList = Annotated[List[T], runtime.Optimize()]
            OptimizedList[int] == Annotated[List[int], runtime.Optimize()]
        NrH   rI   rJ   rK   r
   r
   r
   r   r+   i      )r   
   )_BaseGenericAlias)GenericAliasc                 C   s>   t | trtS t | tjttttfr| j	S | tj
u rtj
S dS )a6  Get the unsubscripted version of a type.

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

            get_origin(Literal[42]) is Literal
            get_origin(int) is None
            get_origin(ClassVar[int]) is ClassVar
            get_origin(Generic) is Generic
            get_origin(Generic[T]) is Generic
            get_origin(Union[T, int]) is Union
            get_origin(List[Tuple[T, T]][int]) == list
            get_origin(P.args) is P
        N)r   r  r+   rb   rd   r  r  ParamSpecArgsParamSpecKwargsr   r   )rs   r
   r
   r   r9     s   

r9   c                 C   sz   t | tr| jf| j S t | tjtfr;t| ddrdS | j}t	| t
jju r9|d tur9t|dd |d f}|S dS )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)
        r  Fr
   r   Nr   )r   r  r   r  rb   rd   r  r   r   r9   r   r   r   Ellipsisr   )rs   r   r
   r
   r   r8     s   
r8   r5   )r   re  c                   @      e Zd Zdd ZdS )_TypeAliasFormc                 C   rX   rY   rZ   r\   r
   r
   r   r]     r^   _TypeAliasForm.__repr__NrH   rI   rJ   r]   r
   r
   r
   r   r        r  c                 C      t |  d)&  Special marker indicating that an assignment should
        be recognized as a proper type alias definition by type
        checkers.

        For example::

            Predicate: TypeAlias = Callable[..., bool]

        It's invalid when used anywhere except as in the example above.
         is not subscriptabler?   r   r
   r
   r   r5     s   c                   @   r  )r  c                 C   rX   rY   rZ   r\   r
   r
   r   r]     r^   r  Nr  r
   r
   r
   r   r    r  a  Special marker indicating that an assignment should
                               be recognized as a proper type alias definition by type
                               checkers.

                               For example::

                                   Predicate: TypeAlias = Callable[..., bool]

                               It's invalid when used anywhere except as in the example
                               above.c                   @   r   )_TypeAliasMetazMetaclass for TypeAliasc                 C      dS Nztyping_extensions.TypeAliasr
   r\   r
   r
   r   r]     r   z_TypeAliasMeta.__repr__NrH   rI   rJ   rK   r]   r
   r
   r
   r   r        r  c                   @   s,   e Zd ZdZdZdd Zdd Zdd Zd	S )
_TypeAliasBaser  r
   c                 C   r>   )Nz+TypeAlias cannot be used with isinstance().r?   r@   r
   r
   r   rC     rD   z _TypeAliasBase.__instancecheck__c                 C   r>   )Nz+TypeAlias cannot be used with issubclass().r?   rE   r
   r
   r   rF   
  rD   z _TypeAliasBase.__subclasscheck__c                 C   r  r  r
   r\   r
   r
   r   r]     r   z_TypeAliasBase.__repr__N)rH   rI   rJ   rK   r   rC   rF   r]   r
   r
   r
   r   r    s    
r  )r   rM   r  c                   @   r<   )
_Immutablez3Mixin to indicate that object should not be copied.r
   c                 C   r   rq   r
   r\   r
   r
   r   __copy__  r   z_Immutable.__copy__c                 C   r   rq   r
   )rA   memor
   r
   r   __deepcopy__   r   z_Immutable.__deepcopy__N)rH   rI   rJ   rK   r   r  r  r
   r
   r
   r   r    s
    r  c                   @       e Zd ZdZdd Zdd ZdS )r  aQ  The args for a ParamSpec object.

        Given a ParamSpec object P, P.args is an instance of ParamSpecArgs.

        ParamSpecArgs objects have a reference back to their ParamSpec:

        P.args.__origin__ is P

        This type is meant for runtime introspection and has no special meaning to
        static type checkers.
        c                 C   rp   rq   r   rA   rZ  r
   r
   r   ru   /  r^   zParamSpecArgs.__init__c                 C      | j j dS )Nz.argsr   rH   r\   r
   r
   r   r]   2     zParamSpecArgs.__repr__NrH   rI   rJ   rK   ru   r]   r
   r
   r
   r   r  #      c                   @   r  )r  a[  The kwargs for a ParamSpec object.

        Given a ParamSpec object P, P.kwargs is an instance of ParamSpecKwargs.

        ParamSpecKwargs objects have a reference back to their ParamSpec:

        P.kwargs.__origin__ is P

        This type is meant for runtime introspection and has no special meaning to
        static type checkers.
        c                 C   rp   rq   r  r  r
   r
   r   ru   A  r^   zParamSpecKwargs.__init__c                 C   r  )Nz.kwargsr  r\   r
   r
   r   r]   D  r  zParamSpecKwargs.__repr__Nr  r
   r
   r
   r   r  5  r  r  r   c                       s   e Zd ZdZejZedd Zedd Z	dddd fd	d

Z
dd Zdd Zdd Zdd Zdd Zes>dd Z  ZS   ZS )r   a'  Parameter specification variable.

        Usage::

           P = ParamSpec('P')

        Parameter specification variables exist primarily for the benefit of static
        type checkers.  They are used to forward the parameter types of one
        callable to another callable, a pattern commonly found in higher order
        functions and decorators.  They are only valid when used in ``Concatenate``,
        or s the first argument to ``Callable``. In Python 3.10 and higher,
        they are also supported in user-defined Generics at runtime.
        See class Generic for more information on generic types.  An
        example for annotating a decorator::

           T = TypeVar('T')
           P = ParamSpec('P')

           def add_logging(f: Callable[P, T]) -> Callable[P, T]:
               '''A type-safe decorator to add logging to a function.'''
               def inner(*args: P.args, **kwargs: P.kwargs) -> T:
                   logging.info(f'{f.__name__} was called')
                   return f(*args, **kwargs)
               return inner

           @add_logging
           def add_two(x: float, y: float) -> float:
               '''Add two numbers together.'''
               return x + y

        Parameter specification variables defined with covariant=True or
        contravariant=True can be used to declare covariant or contravariant
        generic types.  These keyword arguments are valid, but their actual semantics
        are yet to be decided.  See PEP 612 for details.

        Parameter specification variables can be introspected. e.g.:

           P.__name__ == 'T'
           P.__bound__ == None
           P.__covariant__ == False
           P.__contravariant__ == False

        Note that only parameter specification variables defined in global scope can
        be pickled.
        c                 C      t | S rq   )r  r\   r
   r
   r   r        zParamSpec.argsc                 C   r  rq   )r  r\   r
   r
   r   r    r  zParamSpec.kwargsNF)boundrR   rT   c             	      s   t  | g || _t|| _t|| _|rt|d| _nd | _zt	
djdd}W n ttfy:   d }Y nw |dkrD|| _d S d S )NzBound must be a type.rw   rH   rp  Ztyping_extensions)r   ru   rH   bool__covariant____contravariant__rb   rc   	__bound__r   r   r   r:  rf  rg  rI   )rA   r   r  rR   rT   def_modr   r
   r   ru     s   


zParamSpec.__init__c                 C   s&   | j rd}n| jrd}nd}|| j S )N+-~)r  r  rH   )rA   prefixr
   r
   r   r]     s   
zParamSpec.__repr__c                 C   r   rq   )rB  r   r\   r
   r
   r   r     r^   zParamSpec.__hash__c                 C   s   | |u S rq   r
   r   r
   r
   r   r     rD   zParamSpec.__eq__c                 C      | j S rq   )rH   r\   r
   r
   r   r       zParamSpec.__reduce__c                 O   rb  rq   r
   r  r
   r
   r   r    r   zParamSpec.__call__c                 C   s   | |vr| |  d S d S rq   )appendrA   rE  r
   r
   r   _get_type_vars  s   zParamSpec._get_type_vars)rH   rI   rJ   rK   rb   r   r   r  r   r  ru   r]   r   r   r  r  PEP_560r  r   r
   r
   r   r   r   N  s     /

	r   c                       sp   e Zd Zer
ejZnejZdZej	Z
 fddZdd Zdd Zdd	 Zed
d Zes4dd Z  ZS   ZS )_ConcatenateGenericAliasFc                    s   t  | || _|| _d S rq   )r   ru   r   r   )rA   rZ  r   r   r
   r   ru     s   
z!_ConcatenateGenericAlias.__init__c                    s2   t j  | j dd fdd| jD  dS )Nr   r   c                 3   s    | ]} |V  qd S rq   r
   r  r   r
   r   r    r2  z4_ConcatenateGenericAlias.__repr__.<locals>.<genexpr>r   )rb   r   r   r   r   r\   r
   r  r   r]     s   z!_ConcatenateGenericAlias.__repr__c                 C   r  rq   )r   r   r   r\   r
   r
   r   r     r  z!_ConcatenateGenericAlias.__hash__c                 O   rb  rq   r
   r  r
   r
   r   r    r   z!_ConcatenateGenericAlias.__call__c                 C   s   t dd | jD S )Nc                 s   s$    | ]}t |tjtfr|V  qd S rq   )r   rb   r   r   )r  rs   r
   r
   r   r    s    
z:_ConcatenateGenericAlias.__parameters__.<locals>.<genexpr>)r   r   r\   r
   r
   r   r     s   z'_ConcatenateGenericAlias.__parameters__c                 C   s&   | j r| jrt| j| d S d S d S rq   )r   r   rb   r  r  r
   r
   r   r    s   z'_ConcatenateGenericAlias._get_type_vars)rH   rI   rJ   r  rb   rd   r   Z_TypingBaser  r   r   ru   r]   r   r  r  r   r  r   r
   r
   r   r   r    s    
r  c                    sZ   |dkrt dt|ts|f}t|d tst dd t fdd|D }t| |S )Nr
   z&Cannot take a Concatenate of no types.r   zAThe last parameter to Concatenate should be a ParamSpec variable.z/Concatenate[arg, ...]: each arg must be a type.c                 3   r  rq   r  r  r  r
   r   r    r   z'_concatenate_getitem.<locals>.<genexpr>)r   r   r   r   r  r   r
   r  r   _concatenate_getitem  s   

r  c                 C   
   t | |S )&  Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a
        higher order function which adds, removes or transforms parameters of a
        callable.

        For example::

           Callable[Concatenate[int, P], int]

        See PEP 612 for detailed information.
        r  r   r
   r
   r   r     s   
c                   @   rV   )_ConcatenateFormc                 C   rX   rY   rZ   r\   r
   r
   r   r]   
  r^   z_ConcatenateForm.__repr__c                 C   r  rq   r  r   r
   r
   r   rg     r^   z_ConcatenateForm.__getitem__Nri   r
   r
   r
   r   r  	      r  r  c                   @   r   )_ConcatenateAliasMetazMetaclass for Concatenate.c                 C   r  Nztyping_extensions.Concatenater
   r\   r
   r
   r   r]   !  r   z_ConcatenateAliasMeta.__repr__Nr  r
   r
   r
   r   r    r  r  c                   @   s4   e Zd ZdZdZdd Zdd Zdd Zd	d
 ZdS )_ConcatenateAliasBaser  r
   c                 C   r>   )Nz-Concatenate cannot be used with isinstance().r?   r@   r
   r
   r   rC   3  rD   z'_ConcatenateAliasBase.__instancecheck__c                 C   r>   )Nz-Concatenate cannot be used with issubclass().r?   rE   r
   r
   r   rF   6  rD   z'_ConcatenateAliasBase.__subclasscheck__c                 C   r  r  r
   r\   r
   r
   r   r]   9  r   z_ConcatenateAliasBase.__repr__c                 C   r  rq   r  r   r
   r
   r   rg   <  r^   z!_ConcatenateAliasBase.__getitem__N)	rH   rI   rJ   rK   r   rC   rF   r]   rg   r
   r
   r
   r   r  $  s    
r  r6   c                   @   r  )_TypeGuardFormc                 C   rX   rY   rZ   r\   r
   r
   r   r]   G  r^   _TypeGuardForm.__repr__Nr  r
   r
   r
   r   r  F  r  r  c                 C   s    t ||  d}t | |fS )	  Special typing form used to annotate the return type of a user-defined
        type guard function.  ``TypeGuard`` only accepts a single type argument.
        At runtime, functions marked this way should return a boolean.

        ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static
        type checkers to determine a more precise type of an expression within a
        program's code flow.  Usually type narrowing is done by analyzing
        conditional code flow and applying the narrowing to a block of code.  The
        conditional expression here is sometimes referred to as a "type guard".

        Sometimes it would be convenient to use a user-defined boolean function
        as a type guard.  Such a function should use ``TypeGuard[...]`` as its
        return type to alert static type checkers to this intention.

        Using  ``-> TypeGuard`` tells the static type checker that for a given
        function:

        1. The return value is a boolean.
        2. If the return value is ``True``, the type of its argument
        is the type inside ``TypeGuard``.

        For example::

            def is_str(val: Union[str, float]):
                # "isinstance" type guard
                if isinstance(val, str):
                    # Type of ``val`` is narrowed to ``str``
                    ...
                else:
                    # Else, type of ``val`` is narrowed to ``float``.
                    ...

        Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower
        form of ``TypeA`` (it can even be a wider form) and this may lead to
        type-unsafe results.  The main reason is to allow for things like
        narrowing ``List[object]`` to ``List[str]`` even though the latter is not
        a subtype of the former, since ``List`` is invariant.  The responsibility of
        writing type-safe type guards is left to the user.

        ``TypeGuard`` also works with type variables.  For more information, see
        PEP 647 (User-Defined Type Guards).
        rx   )rb   rc   rd   re   r
   r
   r   r6   J  s   ,c                   @   rV   )r  c                 C   rX   rY   rZ   r\   r
   r
   r   r]   |  r^   r  c                 C   r_   )Nz accepts only a single typera   re   r
   r
   r   rg     rh   z_TypeGuardForm.__getitem__Nri   r
   r
   r
   r   r  z  rj   r  c                       rl   )
_TypeGuardr  rn   Nc                 K   rp   rq   rn   rr   r
   r
   r   ru     r^   z_TypeGuard.__init__c                 C   rv   )Nrw   z accepts only a single type.TrL   ry   rz   r|   r
   r
   r   rg     r}   z_TypeGuard.__getitem__c                 C   r~   r   r   r   r
   r
   r   r     r   z_TypeGuard._eval_typec                    r   r   r   r   r   r
   r   r]     r   z_TypeGuard.__repr__c                 C   r   rq   r   r\   r
   r
   r   r     r   z_TypeGuard.__hash__c                 C   r   rq   )r   r  r   ro   r   r
   r
   r   r     r   z_TypeGuard.__eq__rq   r   r
   r
   r   r   r    s    +
r  r   c                   @   sn   e Zd ZdZdd Zdd Zdd Zdd	 Zd
d Zdd Z	dd Z
dd Zdd Zdd Zejdd ZdS )_SpecialForm)r[   rK   _getitemc                 C   s   || _ |j| _|j| _d S rq   )r  rH   r[   rK   )rA   r  r
   r
   r   ru   
  s   z_SpecialForm.__init__c                 C   s   |dv r| j S t|)N>   rH   rJ   )r[   rf  )rA   rf   r
   r
   r   r    s   z_SpecialForm.__getattr__c                 C      t d| )Nr  r?   )rA   rX  r
   r
   r   __mro_entries__  r  z_SpecialForm.__mro_entries__c                 C   s   d| j  S rY   rZ   r\   r
   r
   r   r]     r   z_SpecialForm.__repr__c                 C   r  rq   rZ   r\   r
   r
   r   r    r  z_SpecialForm.__reduce__c                 O   r  )NzCannot instantiate r?   )rA   r   rt   r
   r
   r   r    r  z_SpecialForm.__call__c                 C   s   t j| |f S rq   rb   Unionr   r
   r
   r   __or__!  r  z_SpecialForm.__or__c                 C   s   t j|| f S rq   r  r   r
   r
   r   __ror__$  r  z_SpecialForm.__ror__c                 C   r  )Nz! cannot be used with isinstance()r?   r@   r
   r
   r   rC   '  r  z_SpecialForm.__instancecheck__c                 C   r  )Nz! cannot be used with issubclass()r?   rE   r
   r
   r   rF   *  r  z_SpecialForm.__subclasscheck__c                 C   s   |  | |S rq   )r  r   r
   r
   r   rg   -  r  z_SpecialForm.__getitem__N)rH   rI   rJ   r   ru   r  r  r]   r  r  r  r  rC   rF   rb   rL  rg   r
   r
   r
   r   r    s    r  c                 C   r  )Used to spell the type of "self" in classes.

        Example::

          from typing import Self

          class ReturnsSelf:
              def parse(self, data: bytes) -> Self:
                  ...
                  return self

        r  r?   )rA   r$  r
   r
   r   r   1  s   c                   @   r<   )_Selfr  r
   c                 C   r  )Nz" cannot be used with isinstance().r?   r@   r
   r
   r   rC   R  r  z_Self.__instancecheck__c                 C   r  )Nz" cannot be used with issubclass().r?   rE   r
   r
   r   rF   U  r  z_Self.__subclasscheck__NrG   r
   r
   r
   r   r  B  s
    r  Requiredc                   @   r  )_ExtensionsSpecialFormc                 C   rX   rY   rZ   r\   r
   r
   r   r]   `  r^   z_ExtensionsSpecialForm.__repr__Nr  r
   r
   r
   r   r  _  r  r  c                 C   r_   )  A special typing construct to mark a key of a total=False TypedDict
        as required. For example:

            class Movie(TypedDict, total=False):
                title: Required[str]
                year: int

            m = Movie(
                title='The Matrix',  # typechecker error if key is omitted
                year=1999,
            )

        There is no runtime checking that a required key is actually provided
        when instantiating a related TypedDict.
        r`   ra   re   r
   r
   r   r  c  s   c                 C   r_   )`  A special typing construct to mark a key of a TypedDict as
        potentially missing. For example:

            class Movie(TypedDict):
                title: str
                year: NotRequired[int]

            m = Movie(
                title='The Matrix',  # typechecker error if key is omitted
                year=1999,
            )
        r`   ra   re   r
   r
   r   NotRequiredw  s   r  c                   @   rV   )_RequiredFormc                 C   rX   rY   rZ   r\   r
   r
   r   r]     r^   z_RequiredForm.__repr__c                 C   s"   t |d| j}t | |fS )Nz{} accepts only single type)rb   rc   formatr[   rd   re   r
   r
   r   rg     rh   z_RequiredForm.__getitem__Nri   r
   r
   r
   r   r    r  r  r  r  c                       sJ   e Zd ZdZdddZdd Zdd Z fd	d
Zdd Zdd Z	  Z
S )_MaybeRequiredrn   Nc                 K   rp   rq   rn   rr   r
   r
   r   ru     r^   z_MaybeRequired.__init__c              	   C   sN   t | }| jd u r|t|d|jdd  ddS td|jdd  )Nz{} accepts only single type.rw   TrL   z {} cannot be further subscripted)r{   ro   rb   rc   r  rH   r   r|   r
   r
   r   rg     s   
z_MaybeRequired.__getitem__c                 C   r~   r   r   r   r
   r
   r   r     r   z_MaybeRequired._eval_typec                    s.   t   }| jd ur|dt| j7 }|S )Nz[{}])r   r]   ro   r  rb   r   r   r   r
   r   r]     s   

z_MaybeRequired.__repr__c                 C   r   rq   r   r\   r
   r
   r   r     r   z_MaybeRequired.__hash__c                 C   s0   t |t| s	tS | jd ur| j|jkS | |u S rq   )r   r{   r   ro   r   r
   r
   r   r     s
   
z_MaybeRequired.__eq__rq   )rH   rI   rJ   r   ru   rg   r   r]   r   r   r   r
   r
   r   r   r     s    
	r   c                   @   r   )	_Requiredr  Nr  r
   r
   r
   r   r    r  r  c                   @   r   )_NotRequiredr  Nr  r
   r
   r
   r   r    r  r  )NNF)r   r   collections.abcr  r   rb   version_infor  r{   r   r   r   r   __all__extendr   r;   Z_FinalTypingBaser=   r   rN   rO   rP   rQ   rS   r   r   r  rW   rm   r,   r-   r.   r   r   _overload_dummyr0   r   r   r   r    r   r   r&   r   MutableSequencer$   r"   _collections_abcr   r   r   r'   r(   _aliasMutableMappingr%   Dictrd  r#   r!   r/   r4   r7   r   rC  r   r  r1   r  r  rS  r  rM  rc   r3   r2   r*   r)   rh  rk  __text_signature__rx  rt  r   rH   rI   rK   r+   r:   r  rd   r  r  r  r9   r8   r  ImportErrorr  r5   r  r]  r  r  r  r  r  r   r   r  rL  r  r   r  r  r  r6   r  r  r   r  r  r  r  r  r   r  r  r
   r
   r
   r   <module>   s   -






3


.
&
 ! B(,, '6&b#



j,

.
.
O*


	
%
