o
    a+)h8                    @   s~
  d dl Z d dlZd dlZd dlZd dlZd dlZd dlZd dlZg dZ	dZ
eZe ZefddZejdkr;dd Znejd	krEd
d Zndd ZdddZejZedZedZedZejdddZejdddZejdkrzd dlmZ nG dd deZG dd dedZejZeedrejdd dkrejZnG dd  d ejdd!Z e dd"d#Zejdkrej!Z!nd$d% Z!d&d' Z"eed(rej#Z#nG d)d* d*ejdd!Z$e$d(d+d#Z#ej%Z%eed,rej&Z&ej'Z'ej(Z(ne)e*ej)e+Z,d-d. Z&d/d, Z'd0d1 Z(ej-Z-ej.Z.ej/Z/ej0Z0ej1Z1ej2Z2ej3Z3ej4Z4ej5Z5eed2r)ej6Z6n	e7ej6eefZ6ej8Z8ej9Z9ej:Z:ej;Z;ej<Z<ej=Z=g d3Z>d4d5 Z?d6d7 Z@d8d9 ZAeed:r^ejBZBnd;d< ZCG d=d> d>e jDZEG d?d: d:eEdZBeed@r~ejFZFndAd@ ZFeFZGeedBrejHZHn
eFG dCdB dBeBZHeedDrejIZIejJZJejKZKn=dEdF ZLdGdH ZMdIeM_NddJdKdLZOdMeO_NG dNdO dOeZJeJdPe+fi ZIePeI_QdQeI_ReedOrejJeJfZSneJfZSdRdS ZKeedTrejTZTndUdT ZTeedDrejUZUnd dlZd dlZdVdW ZVddYdZZUeed[rejWZWejXZXnG d\d] d]ejYdd!ZXG d^d[ d[ZWejdd dkr>ejZZZej[Z[n4zd d_lm\Z\ W n e]yS   ejYZ\Y nw zd d`lm^Z_ W n e]yi   ejYZ_Y nw dadb ZZdcdd Z[eeder|ej`Z`n-ejdd d	krG dfdg dgejdd!Zaeadhde Z`nG didg dgejdd!Zaeadedjd#Z`G dkdl dlZbG dmdn dnejebdd!ZeedorejcZcejdZdnG dpdq dqZeG drdo doeeZcG dsdt dteeZdeedurG dvdu duejfebdd!Zfn	G dwdu duegebZfeedxs
G dydz dzegZhejid{d| ZjeedxrejkZkejhZhn"ejdd d	kr/ead}dx ZknG d~d dejdd!Zleldxdd#ZkeedrJejmZmn-ejdd d	krfG dd dejdd!Znendd ZmnG dd dejdd!Znenddd#ZmG dd dejodd!ZeedrejpZpnedd ZpeedrejqZqnedd ZqeedrejrZrnedd ZreedDrejsZsejtZtn9ejdd d	krG dd dejdd!ZueuddD Zseudd ZtnG dd dejdd!ZvevdDdd#Zsevddd#ZteedrejwZwnKejdd d	kr-G dd dejdd!ZxG dd dejYdd!Zyexdd Zwdd Zzn G dd dejYdd!ZyG dd dejdd!Z{e{ddd#Zwdd Zzeedr`G dd dej|ebdd!Z|nG dd debZ|eedrrej}Z}n	dedefddZ}eedrej~Z~n	derderfddZ~eedrejZn2ddXdXdddedededejejej-ej ejdejf f df dejdejegef fddZeedrejZnejdejdejf dZdedefddZeedsee_ee_ejdkrejZdS dd ZdddZejZeh dZG ddÄ deZdddńZejjRe_Reeddi Zejdkr6de_NddɄ Zee_dS )    N)8AnyClassVarConcatenateFinalLiteralString	ParamSpecParamSpecArgsParamSpecKwargsSelfTypeTypeVarTypeVarTupleUnpack	AwaitableAsyncIteratorAsyncIterable	CoroutineAsyncGeneratorAsyncContextManagerChainMapContextManagerCounterDequeDefaultDict
NamedTupleOrderedDict	TypedDictSupportsIndex	Annotatedassert_neverassert_typeclear_overloadsdataclass_transformget_overloadsfinalget_args
get_originget_type_hintsIntVaris_typeddictLiteralNewTypeoverloadoverrideProtocolreveal_typeruntimeruntime_checkableText	TypeAlias	TypeGuardTYPE_CHECKINGNeverNoReturnRequiredNotRequiredTc              	   C   s   |s	t |  d|tu r!t| dr| jst |  dt| j}t|}||krat| drKdd | jD }tdd |D }|dkrK||| krKdS t d	||krSd
nd d|  d| d| dS )zCheck 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 class__parameters__c                 S   s   g | ]}t |s|qS  )
_is_unpack.0pr;   r;   \C:\Users\User\Downloads\Proyecto_IoT\venv\Lib\site-packages\pip/_vendor/typing_extensions.py
<listcomp>f       z"_check_generic.<locals>.<listcomp>c                 s   s    | ]}t |tV  qd S N)
isinstancer   r=   r;   r;   r@   	<genexpr>g   s    z!_check_generic.<locals>.<genexpr>r   NzToo manyfewz parameters for z	; actual z, expected )	TypeError_markerhasattrr:   lensum)cls
parameterselenalenZnum_tv_tuplesr;   r;   r@   _check_genericY   s&   

