o
    ga                    @   s  	 d dl mZm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
d dlZd dlmZmZmZmZ g dZdddZddd	Zd
d Zdd ZdddZdd Zdd Zdd Zdd Zdd Zg ZdddddZe fddZG d d! d!ZG d"d# d#Z G d$d% d%edd&Z!G d'd( d(e!dd&Z"e!d)d* Z#e!d+d, Z$e!d-d. Z%e!d/d0 Z&e!d1d2 Z'e!d3d4 Z(e"d5d6 Z)e!d7d8 Z*e!d9d: Z+e!d;d< Z,G d=d> d>edd&Z-G d?d@ d@Z.G dAdB dBee e.dd&Z/G dCdD dDee dd&Z0G dEdF dFee dd&Z1G dGdH dHee e.dd&Z2dIdJ Z3G dKdL dLedd&Z4G dMdN dNe4dd&Z5G dOdP dPe4dd&Z6G dQdR dRe5dd&Z7G dSdT dTe6dd&Z8G dUdV dVe6dd&Z9G dWdX dXe5dd&Z:dYdZ Z;G d[d\ d\e5dd&Z<G d]d^ d^e5dd&Z=G d_d` d`Z>G dadb dbZ?G dcdd ddZ@g deZAg dfZBeAeB dgg ZCdhdi ZDdjdk ZEdldm ZFddpdqZGddsdtZHg dudvdwgdxZIG dydz dzeZJG d{d| d|e>eJd}ZKG d~d de5dd&ZLG dd dZMdd ZNdd ZOdd ZPejQejRejSejTeeefZUdddZVdd ZWdd ZXdd ZYdd ZZdd Z[dd Z\dd Z]dd Z^dd Z_e/dZ`e/dZae/dZbe/dddZce/dddZde/dddZee/dddZfe/ddegdZhe/deiejZke6Zlelej jmd Zmelej jndnZnelej jodrZoelej jpdnZpelej jqdnZqelej jrdnZrelej jsdnZselej jtdnZtelej jud Zuelej jvdnZvelej jwdnZwe8ej jxdZxdex_yelej jzdnddZ{elej j|dnZ|elej j}dZ}elej j~dZ~elej jdnZelej jdnZelej jd Ze9eddddZde_yeledndddZelejdnddZeledndddZzeledndddZelej jdnZelej jdnZelej jdZelej jdnZelejdnddZelejdnddZeleddddZelejdddZelejdZelejdnZelejdZelej jdrZelej jdZelegdndddZde_yeNG dd deKZeNG dd deKZeNG dd deKZeNG dd deKZeNG ddÄ deKZeNG ddń deKec ZeNG ddǄ deKec ZdddʄZeh dˣZeh ḍZG dd΄ degZdddЄZegeddi Zdd҄ Zee_G ddԄ degZddd՜ddׄZegeddi Zddل e_G ddۄ dۃZejZdZG dd݄ de>ek ZG dd߄ deei ZG dd deej ZG dd dZed e_ee
jej< ele	jdnZele	jdnZG dd dZed e_ee
jej< dS )    )abstractmethodABCMetaN)WrapperDescriptorTypeMethodWrapperTypeMethodDescriptorTypeGenericAlias)T	AnnotatedAnyCallableClassVarConcatenateFinal
ForwardRefGenericLiteralOptional	ParamSpecProtocolTupleTypeTypeVarUnionAbstractSet
ByteString	ContainerContextManagerHashable	ItemsViewIterableIteratorKeysViewMappingMappingViewMutableMappingMutableSequence
MutableSetSequenceSized
ValuesView	AwaitableAsyncIteratorAsyncIterable	Coroutine
CollectionAsyncGeneratorAsyncContextManager
ReversibleSupportsAbsSupportsBytesSupportsComplexSupportsFloatSupportsIndexSupportsIntSupportsRoundChainMapCounterDequeDictDefaultDictListOrderedDictSet	FrozenSet
NamedTuple	TypedDict	GeneratorBinaryIOIOMatchPatternTextIOAnyStrcastfinalget_args
get_originget_type_hintsis_typeddictNewTypeno_type_checkno_type_check_decoratorNoReturnoverloadParamSpecArgsParamSpecKwargsruntime_checkableTextTYPE_CHECKING	TypeAlias	TypeGuardc                 C   s,   	 | d u r	t d S t| trt| |dS | S )Nmodule)type
isinstancestrr   )argr]    rb   </Users/admin/.pyenv/versions/3.10.0/lib/python3.10/typing.py_type_convert   s   
rd   Tc                 C   s   	 t tf}|r|ttf }t| |d} t| tr$| j|v r$t|  d| t	t
fv r,| S t| ts7| t tfv r?td|  dt| ttttjtfrL| S t| s[t| d| dd| S )Nr\   z is not valid as type argumentzPlain z Got z.100.)r   r   r   r   rd   r_   _GenericAlias
__origin__	TypeErrorr	   rS   _SpecialFormr^   r   r   types	UnionTyper   callable)ra   msgis_argumentr]   Zinvalid_generic_formsrb   rb   rc   _type_check   s$   
ro   c                 C   s   | du pt | ttttfS )N.)r_   tuplelistr   _ConcatenateGenericAlias)ra   rb   rb   rc   _is_param_expr   s   
rs   c                 C   sh   	 t | tjrt| S t | tr!| jdkr| jS | j d| j S | du r'dS t | tjr0| jS t| S )Nbuiltinsre   .z...)	r_   rj   r   reprr^   
__module____qualname__FunctionType__name__)objrb   rb   rc   
_type_repr   s   

r{   c                    sl   	 |d u rt }g  | D ]&}t||r| vr | t|tttjfr1  fdd|jD  qt	 S )Nc                    s   g | ]}| vr|qS rb   rb   .0ttvarsrb   rc   
<listcomp>   s    z&_collect_type_vars.<locals>.<listcomp>)
r   r_   appendrf   r   rj   rk   extend__parameters__rp   )Ztypes_typevar_typesr~   rb   r   rc   _collect_type_vars   s   
r   c              	   C   sT   	 |s
t |  dt|}||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 )rh   len)cls
parametersZelenZalenrb   rb   rc   _check_generic   s   r   c                 C   s   	 t | jdkr|rt|d s|fS t| |t | j g }t|| jD ]\}}t|tr6t|tr6t|}|	| q$t|S N   r   )
r   r   rs   r   zipr_   r   rq   rp   r   )r   paramsZ_paramspZtvarrb   rb   rc   _prepare_paramspec_params   s   
r   c                 C   sJ   t | }t|t| k r#g }| D ]}||v r || || q|} | S N)setr   r   remove)r   Z
all_paramsZ
new_paramsr~   rb   rb   rc   _deduplicate   s   

r   c                 C   sz   	 g }| D ]1}t |ttjfr||j qt |tr1t|dkr1|d tu r1||dd   q|	| qtt
|S )Nr   r   )r_   _UnionGenericAliasrj   rk   r   __args__rp   r   r   r   r   r   r   r   rb   rb   rc   _remove_dups_flatten  s   "r   c                 C   s:   	 g }| D ]}t |tr||j q|| qt|S r   )r_   _LiteralGenericAliasr   r   r   rp   r   rb   rb   rc   _flatten_literal_params  s   
r   Ftypedc                  s"   	  fdd}| d ur|| S |S )Nc                    s8   t jd t j t  fdd}|S )Nr   c                     s2   z | i |W S  t y   Y nw | i |S r   rh   argskwdscachedfuncrb   rc   inner/  s   z+_tp_cache.<locals>.decorator.<locals>.inner)	functools	lru_cache	_cleanupsr   cache_clearwraps)r   r   r   r   rc   	decorator+  s
   z_tp_cache.<locals>.decoratorrb   )r   r   r   rb   r   rc   	_tp_cache'  s
   r   c                    s   	 t | tr|  S t | tttjfrHt fdd| jD }|| jkr+| S t | tr6t| j	|S t | tjrCt
tj|S | |S | S )Nc                 3   s    | ]
}t | V  qd S r   )
_eval_typer}   aglobalnslocalnsrecursive_guardrb   rc   	<genexpr>F      z_eval_type.<locals>.<genexpr>)r_   r   	_evaluaterf   r   rj   rk   rp   r   rg   r   reduceoperatoror_	copy_with)r~   r   r   r   Zev_argsrb   r   rc   r   =  s   



r   c                   @   s   e Zd Z	 dZdd ZdS )_Final)__weakref__c                O   s   d|vrt dd S )N_rootz&Cannot subclass special typing classesr   selfr   r   rb   rb   rc   __init_subclass__W  s   z_Final.__init_subclass__N)ry   rv   rw   	__slots__r   rb   rb   rb   rc   r   R  s    r   c                   @   s"   e Zd Z	 dZdd Zdd ZdS )
_Immutablerb   c                 C      | S r   rb   r   rb   rb   rc   __copy___     z_Immutable.__copy__c                 C   r   r   rb   )r   memorb   rb   rc   __deepcopy__b  r   z_Immutable.__deepcopy__N)ry   rv   rw   r   r   r   rb   rb   rb   rc   r   [  s
    r   c                   @   sl   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dd ZdS )ri   )_name__doc___getitemc                 C   s   || _ |j| _|j| _d S r   )r   ry   r   r   )r   getitemrb   rb   rc   __init__k  s   z_SpecialForm.__init__c                 C   s   |dv r| j S t|)N>   ry   rw   )r   AttributeError)r   itemrb   rb   rc   __getattr__p  s   z_SpecialForm.__getattr__c                 C      t d| )NCannot subclass r   )r   basesrb   rb   rc   __mro_entries__v     z_SpecialForm.__mro_entries__c                 C   
   d| j  S Ntyping.r   r   rb   rb   rc   __repr__y     
z_SpecialForm.__repr__c                 C      | j S r   r   r   rb   rb   rc   
__reduce__|     z_SpecialForm.__reduce__c                 O   r   )NzCannot instantiate r   r   rb   rb   rc   __call__  r   z_SpecialForm.__call__c                 C      t | |f S r   r   r   otherrb   rb   rc   __or__     z_SpecialForm.__or__c                 C      t || f S r   r   r   rb   rb   rc   __ror__  r   z_SpecialForm.__ror__c                 C      t |  d)Nz! cannot be used with isinstance()r   r   rz   rb   rb   rc   __instancecheck__  r   z_SpecialForm.__instancecheck__c                 C   r   )Nz! cannot be used with issubclass()r   r   r   rb   rb   rc   __subclasscheck__  r   z_SpecialForm.__subclasscheck__c                 C      |  | |S r   r   r   r   rb   rb   rc   __getitem__     z_SpecialForm.__getitem__N)ry   rv   rw   r   r   r   r   r   r   r   r   r   r   r   r   r   rb   rb   rb   rc   ri   h  s    ri   )r   c                   @   s   e Zd Zedddd ZdS )_LiteralSpecialFormTr   c                 C   r   r   r   r   rb   rb   rc   r     r   z_LiteralSpecialForm.__getitem__Nry   rv   rw   r   r   rb   rb   rb   rc   r     s    r   c                 C      	 t |  dNz is not subscriptabler   r   rb   rb   rc   r	        
r	   c                 C   r   r   r   r   rb   rb   rc   rS     s   rS   c                 C      	 t ||  d}t| |fS Nz accepts only single type.ro   rf   r   r   r   rb   rb   rc   r     s   r   c                 C   r   r   r   r   rb   rb   rc   r     s   r   c                    s   	 |dkr	t dt|ts|f}d t fdd|D }t|}t|dkr,|d S t|dkr?td |v r?t| |d	d
S t| |S )Nrb   z Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.c                 3       | ]}t | V  qd S r   ro   r}   r   rm   rb   rc   r         zUnion.<locals>.<genexpr>r   r      r   name)rh   r_   rp   r   r   r^   r   r   rb   r   rc   r     s   

r   c                 C   s"   	 t ||  d}t|td f S )Nz requires a single type.)ro   r   r^   )r   r   ra   rb   rb   rc   r     s   r   c                 C   sZ   	 t |ts	|f}t|}ztdd ttt|D }W n	 ty'   Y nw t| |S )Nc                 s   s    | ]\}}|V  qd S r   rb   )r}   r   _rb   rb   rc   r   .      zLiteral.<locals>.<genexpr>)r_   rp   r   r   rq   _value_and_type_iterrh   r   r   rb   rb   rc   r     s   
"
r   c                 C   r   r   r   r   rb   rb   rc   rZ   5  r   rZ   c                    s\   	 |dkr	t dt|ts|f}t|d tst dd t fdd|D }t| |S )Nrb   z&Cannot take a Concatenate of no types.zAThe last parameter to Concatenate should be a ParamSpec variable.z/Concatenate[arg, ...]: each arg must be a type.c                 3   r   r   r   r   r   rb   rc   r   X  r   zConcatenate.<locals>.<genexpr>)rh   r_   rp   r   rr   r   rb   r   rc   r   D  s   