rQ   )   
   c                 C   s   t | tjtjtjfS rC   )rD   typing_GenericAlias_typesGenericAlias	UnionTypetr;   r;   r@   _should_collect_from_parameterso   s   r[   rR   	   c                 C   s   t | tjtjfS rC   )rD   rT   rU   rV   rW   rY   r;   r;   r@   r[   t   s   c                 C   s   t | tjo	| j S rC   )rD   rT   rU   _specialrY   r;   r;   r@   r[   w      c                    sj   |du rt j}g  | D ]%}t||r| vrt|s | t|r0  fdd|jD  qt S )zCollect all type variable contained in types in order of
    first appearance (lexicographic order). For example::

        _collect_type_vars((T, List[S, T])) == (T, S)
    Nc                    s   g | ]}| vr|qS r;   r;   r>   rZ   tvarsr;   r@   rA      rB   z&_collect_type_vars.<locals>.<listcomp>)	rT   r   rD   r<   appendr[   extendr:   tuple)typestypevar_typesrZ   r;   ra   r@   _collect_type_vars{   s   
rh   TKTVTT_co)	covariantT_contra)contravariant)rR      )r   c                       s(   e Zd Z fddZ fddZ  ZS )_AnyMetac                    s   | t u rtdt |S )Nz6typing_extensions.Any cannot be used with isinstance())r   rH   super__instancecheck__selfobj	__class__r;   r@   rs      s   z_AnyMeta.__instancecheck__c                    s   | t u rdS t  S )Nztyping_extensions.Any)r   rr   __repr__ru   rw   r;   r@   ry      s   
z_AnyMeta.__repr__)__name__
__module____qualname__rs   ry   __classcell__r;   r;   rw   r@   rq      s    rq   c                       s    e Zd ZdZ fddZ  ZS )r   aq  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
        checks.
        c                    s*   | t u rtdt j| g|R i |S )NzAny cannot be instantiated)r   rH   rr   __new__rM   argskwargsrw   r;   r@   r      s   zAny.__new__)r{   r|   r}   __doc__r   r~   r;   r;   rw   r@   r      s    r   )	metaclassr      )rR      c                   @      e Zd Zdd Zdd ZdS )
_FinalFormc                 C   
   d| j  S Nztyping_extensions._namerz   r;   r;   r@   ry         
z_FinalForm.__repr__c                 C   "   t || j d}t | |fS N accepts only a single type.rT   _type_checkr   rU   ru   rN   itemr;   r;   r@   __getitem__      
z_FinalForm.__getitem__Nr{   r|   r}   ry   r   r;   r;   r;   r@   r          r   )_rootaW  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              	   C   s&   zd| _ W | S  ttfy   Y | S w )a  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. The decorator
        sets the ``__final__`` attribute to ``True`` on the decorated object
        to allow runtime introspection.
        T)Z	__final__AttributeErrorrH   )fr;   r;   r@   r$      s   r$   c                 C   
   t | S rC   )rT   r   )namer;   r;   r@   r(      r   r(   r*   c                   @   r   )_LiteralFormc                 C   r   r   r   rz   r;   r;   r@   ry     r   z_LiteralForm.__repr__c                 C   s   t | |S rC   )rT   rU   ru   rN   r;   r;   r@   r        z_LiteralForm.__getitem__Nr   r;   r;   r;   r@   r   	  r   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.r#   c                 C   s@   t | d| }z| t|j |j |jj< W tS  ty   Y tS w )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

        The overloads for a function can be retrieved at runtime using the
        get_overloads() function.
        __func__)getattr_overload_registryr|   r}   __code__co_firstlinenor   _overload_dummy)funcr   r;   r;   r@   r,   -  s   r,   c                 C   sD   t | d| }|jtvrg S t|j }|j|vrg S t||j  S )z6Return all defined overloads for *func* as a sequence.r   )r   r|   r   r}   listvalues)r   r   mod_dictr;   r;   r@   r#   U  s   


c                   C   s   t   dS )z$Clear all overloads in the registry.N)r   clearr;   r;   r;   r@   r!   `     r!   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)r.   Generic__annotations___abc_)__abstractmethods__r   __weakref___is_protocol_is_runtime_protocol__dict____args__	__slots__Z__next_in_mro__r:   
__origin____orig_bases__Z	__extra__Z__tree_hash__r   __subclasshook____init__r   r|   _MutableMapping__markerZ_gorg)	set__mro__r{   r   r   r   keys
startswithadd)rM   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 rC   )callabler   r>   r   rM   r;   r@   rE         z,_is_callable_members_only.<locals>.<genexpr>)allr   r   r;   r   r@   _is_callable_members_only  s   r   c                    s   g }d| j v rkt| j}d}| jD ]}t|tjr1|jtjtfv r1|jj	}|dur.t
d|j}q|du r9|}n2t|}t| | ksid fdd|D }ddd |D }t
d| d	| d
| d|}t|| _dS )zHelper function used in Protocol.__init_subclass__ and _TypedDictMeta.__new__.

    The contents of this function are very similar
    to logic found in typing.Generic.__init_subclass__
    on the CPython main branch.
    r   NzECannot inherit from Generic[...] and/or Protocol[...] multiple types., c                 3   s     | ]}| vrt |V  qd S rC   strr`   gvarsetr;   r@   rE     r   z+_maybe_adjust_parameters.<locals>.<genexpr>c                 s       | ]}t |V  qd S rC   r   )r>   gr;   r;   r@   rE         zSome type variables (z) are not listed in [])r   rT   rh   r   rD   rU   r   r   r.   r{   rH   r:   r   joinre   )rM   rb   gvarsr   Zthe_basetvarsets_varss_argsr;   r   r@   _maybe_adjust_parameters  s8   



r   r.   c                 O   s   t | jr	tdd S )Nz Protocols cannot be instantiated)typer   rH   ru   r   r   r;   r;   r@   _no_init  s   
r   c                       s   e Zd Z fddZ  ZS )_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 rC   )rJ   r   r   r   rM   instancer;   r@   rE     s    

z2_ProtocolMeta.__instancecheck__.<locals>.<genexpr>)	r   r   
issubclassrx   r   r   r   rr   rs   r   rw   r   r@   rs     s   
z_ProtocolMeta.__instancecheck__)r{   r|   r}   rs   r~   r;   r;   rw   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 )
r.   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)r.   rH   rr   r   )rM   r   kwdsrw   r;   r@   r     s   z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	| j t| |S )NzParameter list to z[...] cannot be emptyz*Parameters to generic types must be types.c                 3       | ]	}t | V  qd S rC   rT   r   r=   msgr;   r@   rE         z-Protocol.__class_getitem__.<locals>.<genexpr>c                 s       | ]	}t |tjV  qd S rC   )rD   rT   r   r=   r;   r;   r@   rE     r   r      zBParameters to Protocol[...] must all be type variables. Parameter z is z.Parameters to Protocol[...] must all be unique)rD   re   rT   TuplerH   r}   r.   r   r   rK   r   rQ   r:   rU   )rM   paramsir;   r   r@   __class_getitem__  s8   
zProtocol.__class_getitem__c                    s   d j v rtj jv }ntj jv }|rtdt   j dd s.tdd  jD  _	 fdd}d j vr<| _
 j	sAd S  jD ]$}|ttjfv sh|jd	krW|jtv sht|tr_|j	shtd
t| qDt _d S )Nr   z!Cannot inherit from plain Genericr   c                 s   s    | ]}|t u V  qd S rC   )r.   )r>   br;   r;   r@   rE   3  r   z-Protocol.__init_subclass__.<locals>.<genexpr>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   Fr   r{   )abc	functoolszBInstance and class checks can only be used with @runtime protocolsz<Protocols with non-method members don't support issubclass()z"issubclass() arg 1 must be a classr   T)r   getNotImplementedr   sys	_getframe	f_globalsrH   r   rD   r   r   r   rT   Mappingr   r   )otherr   r   r   r   r;   r@   _proto_hook6  s<   


z/Protocol.__init_subclass__.<locals>._proto_hookr   zcollections.abcz5Protocols can only inherit from other protocols, got )r   rT   r   r   	__bases__rH   r   r   anyr   r   objectr|   r{   _PROTO_WHITELISTrD   r   reprr   r   )rM   r   r   errorr  r   r;   r   r@   __init_subclass__(  s4   





zProtocol.__init_subclass__)r{   r|   r}   r   r   r   r   rT   	_tp_cacher   r
  r~   r;   r;   rw   r@   r.     s    
r1   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)rD   r   r   rH   r   r   r;   r;   r@   r1   l  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 rC   r;   rz   r;   r;   r@   	__index__  s   zSupportsIndex.__index__N)r{   r|   r}   r   r   abstractmethodintr  r;   r;   r;   r@   r     s    r8   c              	   C   s<   zt djd dvrtdW dS  ttfy   Y dS w )Nr   r{   )r   r   rT   z4TypedDict does not support instance and class checksF)r   r   r   rH   r   
ValueError)rM   r  r;   r;   r@   _check_fails  s   r  c                  O   s0   | st d| d | dd  }} t| i |S )N)TypedDict.__new__(): not enough argumentsr   r   )rH   dict)r   r   _r;   r;   r@   	_dict_new  s   r  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 )Nr  r   r   Z	_typenamez5Passing '_typename' as keyword argument is deprecatedr   )
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   r{   __main__r|   r;   r  )rH   popwarningswarnDeprecationWarningr  rK   r  r   r   r   r   r   _TypedDictMeta)r  r   r   r  typenamer  fieldsnsr;   r;   r@   _typeddict_new  sL   




r$  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 )r   Tc                    s   t  ||| d S rC   )rr   r   )rM   r   basesr#  r  rw   r;   r@   r     r_   z_TypedDictMeta.__init__c                    s  |dkrt nt|d< t | |tf|}tdd |D r'tjtf|_t	| i }|
di }d  fdd| D }t }t }	|D ] }
||
j
di  ||
j
d	d
 |	|
j
dd
 qD|| | D ];\}}t|}|tu rt|}|r|d }t|}|tu r|| qn|tu r|	| qn|r|| qn|	| qn||_t||_t|	|_t|ds||_|S )Nr   r   c                 s   r   rC   )r   rT   r   r>   r   r;   r;   r@   rE     r   z)_TypedDictMeta.__new__.<locals>.<genexpr>r   z?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typec                    s   i | ]\}}|t | qS r;   r   )r>   ntpr   r;   r@   
<dictcomp>  s    z*_TypedDictMeta.__new__.<locals>.<dictcomp>__required_keys__r;   __optional_keys__r   	__total__)r$  r  rr   r   r  r  rT   r   r  r   r   itemsr   updater   r&   r   r%   r8   r   r9   r   	frozensetr*  r+  rJ   r,  )rM   r   r%  r#  r  tp_dictr   own_annotationsrequired_keysoptional_keysr   Zannotation_keyZannotation_typeZannotation_originZannotation_argsrw   r   r@   r     sL   