r   c                 C   r   r   r   r   rb   rb   rc   r[   \  s   *r[   c                   @   s<   e Zd Z	 dZdddZdd Zdd	 Zd
d Zdd ZdS )r   )__forward_arg____forward_code____forward_evaluated____forward_value____forward_is_argument____forward_module__TNc                 C   sn   t |tstd|zt|dd}W n ty"   td|w || _|| _d| _d | _|| _	|| _
d S )Nz*Forward reference must be a string -- got z<string>evalz/Forward reference must be an expression -- got F)r_   r`   rh   compileSyntaxErrorr  r	  r
  r  r  r  )r   ra   rn   r]   coderb   rb   rc   r     s   

zForwardRef.__init__c                 C   s   | j |v r| S | jr||urU|d u r|d u ri  }}n|d u r"|}n|d u r(|}| jd ur9ttj| jd d|}tt| j	||d| j
d}t||||| j hB | _d| _| jS )N__dict__z*Forward references must evaluate to types.rn   T)r  r
  r  getattrsysmodulesgetro   r  r	  r  r   r  )r   r   r   r   Ztype_rb   rb   rc   r     s.   


zForwardRef._evaluatec                 C   s>   t |tstS | jr|jr| j|jko| j|jkS | j|jkS r   )r_   r   NotImplementedr
  r  r  r   rb   rb   rc   __eq__  s   

zForwardRef.__eq__c                 C   s
   t | jS r   )hashr  r   rb   rb   rc   __hash__  r   zForwardRef.__hash__c                 C   s   d| j dS )NzForwardRef())r  r   rb   rb   rc   r     r   zForwardRef.__repr__TN)	ry   rv   rw   r   r   r   r  r  r   rb   rb   rb   rc   r     s    
r   c                   @   s6   e Zd Z	 dd Zdd Zdd Zdd Zd	d
 ZdS )_TypeVarLikec                 C   sD   	 |r	|r	t dt|| _t|| _|rt|d| _d S d | _d S )Nz"Bivariant types are not supported.zBound must be a type.)
ValueErrorbool__covariant____contravariant__ro   	__bound__)r   bound	covariantcontravariantrb   rb   rc   r     s   


z_TypeVarLike.__init__c                 C   r   r   r   r   rightrb   rb   rc   r     r   z_TypeVarLike.__or__c                 C   r   r   r   r   leftrb   rb   rc   r     r   z_TypeVarLike.__ror__c                 C   s&   | j rd}n| jrd}nd}|| j S )N+-~)r!  r"  ry   )r   prefixrb   rb   rc   r     s   
z_TypeVarLike.__repr__c                 C   r   r   )ry   r   rb   rb   rc   r     r   z_TypeVarLike.__reduce__N)ry   rv   rw   r   r   r   r   r   rb   rb   rb   rc   r    s    	r  c                       s,   e Zd Z	 dZdddd fdd
Z  ZS )r   )ry   r#  __constraints__r!  r"  r  NFr$  r%  r&  c             	      s   || _ t ||| |r|d urtd|r!t|dkr!tdd t fdd|D | _ztdj	
dd}W n ttfyH   d }Y nw |d	krR|| _d S d S )
Nz-Constraints cannot be combined with bound=...r   z"A single constraint is not allowedz:TypeVar(name, constraint, ...): constraints must be types.c                 3   r   r   r   r|   r   rb   rc   r   "  r   z#TypeVar.__init__.<locals>.<genexpr>ry   __main__typing)ry   superr   rh   r   rp   r/  r  	_getframe	f_globalsr  r   r  rv   )r   r  r$  r%  r&  Zconstraintsdef_mod	__class__r   rc   r     s    
zTypeVar.__init__)ry   rv   rw   r   r   __classcell__rb   rb   r7  rc   r     s    +r   c                   @      e Zd Z	 dd Zdd ZdS )rU   c                 C   
   || _ d S r   rg   r   originrb   rb   rc   r   7  r   zParamSpecArgs.__init__c                 C      | j j dS )Nz.argsrg   ry   r   rb   rb   rc   r   :  r   zParamSpecArgs.__repr__Nry   rv   rw   r   r   rb   rb   rb   rc   rU   +      rU   c                   @   r:  )rV   c                 C   r;  r   r<  r=  rb   rb   rc   r   J  r   zParamSpecKwargs.__init__c                 C   r?  )Nz.kwargsr@  r   rb   rb   rc   r   M  r   zParamSpecKwargs.__repr__NrA  rb   rb   rb   rc   rV   >  rB  rV   c                       sD   e Zd Z	 dZedd Zedd Zdddd fd	d

Z  ZS )r   )ry   r#  r!  r"  r  c                 C      t | S r   )rU   r   rb   rb   rc   r        zParamSpec.argsc                 C   rC  r   )rV   r   rb   rb   rc   kwargs  rD  zParamSpec.kwargsNFr0  c             	      s`   || _ 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   ry   r1  r2  )
ry   r3  r   r  r4  r5  r  r   r  rv   )r   r  r$  r%  r&  r6  r7  rb   rc   r     s   
zParamSpec.__init__)	ry   rv   rw   r   propertyr   rE  r   r9  rb   rb   r7  rc   r   Q  s    -

r   c                 C   s   |  do	| dS )N__)
startswithendswith)attrrb   rb   rc   
_is_dunder  s   rK  c                       sV   e Zd Z	 dddddZdd Zdd	 Zd
d Z fddZdd Zdd Z	  Z
S )_BaseGenericAliasTNinstr  c                C   s   || _ || _|| _d | _d S r   )_instr   rg   r   )r   r>  rN  r  rb   rb   rc   r     s   
z_BaseGenericAlias.__init__c                 O   sT   | j std| j d| jj d| j|i |}z| |_W |S  ty)   Y |S w )NzType z cannot be instantiated; use z
() instead)rO  rh   r   rg   ry   __orig_class__r   )r   r   rE  resultrb   rb   rc   r     s   
z_BaseGenericAlias.__call__c                 C   sj   g }| j |vr|| j  || }||d d  D ]}t|ts&t|tr+ t|S q|t t|S )Nr   )rg   r   indexr_   rL  
issubclassr   rp   )r   r   resibrb   rb   rc   r     s   


z!_BaseGenericAlias.__mro_entries__c                 C   s<   |dv r| j p
| jjS d| jv rt|st| j|S t|)N>   ry   rw   rg   )r   rg   ry   r  rK  r  r   r   rJ  rb   rb   rc   r     s
   z_BaseGenericAlias.__getattr__c                    s4   t |s|dv rt || d S t| j|| d S )N>   _typevar_typesrO  _paramspec_tvarsr   _nparams)rK  r3  __setattr__setattrrg   )r   rJ  valr7  rb   rc   r[    s   z_BaseGenericAlias.__setattr__c                 C      |  t|S r   r   r^   r   rb   rb   rc   r     r   z#_BaseGenericAlias.__instancecheck__c                 C      t d)NzBSubscripted generics cannot be used with class and instance checksr   r   rb   rb   rc   r        z#_BaseGenericAlias.__subclasscheck__)ry   rv   rw   r   r   r   r   r[  r   r   r9  rb   rb   r7  rc   rL    s    
rL  c                       sx   e Zd Zddedd fdd
Zdd Zd	d
 Zdd Zdd Ze	dd Z
dd Zdd Zdd Z fddZ  ZS )rf   TNF)rN  r  rX  rY  c                   sd   t  j|||d t|ts|f}tdd |D | _t||d| _|| _|| _|s0|j	| _	d S d S )NrM  c                 s   s,    | ]}|t u r
d n|tu rdn|V  qdS ).rb   N)_TypingEllipsis_TypingEmptyr   rb   rb   rc   r     s    
z)_GenericAlias.__init__.<locals>.<genexpr>)r   )
r3  r   r_   rp   r   r   r   rX  rY  rv   )r   r>  r   rN  r  rX  rY  r7  rb   rc   r     s   

z_GenericAlias.__init__c                 C   &   t |tstS | j|jko| j|jkS r   )r_   rf   r  rg   r   r   rb   rb   rc   r    
   

z_GenericAlias.__eq__c                 C      t | j| jfS r   )r  rg   r   r   rb   rb   rc   r       z_GenericAlias.__hash__c                 C   r   r   r   r'  rb   rb   rc   r     r   z_GenericAlias.__or__c                 C   r   r   r   r)  rb   rb   rc   r     r   z_GenericAlias.__ror__c                    sL  | j ttfv rtd|  t|ts|f}tdd |D }| jr2tdd | jD r2t	| |}n	t
| |t| j tt| j| g }| jD ]V}t|| jrjt|tre | }t|sdtd| n" | }nt|tttjfr|j}|rt fdd|D }|| }| j tjjkrt|tr|| qH|| qH| t|S )Nz%Cannot subscript already-subscripted c                 s       | ]}t |V  qd S r   rd   r   rb   rb   rc   r     r  z,_GenericAlias.__getitem__.<locals>.<genexpr>c                 s       | ]}t |tV  qd S r   r_   r   r|   rb   rb   rc   r   
  r   zFExpected a list of types, an ellipsis, ParamSpec, or Concatenate. Got c                 3   s    | ]} | V  qd S r   rb   )r}   xsubstrb   rc   r     r  )rg   r   r   rh   r_   rp   rY  anyr   r   r   r   dictr   r   rX  r   rs   rf   r   rj   rk   collectionsabcr
   r   r   r   )r   r   new_argsra   	subparamssubargsrb   rm  rc   r     s>   