z_TypedDictMeta.__new__)T)	r{   r|   r}   r   r   r  rs   __subclasscheck__r~   r;   r;   rw   r@   r     s    9r   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+
        c                 C   s   t | ttS )a  Check if an annotation is a TypedDict class

        For example::
            class Film(TypedDict):
                title: str
                year: int

            is_typeddict(Film)  # => True
            is_typeddict(Union[list, str])  # => False
        )rD   re   _TYPEDDICT_TYPESr(  r;   r;   r@   r)   ?  s   r)   r    c                 C      | S )a  Assert (to the type checker) that the value is of the given type.

        When the type checker encounters a call to assert_type(), it
        emits an error if the value is not of the specified type::

            def greet(name: str) -> None:
                assert_type(name, str)  # ok
                assert_type(name, int)  # type checker error

        At runtime this returns the first argument unchanged and otherwise
        does nothing.
        r;   )Z__valZ__typr;   r;   r@   r    Q  s   c                 C   s  t | tr
t| jS t| dr| jttfv rt| jd S t | tj	r9t
dd | jD }|| jkr4| S | |S ttdr\t | tjr\t
dd | jD }|| jkrU| S t| j|S ttdrt | tjrt
dd | jD }|| jkrx| S ttj|S | S )	z=Strips Annotated, Required and NotRequired from a given type.r   r   c                 s   r   rC   _strip_extrasr>   ar;   r;   r@   rE   o  r   z _strip_extras.<locals>.<genexpr>rW   c                 s   r   rC   r8  r:  r;   r;   r@   rE   t  r   rX   c                 s   r   rC   r8  r:  r;   r;   r@   rE   y  r   )rD   _AnnotatedAliasr9  r   rJ   r8   r9   r   rT   rU   re   	copy_withrf   rW   rX   r   reduceoperatoror_)rZ   stripped_argsr;   r;   r@   r9  h  s(   





r9  Fc                 C   sH   t tdrtj| ||dd}n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, ...]', 'Required[T]' or 'NotRequired[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   T)globalnslocalnsinclude_extras)rB  rC  c                 S   s   i | ]	\}}|t |qS r;   r8  )r>   krZ   r;   r;   r@   r)    s    z"get_type_hints.<locals>.<dictcomp>)rJ   rT   r'   r-  )rv   rB  rC  rD  hintr;   r;   r@   r'     s   
 r'   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 )r<  aK  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 rC   )rD   r<  __metadata__r   rr   r   )ru   originmetadatarw   r;   r@   r     s
   


z_AnnotatedAlias.__init__c                 C   s$   t |dksJ |d }t|| jS )Nr   r   )rK   r<  rG  )ru   r   new_typer;   r;   r@   r=    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   rC   )r  r:  r;   r;   r@   rE     r   z+_AnnotatedAlias.__repr__.<locals>.<genexpr>r   )rT   
_type_reprr   r   rG  rz   r;   r;   r@   ry     s   z_AnnotatedAlias.__repr__c                 C   s   t jt| jf| j ffS rC   )r?  getitemr   r   rG  rz   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)rD   r<  r   r   rG  ru   r  r;   r;   r@   __eq__  s
   
z_AnnotatedAlias.__eq__c                 C      t | j| jfS rC   )hashr   rG  rz   r;   r;   r@   __hash__     z_AnnotatedAlias.__hash__)r{   r|   r}   r   r   r=  ry   rM  rO  rR  r~   r;   r;   rw   r@   r<    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      t d)Nz&Type Annotated cannot be instantiated.rH   r   r;   r;   r@   r        zAnnotated.__new__c                 C   sn   t |trt|dk rtdttf}t|d |v r |d }n
d}t|d |}t|dd  }t	||S )Nr   zUAnnotated[...] should be used with at least two arguments (a type and an annotation).r   z$Annotated[t, ...]: t must be a type.r   )
rD   re   rK   rH   r   r   r&   rT   r   r<  )rM   r   Zallowed_special_formsrH  r   rI  r;   r;   r@   r      s   

zAnnotated.__class_getitem__c                 O   s   t d| j d)NCannot subclass z
.Annotated)rH   r|   r   r;   r;   r@   r
    s   zAnnotated.__init_subclass__N)
r{   r|   r}   r   r   r   rT   r  r   r
  r;   r;   r;   r@   r     s     
)_BaseGenericAlias)rW   c                 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)rD   r<  r   rT   rU   _typing_GenericAliasrX  r   r	   r   r   r6  r;   r;   r@   r&   '  s   

r&   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   )rD   r<  r   rG  rT   rU   rY  r   r   r&   collectionsr   r   Ellipsisr   )r(  resr;   r;   r@   r%   ?  s   
r%   r3   c                   @      e Zd Zdd ZdS )_TypeAliasFormc                 C   r   r   r   rz   r;   r;   r@   ry   \  r   _TypeAliasForm.__repr__Nr{   r|   r}   ry   r;   r;   r;   r@   r^  [      r^  c                 C      t |  d)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.
         is not subscriptablerU  r   r;   r;   r@   r3   _  s   c                   @   r]  )r^  c                 C   r   r   r   rz   r;   r;   r@   ry   o  r   r_  Nr`  r;   r;   r;   r@   r^  n  ra  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                   @   s   e Zd ZdZdZdd ZdS )_DefaultMixinzMixin for TypeVarLike defaults.r;   c                 C   sF   t |ttfrtdd |D | _d S |rt|d| _d S d | _d S )Nc                 s   s    | ]	}t |d V  qdS )Default must be a typeNr   )r>   dr;   r;   r@   rE     s    z)_DefaultMixin.__init__.<locals>.<genexpr>re  )rD   re   r   Z__default__rT   r   )ru   defaultr;   r;   r@   r     s   
z_DefaultMixin.__init__N)r{   r|   r}   r   r   r   r;   r;   r;   r@   rd    s    rd  c                       s2   e Zd ZdZdZdddddd fdd
Z  ZS )r   zType variable.rT   NF)boundrm   ro   rg  infer_variancec          	   	      sz   t  j|g|R |||d t| | || _ztdjdd}W n tt	fy1   d }Y nw |dkr;|| _
d S d S N)rh  rm   ro   r   r{   r  typing_extensions)rr   r   rd  Z__infer_variance__r   r   r   r   r   r  r|   )	ru   r   rh  rm   ro   rg  ri  constraintsdef_modrw   r;   r@   r     s   
zTypeVar.__init__r{   r|   r}   r   r   r~   r;   r;   rw   r@   r     s    r   r   c                   @   s$   e Zd ZdZdZdd Zdd ZdS )
_Immutablez3Mixin to indicate that object should not be copied.r;   c                 C   r7  rC   r;   rz   r;   r;   r@   __copy__     z_Immutable.__copy__c                 C   r7  rC   r;   )ru   memor;   r;   r@   __deepcopy__  rq  z_Immutable.__deepcopy__N)r{   r|   r}   r   r   rp  rs  r;   r;   r;   r@   ro    s
    ro  c                   @   (   e Zd ZdZd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   
   || _ d S rC   r   ru   rH  r;   r;   r@   r     r   zParamSpecArgs.__init__c                 C      | j j dS )Nz.argsr   r{   rz   r;   r;   r@   ry        zParamSpecArgs.__repr__c                 C      t |tstS | j|jkS rC   )rD   r   r   r   rN  r;   r;   r@   rO       
zParamSpecArgs.__eq__Nr{   r|   r}   r   r   ry   rO  r;   r;   r;   r@   r     
    c                   @   rt  )	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   ru  rC   rv  rw  r;   r;   r@   r     r   zParamSpecKwargs.__init__c                 C   rx  )Nz.kwargsry  rz   r;   r;   r@   ry     rz  zParamSpecKwargs.__repr__c                 C   r{  rC   )rD   r	   r   r   rN  r;   r;   r@   rO    r|  zParamSpecKwargs.__eq__Nr}  r;   r;   r;   r@   r	     r~  r	   r   c                       s0   e Zd ZdZdZddddd fdd
Z  ZS )r   z!Parameter specification variable.rT   NFrh  rm   ro   rg  c             	      sj   t  j||||d t| | ztdjdd}W n ttfy)   d }Y nw |dkr3|| _	d S d S rj  
rr   r   rd  r   r   r   r   r   r  r|   ru   r   rh  rm   ro   rg  rm  rw   r;   r@   r     s   
ParamSpec.__init__rn  r;   r;   rw   r@   r     s    c                       sr   e Zd ZdZejZedd Zedd Z	ddddd fd	d

Z
dd Zdd Zdd Zdd Zdd Z  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 rC   )r   rz   r;   r;   r@   r   0     zParamSpec.argsc                 C   r  rC   )r	   rz   r;   r;   r@   r   4  r  zParamSpec.kwargsNFr  c             	      s   t  | g || _t|| _t|| _|rt|d| _nd | _t	| | zt
djdd}W n ttfy@   d }Y nw |dkrJ|| _d S d S )NzBound must be a type.r   r{   r  rk  )rr   r   r{   bool__covariant____contravariant__rT   r   	__bound__rd  r   r   r   r   r   r  r|   r  rw   r;   r@   r   8  s    


r  c                 C   s&   | j rd}n| jrd}nd}|| j S )N+-~)r  r  r{   )ru   prefixr;   r;   r@   ry   L  s   
zParamSpec.__repr__c                 C   r   rC   r  rR  rz   r;   r;   r@   rR  U  r   zParamSpec.__hash__c                 C      | |u S rC   r;   rN  r;   r;   r@   rO  X  rV  zParamSpec.__eq__c                 C      | j S rC   r{   rz   r;   r;   r@   rM  [     zParamSpec.__reduce__c                 O   r  rC   r;   r   r;   r;   r@   __call___  rq  zParamSpec.__call__)r{   r|   r}   r   rT   r   rx   propertyr   r   r   ry   rR  rO  rM  r  r~   r;   r;   rw   r@   r     s    /

	r   c                       sJ   e Zd ZejZdZ fddZdd Zdd Z	dd	 Z
ed
d Z  ZS )_ConcatenateGenericAliasFc                    s   t  | || _|| _d S rC   )rr   r   r   r   )ru   rH  r   rw   r;   r@   r   n  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 rC   r;   )r>   argrK  r;   r@   rE   v  r   z4_ConcatenateGenericAlias.__repr__.<locals>.<genexpr>r   )rT   rK  r   r   r   rz   r;   r  r@   ry   s  s   z!_ConcatenateGenericAlias.__repr__c                 C   rP  rC   )rQ  r   r   rz   r;   r;   r@   rR  x  rS  z!_ConcatenateGenericAlias.__hash__c                 O   r  rC   r;   r   r;   r;   r@   r  |  rq  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 rC   )rD   rT   r   r   )r>   r(  r;   r;   r@   rE     s    
z:_ConcatenateGenericAlias.__parameters__.<locals>.<genexpr>)re   r   rz   r;   r;   r@   r:     s   z'_ConcatenateGenericAlias.__parameters__)r{   r|   r}   rT   rU   rx   r^   r   ry   rR  r  r  r:   r~   r;   r;   rw   r@   r  f  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   rC   r   r=   r   r;   r@   rE     r   z'_concatenate_getitem.<locals>.<genexpr>)rH   rD   re   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                   @   r   )_ConcatenateFormc                 C   r   r   r   rz   r;   r;   r@   ry     r   z_ConcatenateForm.__repr__c                 C   r  rC   r  r   r;   r;   r@   r     r   z_ConcatenateForm.__getitem__Nr   r;   r;   r;   r@   r        r  r  r4   c                   @   r]  )_TypeGuardFormc                 C   r   r   r   rz   r;   r;   r@   ry     r   _TypeGuardForm.__repr__Nr`  r;   r;   r;   r@   r    ra  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).
        r   )rT   r   rU   r   r;   r;   r@   r4     s   ,c                   @   r   )r  c                 C   r   r   r   rz   r;   r;   r@   ry     r   r  c                 C   r   )Nz accepts only a single typer   r   r;   r;   r@   r     r   z_TypeGuardForm.__getitem__Nr   r;   r;   r;   r@   r    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   r   _getitemc                 C   s   || _ |j| _|j| _d S rC   )r  r{   r   r   )ru   rL  r;   r;   r@   r   3  s   z_SpecialForm.__init__c                 C   s   |dv r| j S t|)N>   r{   r}   )r   r   )ru   r   r;   r;   r@   __getattr__8  s   z_SpecialForm.__getattr__c                 C      t d| )NrW  rU  )ru   r%  r;   r;   r@   __mro_entries__>  rz  z_SpecialForm.__mro_entries__c                 C   s   d| j  S r   r   rz   r;   r;   r@   ry   A  r   z_SpecialForm.__repr__c                 C   r  rC   r   rz   r;   r;   r@   rM  D  r  z_SpecialForm.__reduce__c                 O   r  )NzCannot instantiate rU  ru   r   r   r;   r;   r@   r  G  rz  z_SpecialForm.__call__c                 C   s   t j| |f S rC   rT   UnionrN  r;   r;   r@   __or__J  rz  z_SpecialForm.__or__c                 C   s   t j|| f S rC   r  rN  r;   r;   r@   __ror__M  rz  z_SpecialForm.__ror__c                 C   rb  )Nz! cannot be used with isinstance()rU  rt   r;   r;   r@   rs   P  rz  z_SpecialForm.__instancecheck__c                 C   rb  )Nz! cannot be used with issubclass()rU  )ru   rM   r;   r;   r@   r4  S  rz  z_SpecialForm.__subclasscheck__c                 C   s   |  | |S rC   )r  r   r;   r;   r@   r   V  r   z_SpecialForm.__getitem__N)r{   r|   r}   r   r   r  r  ry   rM  r  r  r  rs   r4  rT   r  r   r;   r;   r;   r@   r  0  s    r  r   c                 C   rb  )aP  Represents an arbitrary literal string.

        Example::

          from pip._vendor.typing_extensions import LiteralString

          def query(sql: LiteralString) -> ...:
              ...

          query("SELECT * FROM table")  # ok
          query(f"SELECT * FROM {input()}")  # not ok

        See PEP 675 for details.

        rc  rU  ru   r   r;   r;   r@   r   ^  s   r
   c                 C   rb  )zUsed to spell the type of "self" in classes.

        Example::

          from typing import Self

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

        rc  rU  r  r;   r;   r@   r
   u  s   r6   c                 C   rb  )a  The bottom type, a type that has no members.

        This can be used to define a function that should never be
        called, or a function that never returns::

            from pip._vendor.typing_extensions import Never

            def never_call_me(arg: Never) -> None:
                pass

            def int_or_str(arg: int | str) -> None:
                never_call_me(arg)  # type checker error
                match arg:
                    case int():
                        print("It's an int")
                    case str():
                        print("It's a str")
                    case _:
                        never_call_me(arg)  # ok, arg is of type Never

        rc  rU  r  r;   r;   r@   r6     s   c                   @   r]  )_ExtensionsSpecialFormc                 C   r   r   r   rz   r;   r;   r@   ry     r   z_ExtensionsSpecialForm.__repr__Nr`  r;   r;   r;   r@   r    ra  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   r   r   r;   r;   r@   r8     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   r   r   r;   r;   r@   r9     s   r9   c                   @   r   )_RequiredFormc                 C   r   r   r   rz   r;   r;   r@   ry     r   z_RequiredForm.__repr__c                 C   r   r   r   r   r;   r;   r@   r     r   z_RequiredForm.__getitem__Nr   r;   r;   r;   r@   r    r  r  r  r  r   c                   @   r]  )_UnpackSpecialFormc                 C   r   r   r   rz   r;   r;   r@   ry     r   z_UnpackSpecialForm.__repr__Nr`  r;   r;   r;   r@   r     ra  r  c                   @      e Zd ZejZdS _UnpackAliasNr{   r|   r}   rT   r   rx   r;   r;   r;   r@   r        