z_GenericAlias.__getitem__c                 C   s   | j | j|| j| jdS N)r  rN  )r8  rg   r   rO  r   r   rb   rb   rc   r   &  s   z_GenericAlias.copy_withc                 C   sB   | j r	d| j  }nt| j}ddd | jD }| d| dS )Nr   , c                 S      g | ]}t |qS rb   r{   r   rb   rb   rc   r   .      z*_GenericAlias.__repr__.<locals>.<listcomp>[])r   r{   rg   joinr   )r   r  r   rb   rb   rc   r   )  s
   
z_GenericAlias.__repr__c                 C   sR   | j r
t | j  }n| j}t| j}t|dkr"t|d ts"|\}tj||ffS r   )	r   globalsrg   rp   r   r   r_   r   r   )r   r>  r   rb   rb   rc   r   1  s   
z_GenericAlias.__reduce__c                    s   t | jtrtd| | jrt |S | jtu r=t|v r!dS |	| }||d d  D ]}t |t
r<|| ur< dS q.| jfS )Nr   rb   r   )r_   rg   ri   rh   r   r3  r   r   r   rR  rL  )r   r   rU  rV  r7  rb   rc   r   ;  s   

z_GenericAlias.__mro_entries__)ry   rv   rw   r   r   r  r  r   r   r   r   r   r   r   r   r9  rb   rb   r7  rc   rf     s    
$
rf   c                       sd   e Zd Zddd fdd
Zedd Zdd	 Zd
d Z fddZdd Z	dd Z
dd Z  ZS )_SpecialGenericAliasTNrM  c                   s`   |d u r|j }t j|||d || _|jdkr"d|j d| _d S d|j d|j d| _d S )NrM  rt   zA generic version of re   )ry   r3  r   rZ  rv   rw   r   )r   r>  ZnparamsrN  r  r7  rb   rc   r   P  s   
z_SpecialGenericAlias.__init__c                    sB   t |ts|f}d t fdd|D }t| || j | |S )Nz*Parameters to generic types must be types.c                 3   r   r   r   r   r   rb   rc   r   _  r   z3_SpecialGenericAlias.__getitem__.<locals>.<genexpr>)r_   rp   r   rZ  r   rw  rb   r   rc   r   Z  s   

z _SpecialGenericAlias.__getitem__c                 C   s   t | j|| j| jdS rv  )rf   rg   r   rO  rw  rb   rb   rc   r   c  s   z_SpecialGenericAlias.copy_withc                 C   r   r   r   r   rb   rb   rc   r   g  r   z_SpecialGenericAlias.__repr__c                    s:   t |trt|j| jS t |tst|| jS t |S r   )r_   r  rS  rg   rf   r3  r   r   r7  rb   rc   r   j  s
   

z&_SpecialGenericAlias.__subclasscheck__c                 C   r   r   r   r   rb   rb   rc   r   q  r   z_SpecialGenericAlias.__reduce__c                 C   r   r   r   r'  rb   rb   rc   r   t  r   z_SpecialGenericAlias.__or__c                 C   r   r   r   r)  rb   rb   rc   r   w  r   z_SpecialGenericAlias.__ror__)ry   rv   rw   r   r   r   r   r   r   r   r   r   r9  rb   rb   r7  rc   r  O  s    

r  c                       s$   e Zd Z fddZdd Z  ZS )_CallableGenericAliasc                    sZ   | j }t|dkrt|d rt  S dddd |d d D  dt|d  d	S )
Nr  r   ztyping.Callable[[rx  c                 S   ry  rb   rz  r   rb   rb   rc   r     r{  z2_CallableGenericAlias.__repr__.<locals>.<listcomp>r  z], r}  )r   r   rs   r3  r   r~  r{   r   r   r7  rb   rc   r   {  s   

z_CallableGenericAlias.__repr__c                 C   sD   | j }t|dkrt|d st|d d |d f}tjt|ffS )Nr  r   r  )r   r   rs   rq   r   r   r
   r  rb   rb   rc   r     s   z _CallableGenericAlias.__reduce__)ry   rv   rw   r   r   r9  rb   rb   r7  rc   r  z  s    	r  c                   @   s(   e Zd Zdd Zdd Zedd ZdS )_CallableTypec                 C   s   t | j|| j| jttfddS )NT)r  rN  rX  rY  )r  rg   r   rO  r   r   rw  rb   rb   rc   r     s
   z_CallableType.copy_withc                 C   sP   t |trt|dkrtd|\}}t |trt||f}n||f}| |S )Nr  z6Callable must be used as Callable[[arg, ...], result].)r_   rp   r   rh   rq   __getitem_inner__)r   r   r   rQ  rb   rb   rc   r     s   

z_CallableType.__getitem__c                 C   sb   |\}}d}t ||}|tu r| t|fS t|ts|f}tdd |D }||f }| |S )Nz.Callable[args, result]: result must be a type.c                 s   rh  r   ri  )r}   ra   rb   rb   rc   r     r  z2_CallableType.__getitem_inner__.<locals>.<genexpr>)ro   Ellipsisr   rb  r_   rp   )r   r   r   rQ  rm   rb   rb   rc   r    s   



z_CallableType.__getitem_inner__N)ry   rv   rw   r   r   r   r  rb   rb   rb   rc   r    s
    r  c                   @   s   e Zd Zedd ZdS )
_TupleTypec                    s   |dkr
|  tfS t|ts|f}t|dkr.|d du r.d t|d  }|  |tfS d t fdd	|D }|  |S )
Nrb   r  r   .z Tuple[t, ...]: t must be a type.r   z*Tuple[t0, t1, ...]: each t must be a type.c                 3   r   r   r   r   r   rb   rc   r     r   z)_TupleType.__getitem__.<locals>.<genexpr>)r   rc  r_   rp   r   ro   rb  )r   r   r   rb   r   rc   r     s   

z_TupleType.__getitem__Nr   rb   rb   rb   rc   r    s    r  c                       sP   e Zd Zdd Zdd Zdd Z fddZd	d
 Zdd Z fddZ	  Z
S )r   c                 C   s   t | S r   r   rw  rb   rb   rc   r     ra  z_UnionGenericAlias.copy_withc                 C   s(   t |ttjfs
tS t| jt|jkS r   )r_   r   rj   rk   r  r   r   r   rb   rb   rc   r    s   z_UnionGenericAlias.__eq__c                 C   s   t t| jS r   )r  	frozensetr   r   rb   rb   rc   r    r   z_UnionGenericAlias.__hash__c                    sd   | j }t|dkr-|d td u rdt|d  dS |d td u r-dt|d  dS t  S )Nr  r   ztyping.Optional[r   r}  )r   r   r^   r{   r3  r   r  r7  rb   rc   r     s   
z_UnionGenericAlias.__repr__c                 C   r^  r   r_  r   rb   rb   rc   r     r   z$_UnionGenericAlias.__instancecheck__c                 C   s    | j D ]
}t||r dS qd S NT)r   rS  )r   r   ra   rb   rb   rc   r     s
   

z$_UnionGenericAlias.__subclasscheck__c                    s   t   \}\}}|t|ffS r   )r3  r   r   )r   r   r>  r   r7  rb   rc   r     s   z_UnionGenericAlias.__reduce__)ry   rv   rw   r   r  r  r   r   r   r   r9  rb   rb   r7  rc   r     s    	r   c                 C   s   dd | D S )Nc                 s   s    | ]	}|t |fV  qd S r   )r^   r   rb   rb   rc   r     s    z'_value_and_type_iter.<locals>.<genexpr>rb   )r   rb   rb   rc   r    r   r  c                   @   s   e Zd Zdd Zdd ZdS )r   c                 C   s*   t |tstS tt| jtt|jkS r   )r_   r   r  r   r  r   r   rb   rb   rc   r    s   
z_LiteralGenericAlias.__eq__c                 C   s   t tt| jS r   )r  r  r  r   r   rb   rb   rc   r       z_LiteralGenericAlias.__hash__N)ry   rv   rw   r  r  rb   rb   rb   rc   r     s    r   c                          e Zd Z fddZ  ZS )rr   c                    s$   t  j|i |ttfdd d S )NTrX  rY  )r3  r   r   r   )r   r   rE  r7  rb   rc   r     s   z!_ConcatenateGenericAlias.__init__)ry   rv   rw   r   r9  rb   rb   r7  rc   rr     s    rr   c                       s2   e Zd Z	 dZdZedd Z fddZ  ZS )r   rb   Fc                 C   s   t |ts|f}|s| turtd| j dtdd |D }| ttfv rLtdd |D s8td| j dt	t
|t	|krKtd| j dntd	d | jD r\t| |}n	t| |t	| j t| |ttfd
dS )NzParameter list to z[...] cannot be emptyc                 s   rh  r   ri  r   rb   rb   rc   r     r  z,Generic.__class_getitem__.<locals>.<genexpr>c                 s   s    | ]
}t |ttfV  qd S r   )r_   r   r   r   rb   rb   rc   r     r   zParameters to zF[...] must all be type variables or parameter specification variables.z[...] must all be uniquec                 s   rj  r   rk  r|   rb   rb   rc   r   !  r   Tr  )r_   rp   r   rh   rw   r   r   allry   r   r   ro  r   r   r   rf   r   r   )r   r   rb   rb   rc   __class_getitem__  s0   
zGeneric.__class_getitem__c           
         s  t  j|i | g }d| jv rt| jv }n
t| jv o| jdk}|r&tdd| jv rt| jt	t
f}d }| jD ]}t|trO|jtu rO|d urLtd|j}q8|d urt|}t| | ksd fdd|D }ddd |D }	td	| d
|	 d|}t|| _d S )N__orig_bases__r   z!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.rx  c                 3   s     | ]}| vrt |V  qd S r   r`   r|   Zgvarsetrb   rc   r   E      z,Generic.__init_subclass__.<locals>.<genexpr>c                 s   rh  r   r  )r}   grb   rb   rc   r   F  r  zSome type variables (z) are not listed in Generic[r}  )r3  r   r  r   r  	__bases__ry   rh   r   r   r   r_   rf   rg   r   r   r~  rp   )
r   r   rE  r   errorZgvarsbaseZtvarsetZs_varsZs_argsr7  r  rc   r   )  s>   