r  c                 C       t || j d}t| |fS )  A special typing construct to unpack a variadic type. For example:

            Shape = TypeVarTuple('Shape')
            Batch = NewType('Batch', int)

            def add_batch_axis(
                x: Array[Unpack[Shape]]
            ) -> Array[Batch, Unpack[Shape]]: ...

        r   rT   r   r   r  r   r;   r;   r@   r     s   c                 C   
   t | tS rC   rD   r  rv   r;   r;   r@   r<     r   r<   c                   @   r  r  r  r;   r;   r;   r@   r    r  c                   @   r   )_UnpackFormc                 C   r   r   r   rz   r;   r;   r@   ry     r   z_UnpackForm.__repr__c                 C   r  r   r  r   r;   r;   r@   r   !  s   
z_UnpackForm.__getitem__Nr   r;   r;   r;   r@   r    r  r  r  c                 C   r  rC   r  r  r;   r;   r@   r<   3  r   r   c                       s&   e Zd ZdZdd fdd
Z  ZS )r   zType variable tuple.Nrg  c             	      sb   t  | t| | ztdjdd}W n ttfy%   d }Y nw |dkr/|| _	d S d S Nr   r{   r  rk  r  ru   r   rg  rm  rw   r;   r@   r   =  s   
TypeVarTuple.__init__rn  r;   r;   rw   r@   r   :  s    c                   @   sT   e Zd ZdZejZdd ZddddZdd	 Z	d
d Z
dd Zdd Zdd ZdS )r   a  Type variable tuple.

        Usage::

            Ts = TypeVarTuple('Ts')

        In the same way that a normal type variable is a stand-in for a single
        type such as ``int``, a type variable *tuple* is a stand-in for a *tuple*
        type such as ``Tuple[int, str]``.

        Type variable tuples can be used in ``Generic`` declarations.
        Consider the following example::

            class Array(Generic[*Ts]): ...

        The ``Ts`` type variable tuple here behaves like ``tuple[T1, T2]``,
        where ``T1`` and ``T2`` are type variables. To use these type variables
        as type parameters of ``Array``, we must *unpack* the type variable tuple using
        the star operator: ``*Ts``. The signature of ``Array`` then behaves
        as if we had simply written ``class Array(Generic[T1, T2]): ...``.
        In contrast to ``Generic[T1, T2]``, however, ``Generic[*Shape]`` allows
        us to parameterise the class with an *arbitrary* number of type parameters.

        Type variable tuples can be used anywhere a normal ``TypeVar`` can.
        This includes class definitions, as shown above, as well as function
        signatures and variable annotations::

            class Array(Generic[*Ts]):

                def __init__(self, shape: Tuple[*Ts]):
                    self._shape: Tuple[*Ts] = shape

                def get_shape(self) -> Tuple[*Ts]:
                    return self._shape

            shape = (Height(480), Width(640))
            x: Array[Height, Width] = Array(shape)
            y = abs(x)  # Inferred type is Array[Height, Width]
            z = x + x   #        ...    is Array[Height, Width]
            x.get_shape()  #     ...    is tuple[Height, Width]

        c                 c   s    | j V  d S rC   )__unpacked__rz   r;   r;   r@   __iter__y  s   zTypeVarTuple.__iter__Nr  c             	   C   sb   || _ t| | ztdjdd}W n ttfy"   d }Y nw |dkr*|| _	t
|  | _d S r  )r{   rd  r   r   r   r   r   r   r  r|   r   r  r  r;   r;   r@   r   |  s   r  c                 C   r  rC   r  rz   r;   r;   r@   ry     r  zTypeVarTuple.__repr__c                 C   r   rC   r  rz   r;   r;   r@   rR    r   zTypeVarTuple.__hash__c                 C   r  rC   r;   rN  r;   r;   r@   rO    rV  zTypeVarTuple.__eq__c                 C   r  rC   r  rz   r;   r;   r@   rM    r  zTypeVarTuple.__reduce__c                 O   s   d|vrt dd S )Nr   z&Cannot subclass special typing classesrU  r  r;   r;   r@   r
    s   zTypeVarTuple.__init_subclass__)r{   r|   r}   r   rT   r   rx   r  r   ry   rR  rO  rM  r
  r;   r;   r;   r@   r   J  s    ,r/   __objr  c                 C   s   t dt| jtjd | S )a  Reveal the inferred type of a variable.

        When a static type checker encounters a call to ``reveal_type()``,
        it will emit the inferred type of the argument::

            x: int = 1
            reveal_type(x)

        Running a static type checker (e.g., ``mypy``) on this example
        will produce output similar to 'Revealed type is "builtins.int"'.

        At runtime, the function prints the runtime type of the
        argument and returns it unchanged.

        zRuntime type is )file)printr   r{   r   stderr)r  r;   r;   r@   r/     s   r   __argc                 C   rT  )a1  Assert to the type checker that a line of code is unreachable.

        Example::

            def int_or_str(arg: int | str) -> None:
                match arg:
                    case int():
                        print("It's an int")
                    case str():
                        print("It's a str")
                    case _:
                        assert_never(arg)

        If a type checker finds that a call to assert_never() is
        reachable, it will emit an error.

        At runtime, this throws an exception when called.

        zExpected code to be unreachable)AssertionErrorr  r;   r;   r@   r     s   r"   r;   )