zGeneric.__init_subclass__)	ry   rv   rw   r   _is_protocolr   r  r   r9  rb   rb   r7  rc   r     s    
r   c                   @      e Zd ZdS )rc  Nry   rv   rw   rb   rb   rb   rc   rc  M      rc  c                   @   r  )rb  Nr  rb   rb   rb   rc   rb  T  r  rb  )r   r  rP  r  _is_runtime_protocol)__abstractmethods____annotations__r  r   r   rv   __new__r   __subclasshook__r   r  _MutableMapping__markerc                 C   st   	 t  }| jd d D ],}|jdv rqt|di }t|j t|  D ]}|ds6|tvr6|	| q&q|S )Nr  )r   r   r  Z_abc_)
r   __mro__ry   r  rq   r  keysrH  EXCLUDED_ATTRIBUTESadd)r   attrsr  annotationsrJ  rb   rb   rc   _get_protocol_attrsc  s   

r  c                    s   t  fddt D S )Nc                 3   s     | ]}t t |d V  qd S r   )rl   r  r}   rJ  r   rb   rc   r   v  r  z,_is_callable_members_only.<locals>.<genexpr>)r  r  r  rb   r  rc   _is_callable_members_onlyt  s   r  c                 O   st   t | }|jrtd|jturd S |jD ]}|jdt}|tur'||_ q,qtj|_|j| g|R i | d S )Nz Protocols cannot be instantiatedr   )	r^   r  rh   r   _no_init_or_replace_initr  r  r  object)r   r   rE  r   r  Zinitrb   rb   rc   r  y  s   

r  r   r1  c              	   C   s4   zt | d jd|W S  ttfy   Y d S w )Nr   ry   )r  r4  r5  r  r   r  )depthdefaultrb   rb   rc   _caller  s
   r     c              	   C   s2   	 zt | jd dv W S  ttfy   Y dS w )Nry   )rr  r   T)r  r4  r5  r   r  r  rb   rb   rc   _allow_reckless_class_checks  s   r  )
r
   r)   r   r   r+   r   r'   r   r-   r0   AbstractContextManagerAbstractAsyncContextManager)zcollections.abc
contextlibc                       r  )_ProtocolMetac                    s   t  ddrt  ddstddstd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  Fr  r  r  LInstance and class checks can only be used with @runtime_checkable protocolsTc                 3   s:    | ]}t |ott |d  pt|d uV  qd S r   )hasattrrl   r  r  r   instancerb   rc   r     s    

z2_ProtocolMeta.__instancecheck__.<locals>.<genexpr>)r  r  rh   r  rS  r8  r  r  r  r3  r   r  r7  r  rc   r     s&   


z_ProtocolMeta.__instancecheck__)ry   rv   rw   r   r9  rb   rb   r7  rc   r    s    r  c                       s*   e Zd Z	 dZdZdZ fddZ  ZS )r   rb   TFc                    s   t  j|i |  jddstdd  jD  _ fdd}d jvr)| _ js.d S  jD ]#}|tt	fv sT|j
tv rF|jt|j
 v sTt|t	rN|jsTtd| q1t _d S )	Nr  Fc                 s   s    | ]}|t u V  qd S r   )r   )r}   rV  rb   rb   rc   r     r  z-Protocol.__init_subclass__.<locals>.<genexpr>c                    s    j dds	tS t ddst rtS tdt s%t r!tS tdt| ts.tdt	 D ]:}| j
D ]1}||j v rM|j | d u rKt    S  q2t|di }t|tjjrh||v rht| trh| jrh q2q7t  S dS )	Nr  Fr  r  z<Protocols with non-method members don't support issubclass()z"issubclass() arg 1 must be a classr  T)r  r  r  r  r  rh   r  r_   r^   r  r  rq  rr  r!   rS  r   r  )r   rJ  r  r  r  rb   rc   _proto_hook  s<   


z/Protocol.__init_subclass__.<locals>._proto_hookr  z7Protocols can only inherit from other protocols, got %r)r3  r   r  r  ro  r  r  r  r  r   rv   _PROTO_ALLOWLISTry   rS  rh   r  r   )r   r   rE  r  r  r7  r  rc   r     s.   
&

zProtocol.__init_subclass__)ry   rv   rw   r   r  r  r   r9  rb   rb   r7  rc   r     s    r   )	metaclassc                       sR   e Zd Z	  fddZdd Zdd Zdd Zd	d
 Zdd Z fddZ	  Z
S )_AnnotatedAliasc                    s2   t |tr|j| }|j}t || || _d S r   )r_   r  __metadata__rg   r3  r   )r   r>  metadatar7  rb   rc   r   8  s
   


z_AnnotatedAlias.__init__c                 C   s   |d }t || jS )Nr   )r  r  )r   r   Znew_typerb   rb   rc   r   ?  s   z_AnnotatedAlias.copy_withc                 C   s$   d t| jddd | jD S )Nztyping.Annotated[{}, {}]rx  c                 s   rh  r   )ru   r   rb   rb   rc   r   G  r  z+_AnnotatedAlias.__repr__.<locals>.<genexpr>)formatr{   rg   r~  r  r   rb   rb   rc   r   D  s   z_AnnotatedAlias.__repr__c                 C   s   t jt| jf| j ffS r   )r   r   r   rg   r  r   rb   rb   rc   r   J  s   z_AnnotatedAlias.__reduce__c                 C   rd  r   )r_   r  r  rg   r  r   rb   rb   rc   r  O  re  z_AnnotatedAlias.__eq__c                 C   rf  r   )r  rg   r  r   rb   rb   rc   r  U  rg  z_AnnotatedAlias.__hash__c                    s   |dv rdS t  |S )N>   ry   rw   r   )r3  r   rW  r7  rb   rc   r   X  s   z_AnnotatedAlias.__getattr__)ry   rv   rw   r   r   r   r   r  r  r   r9  rb   rb   r7  rc   r  0  s    r  c                   @   s.   e Zd Z	 dZdd Zedd Zdd ZdS )	r   rb   c                 O   r`  )Nz&Type Annotated cannot be instantiated.r   r   r   rE  rb   rb   rc   r    ra  zAnnotated.__new__c                 C   sJ   t |trt|dk rtdd}t|d |}t|dd  }t||S )Nr  zUAnnotated[...] should be used with at least two arguments (a type and an annotation).z$Annotated[t, ...]: t must be a type.r   r   )r_   rp   r   rh   ro   r  )r   r   rm   r>  r  rb   rb   rc   r    s   
zAnnotated.__class_getitem__c                 O   s   t d| j)NzCannot subclass {}.Annotated)rh   r  rv   r  rb   rb   rc   r     s   
zAnnotated.__init_subclass__N)ry   rv   rw   r   r  r   r  r   rb   rb   rb   rc   r   ^  s    

r   c                 C   s(   	 t | tr	| jstd|  d| _| S )NzB@runtime_checkable can be only applied to protocol classes, got %rT)rS  r   r  rh   r  r  rb   rb   rc   rW     s   rW   c                 C   s   	 |S r   rb   )typr]  rb   rb   rc   rJ     s   rJ   c           
      C   s   	 z| j }W n ty   i  Y S w |j}|j}|d | }| jp"d}| j}|r,t|ni }|t| }t||d  |D ]\}}	|	||< q=|S )Nrb   )	__code__r   co_argcountco_varnames__defaults____kwdefaults__rp  r   r   )
r   r  Z	pos_countZ	arg_namesdefaultsZ
kwdefaultsrT  Z
pos_offsetr  valuerb   rb   rc   _get_defaults  s    


r  c                 C   s0  	 t | dd r	i S t| tri }t| jD ]c}|d u r(t tj|jd di }n|}|j	di }t|t
jr9i }|d u rCtt|n|}|d u rR|d u rR||}}| D ]!\}	}
|
d u rbtd }
t|
trmt|
dd}
t|
||}
|
||	< qVq|r}|S dd | D S |d u rt| t
jr| j	}n| }t|dr|j}t|dst |d	i }|d u r|}n|d u r|}t | dd }|d u rt| tri S td
| t| }t|}| D ]/\}	}
|
d u rtd }
t|
trt|
}
t|
||}
|	|v r||	 d u rt|
 }
|
||	< q|r|S dd | D S )N__no_type_check__r  r  Fr  c                 S      i | ]	\}}|t |qS rb   _strip_annotationsr}   kr~   rb   rb   rc   
<dictcomp>      z"get_type_hints.<locals>.<dictcomp>__wrapped____globals__z1{!r} is not a module, class, method, or function.c                 S   r  rb   r  r  rb   rb   rc   r  0  r  )r  r_   r^   reversedr  r  r  r  rv   r  rj   GetSetDescriptorTyperp  varsitemsr`   r   r   
ModuleTyper  r  _allowed_typesrh   r  r  r   )rz   r   r   Zinclude_extrasZhintsr  Zbase_globalsannZbase_localsr  r  Znsobjr  rb   rb   rc   rN     sp    