eq_defaultorder_defaultkw_only_defaultfield_specifiersr  r  r  r  .r   c                    s    fdd}|S )a   Decorator that marks a function, class, or metaclass as providing
        dataclass-like behavior.

        Example:

            from pip._vendor.typing_extensions import dataclass_transform

            _T = TypeVar("_T")

            # Used on a decorator function
            @dataclass_transform()
            def create_model(cls: type[_T]) -> type[_T]:
                ...
                return cls

            @create_model
            class CustomerModel:
                id: int
                name: str

            # Used on a base class
            @dataclass_transform()
            class ModelBase: ...

            class CustomerModel(ModelBase):
                id: int
                name: str

            # Used on a metaclass
            @dataclass_transform()
            class ModelMeta(type): ...

            class ModelBase(metaclass=ModelMeta): ...

            class CustomerModel(ModelBase):
                id: int
                name: str

        Each of the ``CustomerModel`` classes defined in this example will now
        behave similarly to a dataclass created with the ``@dataclasses.dataclass``
        decorator. For example, the type checker will synthesize an ``__init__``
        method.

        The arguments to this decorator can be used to customize this behavior:
        - ``eq_default`` indicates whether the ``eq`` parameter is assumed to be
          True or False if it is omitted by the caller.
        - ``order_default`` indicates whether the ``order`` parameter is
          assumed to be True or False if it is omitted by the caller.
        - ``kw_only_default`` indicates whether the ``kw_only`` parameter is
          assumed to be True or False if it is omitted by the caller.
        - ``field_specifiers`` specifies a static list of supported classes
          or functions that describe fields, similar to ``dataclasses.field()``.

        At runtime, this decorator records its arguments in the
        ``__dataclass_transform__`` attribute on the decorated object.

        See PEP 681 for details.

        c                    s    d| _ | S )N)r  r  r  r  r   )Z__dataclass_transform__)Z	cls_or_fnr  r  r  r   r  r;   r@   	decorator  s   z&dataclass_transform.<locals>.decoratorr;   )r  r  r  r  r   r  r;   r  r@   r"     s   F	r-   _F)rh  c                 C   r7  )a  Indicate that a method is intended to override a method in a base class.

        Usage:

            class Base:
                def method(self) -> None: ...
                    pass

            class Child(Base):
                @override
                def method(self) -> None:
                    super().method()

        When this decorator is applied to a method, the type checker will
        validate that it overrides a method with the same name on a base class.
        This helps prevent bugs that may occur when a base class is changed
        without an equivalent change to a child class.

        See PEP 698 for details.

        r;   r  r;   r;   r@   r-   &  s   c                	   C   s0   zt djddW S  ttfy   Y d S w )Nr   r{   r  )r   r   r   r   r   r  r;   r;   r;   r@   _callerQ  s
   r  c                 C   sP   dd |D }dd |D }t j| |||d}| |_|j_tjdk r&||_|S )Nc                 S   s   g | ]\}}|qS r;   r;   r>   r'  rZ   r;   r;   r@   rA   X      z!_make_nmtuple.<locals>.<listcomp>c              	   S   s&   i | ]\}}|t |d | dqS )zfield z annotation must be a typer   r  r;   r;   r@   r)  Y  s    z!_make_nmtuple.<locals>.<dictcomp>defaultsmoduler\   )rZ  
namedtupler   r   r   version_infoZ_field_types)r   rf   r  r  r"  r   nm_tplr;   r;   r@   _make_nmtupleW  s   
r  >   r{   r|   r   c                   @   r]  )_NamedTupleMetac              
      sD  t |v sJ |D ]}|t ur|tjurtdqtdd |D } di }g }|D ]&}| v r7|| q+|rQtd| dt|dkrFdnd	 d
d| q+t	||
  fdd|D  d d}||_tj|v rwtjjj}	t|	|_ D ]}
|
tv rtd|
 |
tvr|
|jvrt||
 |
  qytj|v r|  |S )Nz3can only inherit from a NamedTuple type and Genericc                 s   s     | ]}|t u r
tn|V  qd S rC   )_NamedTuplere   r&  r;   r;   r@   rE   n  r   z*_NamedTupleMeta.__new__.<locals>.<genexpr>r   zNon-default namedtuple field z cannot follow default fieldr   s  r   c                    s   g | ]} | qS r;   r;   )r>   r'  r#  r;   r@   rA   {  r  z+_NamedTupleMeta.__new__.<locals>.<listcomp>r|   r  z&Cannot overwrite NamedTuple attribute )r  rT   r   rH   re   r   rc   rK   r   r  r-  r  r   r   classmethod_prohibited_namedtuple_fieldsr   _special_namedtuple_fieldsr  setattrr
  )rM   r!  r%  r#  r   rf   default_names
field_namer  Zclass_getitemkeyr;   r  r@   r   h  sL   




z_NamedTupleMeta.__new__N)r{   r|   r}   r   r;   r;   r;   r@   r  g  ra  r  c                 K   s.   |d u r	|  }n|rtdt| |t dS )NzIEither list of fields or keywords can be provided to NamedTuple, not both)r  )r-  rH   r  r  )Z
__typenameZ__fieldsr   r;   r;   r@   r     s
   
r   )rR      z$(typename, fields=None, /, **kwargs)c                 C   s   t | v sJ tfS rC   )r   r  )r%  r;   r;   r@   _namedtuple_mro_entries  s   r  rC   )NNF)r;   )r   rZ  collections.abcr   r?  r   rf   rV   rT   __all__ZPEP_560r   ZGenericMetar  rI   rQ   r  r[   rh   r7   r   ri   rj   rk   rl   rn   r   rq   r   rJ   r   r  r   r$   r(   r*   r   r   r,   r#   r!   defaultdictpartialr  r   r   r   r   r   r   r   r   r   r   r   _aliasr   r   r   r+   r2   r5   r  r   r   r   r.   r   ABCMetar   r1   r0   r   r   r   r)   r  r  __text_signature__r$  r{   r|   r   r5  r    r'   r9  r   r<  rU   r&   r%   rX  ImportErrorrW   rY  r3   r^  rd  r   r	   ro  r   r   r  r  r  r   r  r4   r  _Finalr   r
   r6   r8   r9   r  r  r   r  r  r<   r  r   r/   r   r"   r  r   r  r   r-   r  r   r  r  _prohibitedr  r/  r  r  r   r  r  r  r;   r;   r;   r@   <module>   s<   E










 

() ,?
,'=


f!
/
/+



	

	Q 	

R 


%