rN   c                 C   s   	 t | trt| jS t | tr&tdd | jD }|| jkr!| S | |S t | trBtdd | jD }|| jkr<| S t| j|S t | t	j
r`tdd | jD }|| jkrY| S ttj|S | S )Nc                 s   rh  r   r  r   rb   rb   rc   r   9  r  z%_strip_annotations.<locals>.<genexpr>c                 s   rh  r   r  r   rb   rb   rc   r   >  r  c                 s   rh  r   r  r   rb   rb   rc   r   C  r  )r_   r  r  rg   rf   rp   r   r   r   rj   rk   r   r   r   r   )r~   Zstripped_argsrb   rb   rc   r  3  s&   







r  c                 C   sJ   	 t | trtS t | ttttfr| jS | tu rtS t | t	j
r#t	j
S d S r   )r_   r  r   rL  r   rU   rV   rg   r   rj   rk   tprb   rb   rc   rM   K  s   
rM   c                 C   s   	 t | tr| jf| j S t | ttfr8| j}| jtjj	u r6t
|dkr*t|d s6t|d d |d f}|S t | tjrA| jS dS )Nr  r   r  rb   )r_   r  rg   r  rf   r   r   rq  rr  r
   r   rs   rq   rj   rk   )r  rT  rb   rb   rc   rL   f  s   



rL   c                 C   s   	 t | tS r   )r_   _TypedDictMetar  rb   rb   rc   rO   ~  s   

rO   c                 C   s   	 t | tr;| j }| j D ]\}}|| j| f v r!|| q| D ]}t |tj	r1d|_
t |tr:t| q&zd| _
W | S  tyK   Y | S w r  )r_   r^   r  copyr  r  popvaluesrj   rx   r  rQ   rh   )ra   Z	arg_attrsrJ  r]  rz   rb   rb   rc   rQ     s(   



rQ   c                    s   	 t   fdd}|S )Nc                     s    | i |}t |}|S r   )rQ   )r   r   r   r   rb   rc   wrapped_decorator  s   z2no_type_check_decorator.<locals>.wrapped_decorator)r   r   )r   r  rb   r  rc   rR     s   rR   c                  O   s
   	 t d)NzYou should not call an overloaded function. A series of @overload-decorated functions outside a stub module should always be followed by an implementation that is not @overload-ed.)NotImplementedErrorr   rb   rb   rc   _overload_dummy  s   r  c                 C   s   	 t S r   )r  )r   rb   rb   rc   rT     s   rT   c                 C   s   	 | S r   rb   )frb   rb   rc   rK     s   rK   TKTVTT_co)r%  V_coVT_coT_contra)r&  CT_co)r%  r$  rI   r  a  Callable type; Callable[[int], str] is a function of (int) -> str.

    The subscription syntax must always be used with exactly two
    values: the argument list and the return type.  The argument list
    must be a list of types or ellipsis; the return type must be a single type.

    There is no syntax to indicate optional or keyword arguments,
    such function types are rarely used as callback types.
    r   r  r  r   rM  a@  Tuple type; Tuple[X, Y] is the cross-product type of X and Y.

    Example: Tuple[T1, T2] is a tuple of two elements corresponding
    to type variables T1 and T2.  Tuple[int, float, str] is a tuple
    of an int, a float and a string.

    To specify a variable-length tuple of homogeneous type, use Tuple[T, ...].
    r=   r:   r?   r@   r   r/   r;   r<   r   a  A special construct usable to annotate class objects.

    For example, suppose we have the following classes::

      class User: ...  # Abstract base for User classes
      class BasicUser(User): ...
      class ProUser(User): ...
      class TeamUser(User): ...

    And a function that takes a class argument that's a subclass of
    User and returns an instance of the corresponding class::

      U = TypeVar('U', bound=User)
      def new_user(user_class: Type[U]) -> U:
          user = user_class()
          # (Here we could write the user object to a database)
          return user

      joe = new_user(BasicUser)

    At this point the type checker knows that joe has type BasicUser.
    c                   @   $   e Zd Z	 dZedefddZdS )r6   rb   returnc                 C      d S r   rb   r   rb   rb   rc   __int__c     zSupportsInt.__int__N)ry   rv   rw   r   r   intr  rb   rb   rb   rc   r6   ^  
    r6   c                   @   r  )r4   rb   r  c                 C   r  r   rb   r   rb   rb   rc   	__float__m  r  zSupportsFloat.__float__N)ry   rv   rw   r   r   floatr  rb   rb   rb   rc   r4   h  r  r4   c                   @   r  )r3   rb   r  c                 C   r  r   rb   r   rb   rb   rc   __complex__w  r  zSupportsComplex.__complex__N)ry   rv   rw   r   r   complexr  rb   rb   rb   rc   r3   r  r  r3   c                   @   r  )r2   rb   r  c                 C   r  r   rb   r   rb   rb   rc   	__bytes__  r  zSupportsBytes.__bytes__N)ry   rv   rw   r   r   bytesr  rb   rb   rb   rc   r2   |  r  r2   c                   @   r  )r5   rb   r  c                 C   r  r   rb   r   rb   rb   rc   	__index__  r  zSupportsIndex.__index__N)ry   rv   rw   r   r   r  r  rb   rb   rb   rc   r5     r  r5   c                   @   r  )r1   rb   r  c                 C   r  r   rb   r   rb   rb   rc   __abs__  r  zSupportsAbs.__abs__N)ry   rv   rw   r   r   r  r  rb   rb   rb   rc   r1     r  r1   c                   @   s*   e Zd Z	 dZeddedefddZdS )	r7   rb   r   ndigitsr  c                 C   r  r   rb   )r   r  rb   rb   rc   	__round__  r  zSupportsRound.__round__Nr   )ry   rv   rw   r   r   r  r  r  rb   rb   rb   rc   r7     s
    r7   rb   c                 C   s@   dd |D }dd |D }t j| |||d}| |_|j_|S )Nc                 S   s   g | ]\}}|qS rb   rb   r}   nr~   rb   rb   rc   r     r{  z!_make_nmtuple.<locals>.<listcomp>c                 S   s$   i | ]\}}|t |d | dqS )zfield z annotation must be a typer   r  rb   rb   rc   r    s    z!_make_nmtuple.<locals>.<dictcomp>r  r]   )rq  
namedtupler  r  )r  rj   r]   r  fieldsnm_tplrb   rb   rc   _make_nmtuple  s   r  >
   _fieldsr   __getnewargs__r   _replaceZ_source_field_defaults_asdictr  _make>   r  rv   ry   c                   @   s   e Zd Zdd ZdS )NamedTupleMetac           	   
      s     di }g }|D ]&}| v r|| q
|r0td| dt|dkr%dnd dd| q
t||  fd	d
|D  d d} D ]}|tv rRtd| |t	vrc||j
vrct|| |  qF|S )Nr  zNon-default namedtuple field z cannot follow default fieldr   s  rx  c                    s   g | ]} | qS rb   rb   )r}   r  nsrb   rc   r     r{  z*NamedTupleMeta.__new__.<locals>.<listcomp>rv   r  z&Cannot overwrite NamedTuple attribute )r  r   rh   r   r~  r  r  _prohibitedr   _specialr  r\  )	r   typenamer   r  rj   Zdefault_names
field_namer  keyrb   r  rc   r    s.   

zNamedTupleMeta.__new__N)ry   rv   rw   r  rb   rb   rb   rc   r    s    r  c             	   K   sb   	 |d u r
|  }n|rtdztdjdd}W n ttfy)   d }Y nw t| ||dS )NzIEither list of fields or keywords can be provided to NamedTuple, not bothr   ry   r1  r\   )	r  rh   r  r4  r5  r  r   r  r  )r  r  rE  r]   rb   rb   rc   rA     s   
rA   c                 C   s   t | dkr
tdtfS )Nr   z5Multiple inheritance with NamedTuple is not supported)r   rh   _NamedTupler   rb   rb   rc   _namedtuple_mro_entries  s   r  c                   @   s&   e Zd ZdddZeZdd ZeZdS )r  Tc                    s  	 |D ]}t |turtdqt t|tf|i }|di }t| }d  fdd| D }t }	t }
|D ] }|	|j
di  |		|j
dd |
	|j
dd q=|	| |rk|		| n|
	| |_t|	_t|
_td	s|_S )
NzHcannot inherit from both a TypedDict type and a non-TypedDict base classr  z?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typec                    s"   i | ]\}}|t | jd qS )r\   )ro   rv   )r}   r  r  rm   Ztp_dictrb   rc   r  	  s    z*_TypedDictMeta.__new__.<locals>.<dictcomp>__required_keys__rb   __optional_keys__	__total__)r^   r  rh   r  rp  r  r   r  r  updater  r  r  r  r  r  r  )r   r  r   r  totalr  r  Zown_annotationsZown_annotation_keysZrequired_keysZoptional_keysrb   r  rc   r    s:   




z_TypedDictMeta.__new__c                 C   r`  )Nz4TypedDict does not support instance and class checksr   )r   r   rb   rb   rc   r   ,	  rD  z _TypedDictMeta.__subclasscheck__N)T)ry   rv   rw   r  rp  r   r   r   rb   rb   rb   rc   r    s
    
+r  r!  c            	   K   sl   	 |d u r|}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 )	Nz@TypedDict takes either a dict or keyword arguments, but not bothr  r   ry   r1  rv   rb   r"  )	rh   rp  r  r4  r5  r  r   r  r  )r  r  r!  rE  r  rb   rb   rc   rB   3	  s   )rB   c                 C   s   t fS r   )
_TypedDictr  rb   rb   rc   <lambda>m	  s    r$  c                   @   s>   e Zd Z	 dd Zdd Zdd Zdd Zd	d
 Zdd ZdS )rP   c                 C   sD   || _ d|v r|dd }|| _|| _t }|dkr || _d S d S )Nre   r  r2  )rw   
rpartitionry   Z__supertype__r  rv   )r   r  r  r6  rb   rb   rc   r   	  s   
zNewType.__init__c                 C   s   | j  d| j S )Nre   )rv   rw   r   rb   rb   rc   r   	  r  zNewType.__repr__c                 C   s   |S r   rb   )r   rl  rb   rb   rc   r   	  r   zNewType.__call__c                 C   r   r   )rw   r   rb   rb   rc   r   	  r   zNewType.__reduce__c                 C   r   r   r   r   rb   rb   rc   r   	  r   zNewType.__or__c                 C   r   r   r   r   rb   rb   rc   r   	  r   zNewType.__ror__N)	ry   rv   rw   r   r   r   r   r   r   rb   rb   rb   rc   rP   p	  s    
rP   c                   @   s  e Zd Z	 dZeedefddZeedefddZed7dd	Z	eede
fd
dZedefddZed7ddZede
fddZed8dedefddZede
fddZed8dedefddZed8dedee fddZed9ded edefd!d"Zede
fd#d$Zedefd%d&Zed:d'edefd(d)Zede
fd*d+Zed,edefd-d.Zed/ee ddfd0d1Zed;d3d4Zed7d5d6ZdS )<rE   rb   r  c                 C   r  r   rb   r   rb   rb   rc   mode	     zIO.modec                 C   r  r   rb   r   rb   rb   rc   r  	  r'  zIO.nameNc                 C   r  r   rb   r   rb   rb   rc   close	  r  zIO.closec                 C   r  r   rb   r   rb   rb   rc   closed	  r'  z	IO.closedc                 C   r  r   rb   r   rb   rb   rc   fileno	  r  z	IO.filenoc                 C   r  r   rb   r   rb   rb   rc   flush	  r  zIO.flushc                 C   r  r   rb   r   rb   rb   rc   isatty	  r  z	IO.isattyr  r  c                 C   r  r   rb   )r   r  rb   rb   rc   read	  r  zIO.readc                 C   r  r   rb   r   rb   rb   rc   readable	  r  zIO.readablelimitc                 C   r  r   rb   )r   r/  rb   rb   rc   readline	  r  zIO.readlinehintc                 C   r  r   rb   )r   r1  rb   rb   rc   	readlines	  r  zIO.readlinesr   offsetwhencec                 C   r  r   rb   )r   r3  r4  rb   rb   rc   seek	  r  zIO.seekc                 C   r  r   rb   r   rb   rb   rc   seekable	  r  zIO.seekablec                 C   r  r   rb   r   rb   rb   rc   tell	  r  zIO.tellsizec                 C   r  r   rb   )r   r8  rb   rb   rc   truncate	  r  zIO.truncatec                 C   r  r   rb   r   rb   rb   rc   writable	  r  zIO.writabler  c                 C   r  r   rb   r   r  rb   rb   rc   write	  r  zIO.writelinesc                 C   r  r   rb   )r   r=  rb   rb   rc   
writelines	  r  zIO.writelines
IO[AnyStr]c                 C   r  r   rb   r   rb   rb   rc   	__enter__	  r  zIO.__enter__c                 C   r  r   rb   )r   r^   r  	tracebackrb   rb   rc   __exit__
  r  zIO.__exit__)r  N)r  r   r   )r  r?  )ry   rv   rw   r   rF  r   r`   r&  r  r(  r   r)  r  r*  r+  r,  rI   r-  r.  r0  r=   r2  r5  r6  r7  r9  r:  r<  r>  r@  rB  rb   rb   rb   rc   rE   	  s\    rE   c                   @   s>   e Zd Z	 dZedeeef defddZ	ed	ddZ
dS )
rD   rb   r  r  c                 C   r  r   rb   r;  rb   rb   rc   r<  
  r  zBinaryIO.writec                 C   r  r   rb   r   rb   rb   rc   r@  
  r  zBinaryIO.__enter__N)r  rD   )ry   rv   rw   r   r   r   r  	bytearrayr  r<  r@  rb   rb   rb   rc   rD   
  s    rD   c                   @   s   e Zd Z	 dZeedefddZeedefddZ	eede
e fddZeedefd	d
ZeedefddZedddZdS )rH   rb   r  c                 C   r  r   rb   r   rb   rb   rc   buffer
  r'  zTextIO.bufferc                 C   r  r   rb   r   rb   rb   rc   encoding 
  r'  zTextIO.encodingc                 C   r  r   rb   r   rb   rb   rc   errors%
  r'  zTextIO.errorsc                 C   r  r   rb   r   rb   rb   rc   line_buffering*
  r'  zTextIO.line_bufferingc                 C   r  r   rb   r   rb   rb   rc   newlines/
  r'  zTextIO.newlinesc                 C   r  r   rb   r   rb   rb   rc   r@  4
  r  zTextIO.__enter__N)r  rH   )ry   rv   rw   r   rF  r   rD   rD  r`   rE  r   rF  r   rG  r	   rH  r@  rb   rb   rb   rc   rH   
  s(    rH   c                   @   s"   e Zd Z	 g dZeZeZeZdS )io)rE   rH   rD   N)ry   rv   rw   __all__rE   rH   rD   rb   rb   rb   rc   rI  9
  s    rI  z.ioc                   @   s   e Zd Z	 ddgZeZeZdS )rerG   rF   N)ry   rv   rw   rJ  rG   rF   rb   rb   rb   rc   rK  H
  s
    rK  z.rer   r  )r   r1  )r  )NNF)rb   )rr  r   r   rq  collections.abcr  r   r   rK  Z	stdlib_rer  rj   r   r   r   r   rJ  rd   ro   rs   r{   r   r   r   r   r   r   r   r   r  r   r   r   ri   r   r	   rS   r   r   r   r   r   rZ   r   r[   r   r  r   rU   rV   r   rK  rL  rf   r  r  r  r  r   r  r   rr   r   rc  rb  Z_TYPING_INTERNALSZ_SPECIAL_NAMESr  r  r  r  r  r  r  r  r   r  r   rW   rJ   r  rx   BuiltinFunctionType
MethodTyper  r  rN   r  rM   rL   rO   rQ   rR   r  rT   rK   r  r  r  r  r  r  r  r^   r  r  r`   rI   Z_aliasr   r)   r,   r+   r*   r   r   r0   r'   r   r-   r
   r   r?   r   r%   r!   r#   r&   r$   r   rp   r   rq   r=   dequer:   r   r@   r"   r    r   r(   r  r   r  r/   rp  r;   defaultdictr<   r>   r9   r8   rC   r.   r   r6   r4   r3   r2   r5   r1   r7   r  r  r  r  rA   r  r  r  r   r  rB   r#  rP   rX   rY   rE   rD   rH   rI  ry   r  rG   rF   rb   rb   rb   rc   <module>   s   
g
	
	+




'

$


/<"ADJm+#"V

	b.5
c	
							
	
#59
.c#
	
