Warning: session_start(): Session cannot be started after headers have already been sent in /home/tvrreohg/public_html/manga.php on line 13
3 Eøªj¥¤ã,@sddlZddlZddlZddlZddlZddlZddlZejdd…dðkZ e rTe Z nddlm Z m Z ddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0g,Z e rÔe jd1d2d3gƒd4d5„ZeƒZefd6d7„Zejdñk�rd9d:„Znejdòk�rdd?„Zeed.ƒ�r@ejZn Gd@dA„dAejdBdC�ZedBdC�ZejdDƒZejdEƒZejdFƒZejdGdBdH�ZejdIdBdJ�ZejZeedƒ�rÈejddK…dôk�rÈej Z nXejddK…dõk�rGdLdM„dMej!dBdC�Z"e"ddNdO�Z n GdPdQ„dQejdBdC�Z#e#dBdC�Z ejdök�r4ej$Z$ndSd„Z$dTd „Z%eed"ƒ�rXej&Z&nXejddK…d÷k�r�GdUdV„dVej!dBdC�Z'e'd"dWdO�Z&n GdXdY„dYejdBdC�Z(e(dBdC�Z&ej)Z)ej*Z*ej+Z+GdZd[„d[e ƒZ,ej-Z-ej.Z.ej/Z/ej0Z0eedƒ�rþej1Z1n"Gd\d„dej2ej3ee,ej2d]�Z1ej4Z4eedƒ�r:ej5Z5n"dd^l6m7Z8Gd_d„dej9eƒZ5ej:Z:eedƒ�rvej;Z;n`døejdd…k�o”dùkn�r°ejZ>n&Gdad„dej>ej?ee@fe,ej>d]�Z>eedƒ�r$ejAZAn2eedƒ�rVGdbd„dejAej=eefe,ejAd]�ZAeedƒ�rjejBZBn*Gdcd„de0eej9eefe,ejjBd]�ZBejCZCejDZDejEZEddde„ZFdfddgdhdddidjdkdldmddg ZGdndo„ZHdpdq„ZIeed%ƒ�rðejJZJnne �r$drds„ZKGdtdu„duejLƒZMGdvd%„d%eMdw�ZJn:ddxlmNZNmOZOdyds„ZKGdzdu„due ƒZMGd{d%„d%eMdw�ZJeed(ƒ�rrejPZPnd|d(„ZPePZQeedƒ�r’ejRZRnePGd}d„deJƒƒZReed/ƒ�rÆejSZSejTZTejUZUnzd~d„ZVd€d�„ZWd‚eW_XdBdƒœd„d…„ZYd†eY_XGd‡dˆ„dˆe ƒZTeTdeZfiƒZSe[eS_\d‰eS_]eedˆƒ�r2ejTeTfZ^neTfZ^dŠd!„ZUeed/ƒ�rTej_Z_n(e �r|ddl`Z`ddlZd‹dŒ„ZadúdŽd3„Z_eedƒ�r–ejbZbejcZcnXe �rÂGd�d�„d�ejddBdC�ZcGd‘d„dƒZbn,d’d“„ZeGd”d•„d•ej ƒZfGd–d„defdw�ZbejddK…dûk�rejgZgejhZhnre �r‚ydd—lmiZiWnejk �rBejdZiYnXydd˜lmkZkWnejk �rpejdZkYnXd™d2„Zgdšd1„Zheed*ƒ�r–ejlZln¤ejddK…dük�rÎGd›dœ„dœej!dBdC�Zmemd�d*„ƒZlnlejddK…dýk�rGdždœ„dœej!dBdC�Zmemd*dŸdO�Zln4Gd d¡„d¡ejnƒZoGd¢d£„d£ejeodBd¤�ZpepdBdC�Zleed¥ƒ�rTejqZqejrZrn.Gd¦d§„d§ƒZsGd¨d¥„d¥esƒZqGd©dª„dªesƒZreed ƒ�r–ejtZtnGd«d „d euƒZteedƒ�sÂGd¬d­„d­euƒZvejwd®d¯„ƒZxeedƒ�rêejyZyejvZvnŽejddK…dþk� r emd°d„ƒZynlejddK…dÿk� rDGd±d²„d²ej!dBdC�Zzezdd³dO�Zyn4Gd´dµ„dµejnƒZ{Gd¶d·„d·eje{dBd¤�Z|e|dBdC�Zyeed+ƒ� rŒej}Z}n”ejddK…�dk� rÆGd¸d¹„d¹ej!dBdC�Z~e~dºd+„ƒZ}nZejddK…�dk� rGd»d¹„d¹ej!dBdC�Z~e~d+d¼dO�Z}n Gd½d¾„d¾ejdBdC�ZedBdC�Z}ejddK…�dk� rLGd¿dÀ„dÀej#dBdC�Z!eedƒ� r`ej€Z€nDejddK…�dk� r„e!dÁd„ƒZ€n GdÂdÄdÃejdBdC�Z�e�dBdC�Z€eed ƒ� r¸ej‚Z‚nDejddK…�dk� rÜe!dÄd „ƒZ‚n GdÅdÆ„dÆejdBdC�ZƒeƒdBdC�Z‚eed-ƒ� rej„Z„nDejddK…�dk� r4e!dÇd-„ƒZ„n GdÈdÉ„dÉejdBdC�Z…e…dBdC�Z„eed/ƒ� rnej†Z†ej‡Z‡nÞejddK…�dk� r´GdÊdË„dËej!dBdC�ZˆeˆdÌd/„ƒZ†eˆdÍd0„ƒZ‡n˜ejddK…�dk� rúGdÎdÏ„dÏej!dBdC�Z‰e‰d/dÐdO�Z†e‰d0dÑdO�Z‡nRGdÒdÓ„dÓejdBdC�ZŠGdÔdÕ„dÕeŠdBdC�Z‹GdÖdׄd×eŠdBdC�ZŒe‹dBdC�Z†eŒdBdC�Z‡ejddK…�dk� r¤GdØdÙ„dÙej!dBdC�Z�GdÚdÛ„dÛejddBdC�ZŽe�dÜd „ƒZ�dÝdÞ„Z�n€ejddK…�d k� rüGdßdÛ„dÛejddBdC�ZŽGdàdá„dáej!dBdC�Z‘e‘d dâdO�Z�dãdÞ„Z�n(Gdädå„dåejdBdC�Z’e’dBdC�Z�dædÞ„Z�Gdçd „d ƒZ“eed&ƒ� rFej”Z”needèœdéd&„Z”eedƒ� rjej•Z•ne„e„dêœdëd„Z•eedƒ� rŽej–Z–nVdBd�d�fdìœe—e—e—ej˜ej™ej+ejšej›díejšffdífej›egefdîœdïd„Z–eed ƒ� süee_ee_dS( éNéé)Ú GenericMetaÚ _type_varsÚClassVarÚ ConcatenateÚFinalÚ LiteralStringÚ ParamSpecÚSelfÚTypeÚ TypeVarTupleÚUnpackÚ AwaitableÚ AsyncIteratorÚ AsyncIterableÚ CoroutineÚAsyncGeneratorÚAsyncContextManagerÚChainMapÚContextManagerÚCounterÚDequeÚ DefaultDictÚ OrderedDictÚ TypedDictÚ SupportsIndexÚ AnnotatedÚ assert_neverÚdataclass_transformÚfinalÚIntVarÚ is_typeddictÚLiteralÚNewTypeÚoverloadÚProtocolÚ reveal_typeÚruntimeÚruntime_checkableÚTextÚ TypeAliasÚ TypeGuardÚ TYPE_CHECKINGÚNeverÚNoReturnÚRequiredÚ NotRequiredÚget_argsÚ get_originÚget_type_hintscCs2t|ƒ}d|kr.x|dD]}|j|dƒqW|S)NÚ __slots__)ÚdictÚpop)ÚdctZ dict_copyZslot©r9ú>/tmp/pip-build-_d5lkt3n/typing-extensions/typing_extensions.pyÚ_no_slots_copyUs r;c CsÊ|st|›d�ƒ‚|tkrFt|dƒ s.|j rmsz"_check_generic..css|]}t|tƒVqdS)N)Ú isinstancer )r>r?r9r9r:ú nsz!_check_generic..rNzToo ZmanyZfewz parameters for z ; actual z , expected )Ú TypeErrorÚ_markerÚhasattrr<ÚlenÚsum)ÚclsÚ parametersZelenZalenZ num_tv_tuplesr9r9r:Ú_check_generic`s  rJé cCst|tjtjtjfƒS)N)rAÚtypingÚ _GenericAliasÚ_typesÚ GenericAliasÚ UnionType)Útr9r9r:Ú_should_collect_from_parametersvsrRé cCst|tjtjfƒS)N)rArLrMrNrO)rQr9r9r:rR{scCst|tjƒo|j S)N)rArLrMÚ_special)rQr9r9r:rR~scsp|dkrtj}g‰xT|D]L}t||ƒrB|ˆkrBt|ƒ rBˆj|ƒt|ƒrˆj‡fdd„|jDƒƒqWtˆƒS)z®Collect all type variable contained in types in order of first appearance (lexicographic order). For example:: _collect_type_vars((T, List[S, T])) == (T, S) Ncsg|]}|ˆkr|‘qSr9r9)r>rQ)Útvarsr9r:r@“sz&_collect_type_vars..) rLÚTypeVarrAr=ÚappendrRÚextendr<Útuple)ÚtypesZ typevar_typesrQr9)rUr:Ú_collect_type_vars‚s    r[c@s$eZdZdZfZdd„Zdd„ZdS)Ú _NoReturna7Special type indicating functions that never return. Example:: from typing import NoReturn def stop() -> NoReturn: raise Exception('no way') This type is invalid in other positions, e.g., ``List[NoReturn]`` will fail in static type checkers. cCs tdƒ‚dS)Nz*NoReturn cannot be used with isinstance().)rC)ÚselfÚobjr9r9r:Ú__instancecheck__ªsz_NoReturn.__instancecheck__cCs tdƒ‚dS)Nz*NoReturn cannot be used with issubclass().)rC)r]rHr9r9r:Ú__subclasscheck__­sz_NoReturn.__subclasscheck__N)Ú__name__Ú __module__Ú __qualname__Ú__doc__r5r_r`r9r9r9r:r\œs r\T)Ú_rootÚTÚKTÚVTÚT_co)Ú covariantÚT_contra)Ú contravariantéc@seZdZdd„Zdd„ZdS)Ú _FinalFormcCs d|jS)Nztyping_extensions.)Ú_name)r]r9r9r:Ú__repr__Äsz_FinalForm.__repr__cCs"tj||j›d�ƒ}tj||fƒS)Nz accepts only single type)rLÚ _type_checkrorM)r]rIÚitemr9r9r:Ú __getitem__Çsz_FinalForm.__getitem__N)rarbrcrprsr9r9r9r:rnÂsrnaWA 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.)ÚdoccsNeZdZdZdZddd„Zdd„Zdd „Z‡fd d „Zd d „Z dd„Z ‡Z S)Ú_FinalaÙA special typing construct to indicate that a name cannot be re-assigned or overridden in a subclass. For example: MAX_SIZE: Final = 9000 MAX_SIZE += 1 # Error reported by type checker class Connection: TIMEOUT: Final[int] = 10 class FastConnector(Connection): TIMEOUT = 1 # Error reported by type checker There is no runtime checking of these properties. Ú__type__NcKs ||_dS)N)rv)r]ÚtpÚkwdsr9r9r:Ú__init__îsz_Final.__init__cCsRt|ƒ}|jdkr6|tj||jdd…›d�ƒdd�St|jdd…›d�ƒ‚dS)Néz accepts only single type.T)rez cannot be further subscripted)ÚtypervrLrqrarC)r]rrrHr9r9r:rsñs  z_Final.__getitem__cCs.tj|j||ƒ}||jkr|St|ƒ|dd�S)NT)re)rLÚ _eval_typervr{)r]ÚglobalnsÚlocalnsÚnew_tpr9r9r:r|ùs z_Final._eval_typecs0tƒjƒ}|jdk r,|dtj|jƒ›d�7}|S)Nú[ú])ÚsuperrprvrLÚ _type_repr)r]Úr)Ú __class__r9r:rpÿs  z_Final.__repr__cCstt|ƒj|jfƒS)N)Úhashr{rarv)r]r9r9r:Ú__hash__sz_Final.__hash__cCs,t|tƒstS|jdk r$|j|jkS||kS)N)rAruÚNotImplementedrv)r]Úotherr9r9r:Ú__eq__s    z _Final.__eq__)rv)N) rarbrcrdr5ryrsr|rpr‡rŠÚ __classcell__r9r9)r…r:ruÜs  rué c Cs(y d|_Wnttfk r"YnX|S)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__ÚAttributeErrorrC)Úfr9r9r:r s  cCs tj|ƒS)N)rLrV)Únamer9r9r:r!8sc@seZdZdd„Zdd„ZdS)Ú _LiteralFormcCs d|jS)Nztyping_extensions.)ro)r]r9r9r:rpCsz_LiteralForm.__repr__cCs tj||ƒS)N)rLrM)r]rIr9r9r:rsFsz_LiteralForm.__getitem__N)rarbrcrprsr9r9r9r:r�Asr�aoA 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.csNeZdZdZdZddd„Zdd„Zdd „Z‡fd d „Zd d „Z dd„Z ‡Z S)Ú_LiteralaØA type that can be used to indicate to type checkers that the corresponding value has a value literally equivalent to the provided parameter. For example: var: Literal[4] = 4 The type checker understands that 'var' is literally equal to the value 4 and no other value. Literal[...] cannot be subclassed. There is no runtime checking verifying that the parameter is actually a value instead of a type. Ú __values__NcKs ||_dS)N)r’)r]Úvaluesrxr9r9r:ryhsz_Literal.__init__cCsJt|ƒ}|jdkr.t|tƒs"|f}||dd�St|jdd…›d�ƒ‚dS)NT)rerzz cannot be further subscripted)r{r’rArYrCra)r]r“rHr9r9r:rsks    z_Literal.__getitem__cCs|S)Nr9)r]r}r~r9r9r:r|ssz_Literal._eval_typecs8tƒjƒ}|jdk r4|ddjttj|jƒƒ›d�7}|S)Nr€z, r�)r‚rpr’ÚjoinÚmaprLrƒ)r]r„)r…r9r:rpvs   z_Literal.__repr__cCstt|ƒj|jfƒS)N)r†r{rar’)r]r9r9r:r‡|sz_Literal.__hash__cCs,t|tƒstS|jdk r$|j|jkS||kS)N)rAr‘rˆr’)r]r‰r9r9r:rŠs    z_Literal.__eq__)r’)N) rarbrcrdr5ryrsr|rpr‡rŠr‹r9r9)r…r:r‘Xs   r‘cseZdZ‡fdd„Z‡ZS)Ú_ExtensionsGenericMetacs–|jdk r*tjdƒjdd kr&tdƒ‚dS|jsr×)rHr9r:rBBsz,_is_callable_members_only..)ÚallrØ)rHr9)rHr:Ú_is_callable_members_onlyAsrÛcOst|ƒjrtdƒ‚dS)Nz Protocols cannot be instantiated)r{rÅrC)r]r©Úkwargsr9r9r:Ú_no_initKs rÝcseZdZ‡fdd„Z‡ZS)Ú _ProtocolMetacsXtˆddƒ stˆƒr&tˆjˆƒr&dSˆjrLt‡‡fdd„tˆƒDƒƒrLdStƒjˆƒS)NrÅFTc3s8|]0}tˆ|ƒo.ttˆ|dƒƒ p.tˆ|ƒdk VqdS)N)rErÙrÏ)r>r×)rHÚinstancer9r:rBZsz2_ProtocolMeta.__instancecheck__..) rÏrÛr¡r…rÅrÚrØr‚r_)rHrß)r…)rHrßr:r_Rs z_ProtocolMeta.__instancecheck__)rarbrcr_r‹r9r9)r…r:rÞOsrÞcs>eZdZdZfZdZ‡fdd„Zejdd„ƒZ dd„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: ... Tcs|tkrtdƒ‚tƒj|ƒS)NzIType Protocol cannot be instantiated; it can only be used as a base class)r&rCr‚rª)rHr©rx)r…r9r:rª„szProtocol.__new__csàt|tƒs|f}| r2|tjk r2td|j›d�ƒ‚d‰t‡fdd„|Dƒƒ}|tkrÂtdd„|Dƒƒs¤d}xt||tjƒr†|d7}qlWtd |d›d ||›�ƒ‚t t |ƒƒt |ƒkrÔtd ƒ‚nt ||t |j ƒƒtj ||ƒS) NzParameter list to z[...] cannot be emptyz*Parameters to generic types must be types.c3s|]}tj|ˆƒVqdS)N)rLrq)r>r?)Úmsgr9r:rB’sz-Protocol.__class_getitem__..css|]}t|tjƒVqdS)N)rArLrV)r>r?r9r9r:rB•srrzzBParameters to Protocol[...] must all be type variables. Parameter z is z.Parameters to Protocol[...] must all be unique)rArYrLÚTuplerCrcr&rÚrVrFrÎrJr<rM)rHÚparamsÚir9)ràr:Ú__class_getitem__Šs&  zProtocol.__class_getitem__c sÒg}dˆjkrtjˆjk}n tjˆjk}|r4tdƒ‚dˆjk�rtjˆjƒ}d}xHˆjD]>}t|tjƒrX|j tjt fkrX|j j }|dk r�tdƒ‚|j }qXW|dkr¨|}nft |ƒ}t |ƒ‰|ˆk�s dj‡fdd„|Dƒƒ} djdd„|Dƒƒ} td| ›d |›d | ›d �ƒ‚|}t|ƒˆ_ ˆjjd dƒ�s>td d„ˆjDƒƒˆ_‡fdd„} dˆjk�r\| ˆ_ˆj�shdSx^ˆjD]T}|ttjfk�p¬|jdk�rœ|j tk�p¬t|tƒ�o¬|j�sptdt|ƒ›�ƒ‚�qpWtˆ_dS)NrÊz!Cannot inherit from plain GenericzECannot inherit from Generic[...] and/or Protocol[...] multiple types.z, c3s|]}|ˆkrt|ƒVqdS)N)Ústr)r>rQ)Úgvarsetr9r:rBÄsz-Protocol.__init_subclass__..css|]}t|ƒVqdS)N)rå)r>Úgr9r9r:rBÅszSome type variables (z) are not listed in r€r�rÅcss|]}|tkVqdS)N)r&)r>Úbr9r9r:rBÍscsòˆjjddƒstStˆddƒs>tjdƒjdd kr6tStdƒ‚tˆƒsftjdƒjddkr^tStd ƒ‚t |t ƒsxtd ƒ‚xtt ˆƒD]h}xb|j D]T}||jkr°|j|dkr®tSPt|d iƒ}t |t jƒrŽ||krŽt |tƒrŽ|jrŽPqŽWtSq‚Wd S)NrÅrÆFrmrar—r˜zBInstance and class checks can only be used with @runtime protocolsz._proto_hookržzcollections.abcz5Protocols can only inherit from other protocols, got )rÇrLrÀrÊÚ __bases__rCr[rArMr™r&rar<rÎr”rYréÚanyrÅržÚobjectrbÚ_PROTO_WHITELISTrÞÚreprrÝry) rHr©rÜrUÚerrorÚgvarsrÕZthe_baseÚtvarsetÚs_varsÚs_argsrër9)rHrær:Ú__init_subclass__¤sR              zProtocol.__init_subclass__) rarbrcrdr5rÅrªrLÚ _tp_cacherärör‹r9r9)r…r:r&as  )r«)Ú _next_in_mrorqcOst|ƒjrtdƒ‚dS)Nz Protocols cannot be instantiated)r{rÅrC)r]r©rÜr9r9r:rÝs csTeZdZdZd ‡fdd„ Z‡fdd„Z‡fdd„Z‡fd d „Zej d d „ƒZ ‡Z S)rÞzˆInternal metaclass for Protocol. This exists so Protocol classes can be generic without deriving from Generic. Nc sh|dks t‚|dk r<|dk s t‚tdd„|Dƒƒs:t|ƒ‚nìt|ƒ}d} xN|D]F} | tjkrdtdƒ‚t| tƒrN| jtjt fkrN| dk rŽtdƒ‚| j } qNW| dkr¦|} n‚t |ƒ} t | ƒ‰| ˆk�s$dj ‡fdd„|Dƒƒ} dj dd„| Dƒƒ} t dd„|Dƒƒ�rd nd }td | ›d |›d | ›d�ƒ‚| }|}|dk �rZt|ƒtjk�rZ||k�rZ|f|}tdd„|Dƒƒ}t dd„|Dƒƒ�r’tdd„|Dƒƒ}|j||dœƒtt|ƒj||||dd�}tt|ƒjd|�sÒ|nt|ƒƒ||_ |�rútdd„|Dƒƒnd|_t|ƒ|_|dk�r||_n|dk �r6|j|_|j|_t|dƒ�rd|�rTt|jƒƒn tt|ƒj ƒ|_!|S)Ncss|]}t|tjƒVqdS)N)rArLrV)r>rQr9r9r:rBsz(_ProtocolMeta.__new__..z!Cannot inherit from plain GenericzACannot inherit from Generic[...] or Protocol[...] multiple times.z, c3s|]}|ˆkrt|ƒVqdS)N)rå)r>rQ)rær9r:rB(scss|]}t|ƒVqdS)N)rå)r>rçr9r9r:rB)scss|]}|jtjkVqdS)N)r™rLrÀ)r>rèr9r9r:rB*srÀr&zSome type variables (z) are not listed in r€r�css$|]}t|tƒrt|ƒn|VqdS)N)rArr¥)r>rèr9r9r:rB4scss"|]}t|tƒo|tjk VqdS)N)rArrLrÀ)r>rèr9r9r:rB6scss|]}|tjk r|VqdS)N)rLrÀ)r>rèr9r9r:rB7s)r™r�T)rer¥css.|]&}|tjkrdn|tjkr"fn|VqdS).N)rLZ_TypingEllipsisZ _TypingEmpty)r>Úar9r9r:rB?sÚ _subs_tree)"r·rÚrrLrÀrCrArr™r&r<rÎr”rír{r—ÚABCMetarYÚupdater‚rªÚ __setattr__r¥rÈrørÉrÊÚ _abc_registryÚ _abc_cacherEr†rúr‡rË)rHr�ÚbasesÚ namespacerUr©Úoriginr¬Ú orig_basesròrÕrórôrõZcls_nameZ initial_basesr])r…)rær:rª sh                 z_ProtocolMeta.__new__csÒtƒj||Žˆjjddƒs2tdd„ˆjDƒƒˆ_ˆjr²xrˆjdd…D]`}|tt j fkp”|j dkrn|j t kp”t|t jƒr€|jp”t|tƒo”|jt j ksHtdt|ƒ›�ƒ‚qHWtˆ_‡fdd„}d ˆjkrÎ|ˆ_dS) NrÅcss*|]"}|tkp t|tƒo |jtkVqdS)N)r&rArÞr™)r>rèr9r9r:rBPsz)_ProtocolMeta.__init__..rzzcollections.abcz5Protocols can only inherit from other protocols, got csžˆjjddƒstSt|tƒs$tdƒ‚xttˆƒD]h}xb|jD]T}||jkr\|j|dkrZtSPt|diƒ}t|t j ƒr:||kr:t|t ƒr:|j r:Pq:WtSq.WdS)NrÅz"issubclass() arg 1 must be a classrÁT) rÇrérˆrAr{rCrØrŸrÏrLrêrÞrÅ)r‰r×rÕrÖ)rHr9r:rëas$      z+_ProtocolMeta.__init__.._proto_hookrž)r‚ryrÇrérírìrÅrŸrîrLrÀrbrarïrAÚ TypingMetarr™rCrðrÝrž)rHr©rÜrÕrë)r…)rHr:ryMs"      z_ProtocolMeta.__init__cs\tˆddƒ stˆƒr&tˆjˆƒr&dSˆjrLt‡‡fdd„tˆƒDƒƒrLdSttˆƒj ˆƒS)NrÅFTc3s8|]0}tˆ|ƒo.ttˆ|dƒƒ p.tˆ|ƒdk VqdS)N)rErÙrÏ)r>r×)rßr]r9r:rB�sz2_ProtocolMeta.__instancecheck__..) rÏrÛr¡r…rÅrÚrØr‚rr_)r]rß)r…)rßr]r:r_ys z_ProtocolMeta.__instancecheck__cs¼|jdk r*tjdƒjdd kr&tdƒ‚dS|jjddƒrh|jjddƒ rhtjdƒjdd kr`dStd ƒ‚|jjddƒr¬t|ƒ r¬tjdƒjddkr¤tt |ƒj |ƒStd ƒ‚tt |ƒj |ƒS)Nrzrar—r˜zCParameterized generics cannot be used with class or instance checksFrÅrÆrLzBInstance and class checks can only be used with @runtime protocolszr?)ràr9r:rBªsz,_ProtocolMeta.__getitem__..css|]}t|tjƒVqdS)N)rArLrV)r>r?r9r9r:rB¬szParameters to z [...] must all be type variablesz[...] must all be uniquez%Cannot subscript already-subscripted )rUr©rr¬r)rArYr¥rLrárCrcrÀr&rÚrðrFrÎr¸rr™rJr<r…rarìr;rÇr�rÊ)r]rârUr©Úprependr9)ràr:rs sB z_ProtocolMeta.__getitem__)NNNNN) rarbrcrdrªryr_r`rLr÷rsr‹r9r9)r…r:rÞs ? ,  c@s eZdZdZfZdZdd„ZdS)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: ... TcOs*t|ƒtkrtdƒ‚tj|j|f|ž|ŽS)NzIType Protocol cannot be instantiated; it can be used only as a base class)r¥r&rCrLr¨rÉ)rHr©rxr9r9r:rªès zProtocol.__new__N)rarbrcrdr5rÅrªr9r9r9r:r&ÈscCs,t|tƒ s|j r"td|›�ƒ‚d|_|S)a4Mark 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)rArÞrÅrCrÆ)rHr9r9r:r)ôsc@s$eZdZfZejedœdd„ƒZdS)r)ÚreturncCsdS)Nr9)r]r9r9r:Ú __index__szSupportsIndex.__index__N)rarbrcr5r—rµÚintrr9r9r9r:r sc Cs>y tjdƒjddkrtdƒ‚Wnttfk r8YnXdS) Nrzrar—r˜rLz4TypedDict does not support instance and class checksF)r—r˜rL)ršr›rœrCr�Ú ValueError)rHr‰r9r9r:Ú _check_fails s r cOs,|s tdƒ‚|d|dd…}}t||ŽS)Nz)TypedDict.__new__(): not enough argumentsrrz)rCr6)r©rÜÚ_r9r9r:Ú _dict_new+sr z,($cls, _typename, _fields=None, /, **kwargs))ÚtotalcOs^|s tdƒ‚|d|dd…}}|r>|d|dd…}}n4d|krj|jdƒ}ddl}|jdtdd�ntdƒ‚|r°y |\}Wqìtk r¬td t|ƒd›d �ƒ‚YqìXnÚnrw)ràr9r:ú ssz*_TypedDictMeta.__new__..Ú__required_keys__Ú__optional_keys__rÚ __total__)rr r‚rªr6réÚitemsrÎrürÇÚPEP_560r3rr2r0rÓr1rÑrÁÚ frozensetrrrEr)rHr�rrr Ztp_dictrÖZown_annotationsZ required_keysZ optional_keysrÕZannotation_keyZannotation_typeZannotation_originZannotation_argsZown_annotation_keys)r…)ràr:rªfsN                z_TypedDictMeta.__new__)T)T) rarbrcryrªr r_r`r‹r9r9)r…r:rbs8ra»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+ cCst|ttƒƒS)aCheck 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 )rArYÚ_TYPEDDICT_TYPES)rwr9r9r:r"Ås cCst|tƒrt|jƒSt|dƒr:|jttfkr:t|jdƒSt|tj ƒrrt dd„|jDƒƒ}||jkrh|S|j |ƒStt dƒr¸t|t j ƒr¸t dd„|jDƒƒ}||jkrª|St j |j|ƒStt dƒrþt|t jƒrþt dd„|jDƒƒ}||jkrð|Stjtj|ƒS|S) z=Strips Annotated, Required and NotRequired from a given type.r™rcss|]}t|ƒVqdS)N)Ú _strip_extras)r>rùr9r9r:rBàsz _strip_extras..rOcss|]}t|ƒVqdS)N)r")r>rùr9r9r:rBåsrPcss|]}t|ƒVqdS)N)r")r>rùr9r9r:rBês)rAÚ_AnnotatedAliasr"r™rEr0r1rÈrLrMrYÚ copy_withrZrOrPr˜ÚreduceÚoperatorÚor_)rQZ stripped_argsr9r9r:r"Ùs(       r"FcCsHttdƒrtj|||dd�}ntj|||d�}|r6|Sdd„|jƒ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. rT)r}r~Úinclude_extras)r}r~cSsi|]\}}t|ƒ|“qSr9)r")r>ÚkrQr9r9r:rsz"get_type_hints..)rErLr4r)r^r}r~r(Zhintr9r9r:r4ñs csHeZdZdZ‡fdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z ‡Z S)r#aKRuntime 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. cs2t|tƒr|j|}|j}tƒj||ƒ||_dS)N)rAr#Ú __metadata__r™r‚ry)r]rÚmetadata)r…r9r:ry,s   z_AnnotatedAlias.__init__cCs$t|ƒdkst‚|d}t||jƒS)Nrzr)rFr·r#r*)r]râZnew_typer9r9r:r$3sz_AnnotatedAlias.copy_withcCs,dtj|jƒ›ddjdd„|jDƒƒ›d�S)Nztyping_extensions.Annotated[z, css|]}t|ƒVqdS)N)rð)r>rùr9r9r:rB9sz+_AnnotatedAlias.__repr__..r�)rLrƒr™r”r*)r]r9r9r:rp8sz_AnnotatedAlias.__repr__cCstjt|jf|jffS)N)r&Úgetitemrr™r*)r]r9r9r:Ú __reduce__<sz_AnnotatedAlias.__reduce__cCs*t|tƒstS|j|jkrdS|j|jkS)NF)rAr#rˆr™r*)r]r‰r9r9r:rŠAs   z_AnnotatedAlias.__eq__cCst|j|jfƒS)N)r†r™r*)r]r9r9r:r‡Hsz_AnnotatedAlias.__hash__) rarbrcrdryr$rpr-rŠr‡r‹r9r9)r…r:r#$s r#c@s2eZdZdZfZdd„Zejdd„ƒZdd„Z dS) ra¡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()] cOs tdƒ‚dS)Nz&Type Annotated cannot be instantiated.)rC)rHr©rÜr9r9r:rªnszAnnotated.__new__cCspt|tƒ st|ƒdkr tdƒ‚ttf}t|dƒ|krB|d}nd}tj|d|ƒ}t|dd…ƒ}t ||ƒS)NrmzUAnnotated[...] should be used with at least two arguments (a type and an annotation).rz$Annotated[t, ...]: t must be a type.rz) rArYrFrCrrr3rLrqr#)rHrâZallowed_special_formsrràr+r9r9r:räqs zAnnotated.__class_getitem__cOstd|j›d�ƒ‚dS)NzCannot subclass z .Annotated)rCrb)rHr©rÜr9r9r:rö€szAnnotated.__init_subclass__N) rarbrcrdr5rªrLr÷rärör9r9r9r:rKs cCs t|ƒdko|jdƒo|jdƒS)z3Returns True if name is a __dunder_variable_name__.éÚ__)rFrÒÚendswith)r�r9r9r:Ú _is_dunder‡sr1csˆeZdZdZ‡fdd„Zedd„ƒZdd„Zd‡fd d „ Zd d „Z e j ‡fd d„ƒZ dd„Z dd„Z‡fdd„Zdd„Zdd„Z‡ZS)Ú AnnotatedMetazMetaclass for Annotatedc s8tdd„|Dƒƒr"tdttƒƒ‚tƒj||||f|ŽS)Ncss|]}|tk VqdS)N)rî)r>rèr9r9r:rB“sz(AnnotatedMeta.__new__..zCannot subclass )rírCrårr‚rª)rHr�rrrÜ)r…r9r:rª’szAnnotatedMeta.__new__cCs |jƒdS)Nrm)rú)r]r9r9r:r*—szAnnotatedMeta.__metadata__cCsX|\}}}t|tƒs tj|ƒ}n|dj|ƒ}djdd„|Dƒƒ}|›d|›d|›d�S)Nrz, css|]}t|ƒVqdS)N)rð)r>Úargr9r9r:rB¡sz+AnnotatedMeta._tree_repr..r€r�)rArYrLrƒÚ _tree_reprr”)r]ÚtreerHrr+Ztp_reprZmetadata_reprsr9r9r:r4›s    zAnnotatedMeta._tree_reprNcsh|tkr tStƒj||d�}t|dtƒrd|ddtkrd|dd}|dd}t|||dfS|S)N)rUr©rzrrm)rr‚rúrArY)r]rUr©r£Zsub_tpZ sub_annot)r…r9r:rú¤s  zAnnotatedMeta._subs_treecCsX|jdkrtdƒ‚|jƒ}x"t|tƒr<|dtkr<|d}qWt|tƒrP|dS|SdS)z6Return the class used to create instance of this type.NzCCannot get the underlying type of a non-specialized Annotated type.rrz)r™rCrúrArYr)r]r5r9r9r:Ú _get_cons¯s   zAnnotatedMeta._get_conscsÂt|tƒs|f}|jdk r&tƒj|ƒSt|tƒ s>t|ƒdkrHtdƒ‚nPt|dtjƒrtt |dƒj dkrt|d}nd}tj |d|ƒ}t|dd…ƒ}|j |j |j t|jƒt|fƒ||f|d�S)Nrmz]Annotated[...] should be instantiated with at least two arguments (a type and an annotation).rZ _ClassVarz$Annotated[t, ...]: t must be a type.rz)rUr©r)rArYr™r‚rsrFrCrLÚ _TypingBaser{rarqr…rìr;rÇr)r]rârwràr+)r…r9r:rs¼s&     zAnnotatedMeta.__getitem__c Os6|jƒ}|||Ž}y ||_Wntk r0YnX|S)N)r6Z__orig_class__r�)r]r©rÜÚconsÚresultr9r9r:Ú__call__Ús  zAnnotatedMeta.__call__cCs.|jdk r"t|ƒ r"t|jƒ|ƒSt|ƒ‚dS)N)r™r1rÏr6r�)r]r×r9r9r:Ú __getattr__ãszAnnotatedMeta.__getattr__csJt|ƒs|jdƒr"tƒj||ƒn$|jdkr6t|ƒ‚nt|jƒ||ƒdS)NrÂ)r1rÒr‚rýr™r�Úsetattrr6)r]r×Úvalue)r…r9r:rýés   zAnnotatedMeta.__setattr__cCs tdƒ‚dS)Nz+Annotated cannot be used with isinstance().)rC)r]r^r9r9r:r_ñszAnnotatedMeta.__instancecheck__cCs tdƒ‚dS)Nz+Annotated cannot be used with issubclass().)rC)r]rHr9r9r:r`ôszAnnotatedMeta.__subclasscheck__)NN)rarbrcrdrªÚpropertyr*r4rúr6rLr÷rsr:r;rýr_r`r‹r9r9)r…r:r2�s       r2c@seZdZdZdS)ravAdd context specific metadata to a type. Example: Annotated[int, runtime_check.Unsigned] indicates to the hypothetical runtime_check module that this type is an unsigned int. Every other consumer of this type can ignore this metadata and treat this type as int. The first argument to Annotated must be a valid type, the remaining arguments are kept as a tuple in the __metadata__ field. Details: - It's an error to call `Annotated` with less than two arguments. - Nested Annotated are flattened:: Annotated[Annotated[T, Ann1, Ann2], Ann3] == Annotated[T, Ann1, Ann2, Ann3] - Instantiating an annotated type is equivalent to instantiating the underlying type:: Annotated[C, Ann1](5) == C(5) - Annotated can be used as a generic type alias:: Optimized = Annotated[T, runtime.Optimize()] Optimized[int] == Annotated[int, runtime.Optimize()] OptimizedList = Annotated[List[T], runtime.Optimize()] OptimizedList[int] == Annotated[List[int], runtime.Optimize()] N)rarbrcrdr9r9r9r:r÷s)Ú_BaseGenericAlias)rOcCs>t|tƒrtSt|tjttttfƒr*|j S|tj kr:tj SdS)a6Get 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) rAr#rrLrMrOr?Ú ParamSpecArgsÚParamSpecKwargsr™rÀ)rwr9r9r:r3*s    cCszt|tƒr|jf|jSt|tjtfƒrvt|ddƒr8fS|j}t |ƒt j j krr|dt k rrt|dd…ƒ|df}|SfS)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) rTFrNrzrÍrÍ)rAr#r™r*rLrMrOrÏrÈr3r¦r—r¸ÚEllipsisrÐ)rwr£r9r9r:r2Bs  c@seZdZdd„ZdS)Ú_TypeAliasFormcCs d|jS)Nztyping_extensions.)ro)r]r9r9r:rp_sz_TypeAliasForm.__repr__N)rarbrcrpr9r9r9r:rC^srCcCst|›d�ƒ‚dS)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. z is not subscriptableN)rC)r]rIr9r9r:r+bs c@seZdZdd„ZdS)rCcCs d|jS)Nztyping_extensions.)ro)r]r9r9r:rprsz_TypeAliasForm.__repr__N)rarbrcrpr9r9r9r:rCqsa¯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@seZdZdZdd„ZdS)Ú_TypeAliasMetazMetaclass for TypeAliascCsdS)Nztyping_extensions.TypeAliasr9)r]r9r9r:rp…sz_TypeAliasMeta.__repr__N)rarbrcrdrpr9r9r9r:rD‚srDc@s,eZdZdZfZdd„Zdd„Zdd„ZdS) Ú_TypeAliasBasea&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. cCs tdƒ‚dS)Nz+TypeAlias cannot be used with isinstance().)rC)r]r^r9r9r:r_•sz _TypeAliasBase.__instancecheck__cCs tdƒ‚dS)Nz+TypeAlias cannot be used with issubclass().)rC)r]rHr9r9r:r`˜sz _TypeAliasBase.__subclasscheck__cCsdS)Nztyping_extensions.TypeAliasr9)r]r9r9r:rp›sz_TypeAliasBase.__repr__N)rarbrcrdr5r_r`rpr9r9r9r:rEˆs  rE)r«rer@c@s$eZdZdZfZdd„Zdd„ZdS)Ú _Immutablez3Mixin to indicate that object should not be copied.cCs|S)Nr9)r]r9r9r:Ú__copy__«sz_Immutable.__copy__cCs|S)Nr9)r]Úmemor9r9r:Ú __deepcopy__®sz_Immutable.__deepcopy__N)rarbrcrdr5rGrIr9r9r9r:rF§srFc@s(eZdZdZdd„Zdd„Zdd„ZdS) r@aQThe 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. cCs ||_dS)N)r™)r]rr9r9r:ry½szParamSpecArgs.__init__cCs|jj›d�S)Nz.args)r™ra)r]r9r9r:rpÀszParamSpecArgs.__repr__cCst|tƒstS|j|jkS)N)rAr@rˆr™)r]r‰r9r9r:rŠÃs zParamSpecArgs.__eq__N)rarbrcrdryrprŠr9r9r9r:r@±s c@s(eZdZdZdd„Zdd„Zdd„ZdS) rAa[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. cCs ||_dS)N)r™)r]rr9r9r:ryÔszParamSpecKwargs.__init__cCs|jj›d�S)Nz.kwargs)r™ra)r]r9r9r:rp×szParamSpecKwargs.__repr__cCst|tƒstS|j|jkS)N)rArArˆr™)r]r‰r9r9r:rŠÚs zParamSpecKwargs.__eq__N)rarbrcrdryrprŠr9r9r9r:rAÈs rAcs|eZdZdZejZedd„ƒZedd„ƒZ ddddœ‡fd d „ Z d d „Z d d„Z dd„Z dd„Zdd„Zestdd„Z‡ZS)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. cCst|ƒS)N)r@)r]r9r9r:r©szParamSpec.argscCst|ƒS)N)rA)r]r9r9r:rÜszParamSpec.kwargsNF)Úboundrjrlc sŠtƒj|gƒ||_t|ƒ|_t|ƒ|_|rszParamSpec.__eq__cCs|jS)N)ra)r]r9r9r:r-AszParamSpec.__reduce__cOsdS)Nr9)r]r©rÜr9r9r:r:EszParamSpec.__call__cCs||kr|j|ƒdS)N)rW)r]rUr9r9r:Ú_get_type_varsJszParamSpec._get_type_vars)rarbrcrdrLrVr…r>r©rÜryrpr‡rŠr-r:rrTr‹r9r9)r…r:r æs-   csheZdZerejZnejZdZej Z ‡fdd„Z dd„Z dd„Z dd „Zed d „ƒZes`d d „Z‡ZS)Ú_ConcatenateGenericAliasFcstƒj|ƒ||_||_dS)N)r‚ryr™rÈ)r]rr©)r…r9r:ry_s z!_ConcatenateGenericAlias.__init__cs2tj‰ˆ|jƒ›ddj‡fdd„|jDƒƒ›d�S)Nr€z, c3s|]}ˆ|ƒVqdS)Nr9)r>r3)rƒr9r:rBfsz4_ConcatenateGenericAlias.__repr__..r�)rLrƒr™r”rÈ)r]r9)rƒr:rpdsz!_ConcatenateGenericAlias.__repr__cCst|j|jfƒS)N)r†r™rÈ)r]r9r9r:r‡isz!_ConcatenateGenericAlias.__hash__cOsdS)Nr9)r]r©rÜr9r9r:r:msz!_ConcatenateGenericAlias.__call__cCstdd„|jDƒƒS)Ncss"|]}t|tjtfƒr|VqdS)N)rArLrVr )r>rwr9r9r:rBssz:_ConcatenateGenericAlias.__parameters__..)rYrÈ)r]r9r9r:r<psz'_ConcatenateGenericAlias.__parameters__cCs|jr|jrtj|j|ƒdS)N)r™r<rLrT)r]rUr9r9r:rTxs z'_ConcatenateGenericAlias._get_type_vars)rarbrcrrLrMr…r7rTrÀr¥ryrpr‡r:r>r<rTr‹r9r9)r…r:rURs  rUcsZ|fkrtdƒ‚t|tƒs |f}t|dtƒs6tdƒ‚d‰t‡fdd„|Dƒƒ}t||ƒS)Nz&Cannot take a Concatenate of no types.rzzAThe last parameter to Concatenate should be a ParamSpec variable.z/Concatenate[arg, ...]: each arg must be a type.c3s|]}tj|ˆƒVqdS)N)rLrq)r>r?)ràr9r:rBˆsz'_concatenate_getitem..rÍ)rCrArYr rU)r]rIr9)ràr:Ú_concatenate_getitem~s rVcCs t||ƒS)a&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. )rV)r]rIr9r9r:r’s c@seZdZdd„Zdd„ZdS)Ú_ConcatenateFormcCs d|jS)Nztyping_extensions.)ro)r]r9r9r:rp¢sz_ConcatenateForm.__repr__cCs t||ƒS)N)rV)r]rIr9r9r:rs¥sz_ConcatenateForm.__getitem__N)rarbrcrprsr9r9r9r:rW¡srWa&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. c@seZdZdZdd„ZdS)Ú_ConcatenateAliasMetazMetaclass for Concatenate.cCsdS)Nztyping_extensions.Concatenater9)r]r9r9r:rp¹sz_ConcatenateAliasMeta.__repr__N)rarbrcrdrpr9r9r9r:rX¶srXc@s4eZdZdZfZdd„Zdd„Zdd„Zdd „Zd S) Ú_ConcatenateAliasBasea&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. cCs tdƒ‚dS)Nz-Concatenate cannot be used with isinstance().)rC)r]r^r9r9r:r_Ësz'_ConcatenateAliasBase.__instancecheck__cCs tdƒ‚dS)Nz-Concatenate cannot be used with issubclass().)rC)r]rHr9r9r:r`Îsz'_ConcatenateAliasBase.__subclasscheck__cCsdS)Nztyping_extensions.Concatenater9)r]r9r9r:rpÑsz_ConcatenateAliasBase.__repr__cCs t||ƒS)N)rV)r]rIr9r9r:rsÔsz!_ConcatenateAliasBase.__getitem__N) rarbrcrdr5r_r`rprsr9r9r9r:rY¼s  rYc@seZdZdd„ZdS)Ú_TypeGuardFormcCs d|jS)Nztyping_extensions.)ro)r]r9r9r:rpßsz_TypeGuardForm.__repr__N)rarbrcrpr9r9r9r:rZÞsrZcCs tj||›d�ƒ}tj||fƒS)a 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). z accepts only single type.)rLrqrM)r]rIrrr9r9r:r,âs,c@seZdZdd„Zdd„ZdS)rZcCs d|jS)Nztyping_extensions.)ro)r]r9r9r:rpsz_TypeGuardForm.__repr__cCs"tj||j›d�ƒ}tj||fƒS)Nz accepts only a single type)rLrqrorM)r]rIrrr9r9r:rssz_TypeGuardForm.__getitem__N)rarbrcrprsr9r9r9r:rZsa 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). csNeZdZdZdZddd„Zdd„Zdd „Z‡fd d „Zd d „Z dd„Z ‡Z S)Ú _TypeGuarda 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). rvNcKs ||_dS)N)rv)r]rwrxr9r9r:ryxsz_TypeGuard.__init__cCsRt|ƒ}|jdkr6|tj||jdd…›d�ƒdd�St|jdd…›d�ƒ‚dS)Nrzz accepts only a single type.T)rez cannot be further subscripted)r{rvrLrqrarC)r]rrrHr9r9r:rs{s  z_TypeGuard.__getitem__cCs.tj|j||ƒ}||jkr|St|ƒ|dd�S)NT)re)rLr|rvr{)r]r}r~rr9r9r:r|ƒs z_TypeGuard._eval_typecs0tƒjƒ}|jdk r,|dtj|jƒ›d�7}|S)Nr€r�)r‚rprvrLrƒ)r]r„)r…r9r:rp‰s  z_TypeGuard.__repr__cCstt|ƒj|jfƒS)N)r†r{rarv)r]r9r9r:r‡�sz_TypeGuard.__hash__cCs,t|tƒstS|jdk r$|j|jkS||kS)N)rAr[rˆrv)r]r‰r9r9r:rŠ’s    z_TypeGuard.__eq__)rv)N) rarbrcrdr5ryrsr|rpr‡rŠr‹r9r9)r…r:r[Js*  r[c@sneZdZdZdd„Zdd„Zdd „Zd d „Zd d „Zdd„Z dd„Z dd„Z dd„Z dd„Z ejdd„ƒZdS)Ú _SpecialFormrordÚ_getitemcCs||_|j|_|j|_dS)N)r]rarord)r]r,r9r9r:ry¡sz_SpecialForm.__init__cCs|dkr|jSt|ƒ‚dS)Nrarc>rarc)ror�)r]rrr9r9r:r;¦sz_SpecialForm.__getattr__cCstd|›�ƒ‚dS)NzCannot subclass )rC)r]rr9r9r:Ú__mro_entries__¬sz_SpecialForm.__mro_entries__cCs d|j›�S)Nztyping_extensions.)ro)r]r9r9r:rp¯sz_SpecialForm.__repr__cCs|jS)N)ro)r]r9r9r:r-²sz_SpecialForm.__reduce__cOstd|›�ƒ‚dS)NzCannot instantiate )rC)r]r©rxr9r9r:r:µsz_SpecialForm.__call__cCstj||fS)N)rLÚUnion)r]r‰r9r9r:Ú__or__¸sz_SpecialForm.__or__cCstj||fS)N)rLr_)r]r‰r9r9r:Ú__ror__»sz_SpecialForm.__ror__cCst|›d�ƒ‚dS)Nz! cannot be used with isinstance())rC)r]r^r9r9r:r_¾sz_SpecialForm.__instancecheck__cCst|›d�ƒ‚dS)Nz! cannot be used with issubclass())rC)r]rHr9r9r:r`Ász_SpecialForm.__subclasscheck__cCs |j||ƒS)N)r])r]rIr9r9r:rsÄsz_SpecialForm.__getitem__N)rordr])rarbrcr5ryr;r^rpr-r:r`rar_r`rLr÷rsr9r9r9r:r\žsr\cCst|›d�ƒ‚dS)aDRepresents an arbitrary literal string. Example:: from 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. z is not subscriptableN)rC)r]râr9r9r:r Ìsc@s$eZdZdZfZdd„Zdd„ZdS)Ú_LiteralStringaDRepresents an arbitrary literal string. Example:: from 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. cCst|›d�ƒ‚dS)Nz" cannot be used with isinstance().)rC)r]r^r9r9r:r_òsz _LiteralString.__instancecheck__cCst|›d�ƒ‚dS)Nz" cannot be used with issubclass().)rC)r]rHr9r9r:r`õsz _LiteralString.__subclasscheck__N)rarbrcrdr5r_r`r9r9r9r:rbßsrbcCst|›d�ƒ‚dS)zòUsed to spell the type of "self" in classes. Example:: from typing import Self class ReturnsSelf: def parse(self, data: bytes) -> Self: ... return self z is not subscriptableN)rC)r]râr9r9r:r þsc@s$eZdZdZfZdd„Zdd„ZdS)Ú_SelfzòUsed to spell the type of "self" in classes. Example:: from typing import Self class ReturnsSelf: def parse(self, data: bytes) -> Self: ... return self cCst|›d�ƒ‚dS)Nz" cannot be used with isinstance().)rC)r]r^r9r9r:r_ sz_Self.__instancecheck__cCst|›d�ƒ‚dS)Nz" cannot be used with issubclass().)rC)r]rHr9r9r:r`" sz_Self.__subclasscheck__N)rarbrcrdr5r_r`r9r9r9r:rc s rccCst|›d�ƒ‚dS)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 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 z is not subscriptableN)rC)r]râr9r9r:r.+ sc@s$eZdZdZfZdd„Zdd„ZdS)Ú_Nevera¬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 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 cCst|›d�ƒ‚dS)Nz" cannot be used with isinstance().)rC)r]r^r9r9r:r_^ sz_Never.__instancecheck__cCst|›d�ƒ‚dS)Nz" cannot be used with issubclass().)rC)r]rHr9r9r:r`a sz_Never.__subclasscheck__N)rarbrcrdr5r_r`r9r9r9r:rdE srdc@seZdZdd„ZdS)Ú_ExtensionsSpecialFormcCs d|jS)Nztyping_extensions.)ro)r]r9r9r:rpl sz_ExtensionsSpecialForm.__repr__N)rarbrcrpr9r9r9r:rek srecCs"tj||j›d�ƒ}tj||fƒS)aê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. z accepts only single type)rLrqrorM)r]rIrrr9r9r:r0o scCs"tj||j›d�ƒ}tj||fƒS)a`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, ) z accepts only single type)rLrqrorM)r]rIrrr9r9r:r1ƒ sc@seZdZdd„Zdd„ZdS)Ú _RequiredFormcCs d|jS)Nztyping_extensions.)ro)r]r9r9r:rp– sz_RequiredForm.__repr__cCs"tj|dj|jƒƒ}tj||fƒS)Nz{} accepts only single type)rLrqÚformatrorM)r]rIrrr9r9r:rs™ sz_RequiredForm.__getitem__N)rarbrcrprsr9r9r9r:rf• srfaê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. a`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, ) csJeZdZdZddd„Zdd„Zdd„Z‡fd d „Zd d „Zd d„Z ‡Z S)Ú_MaybeRequiredrvNcKs ||_dS)N)rv)r]rwrxr9r9r:ry sz_MaybeRequired.__init__cCsRt|ƒ}|jdkr6|tj|dj|jdd…ƒƒdd�Stdj|jdd…ƒƒ‚dS)Nz{} accepts only single type.rzT)rez {} cannot be further subscripted)r{rvrLrqrgrarC)r]rrrHr9r9r:rsÅ s z_MaybeRequired.__getitem__cCs.tj|j||ƒ}||jkr|St|ƒ|dd�S)NT)re)rLr|rvr{)r]r}r~rr9r9r:r|Î s z_MaybeRequired._eval_typecs.tƒjƒ}|jdk r*|djtj|jƒƒ7}|S)Nz[{}])r‚rprvrgrLrƒ)r]r„)r…r9r:rpÔ s  z_MaybeRequired.__repr__cCstt|ƒj|jfƒS)N)r†r{rarv)r]r9r9r:r‡Ú sz_MaybeRequired.__hash__cCs0t|t|ƒƒstS|jdk r(|j|jkS||kS)N)rAr{rˆrv)r]r‰r9r9r:rŠÝ s   z_MaybeRequired.__eq__)rv)N) rarbrcr5ryrsr|rpr‡rŠr‹r9r9)r…r:rh¿ s   rhc@seZdZdZdS)Ú _Requiredaê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. N)rarbrcrdr9r9r9r:riä sric@seZdZdZdS)Ú _NotRequireda`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, ) N)rarbrcrdr9r9r9r:rjõ s rjc@seZdZdd„ZdS)Ú_UnpackSpecialFormcCs d|jS)Nztyping_extensions.)ro)r]r9r9r:rp sz_UnpackSpecialForm.__repr__N)rarbrcrpr9r9r9r:rk srkc@seZdZejZdS)Ú _UnpackAliasN)rarbrcrLrVr…r9r9r9r:rl srlcCs tj||j›d�ƒ}t||fƒS)aA 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]]: ... z accepts only single type)rLrqrorl)r]rIrrr9r9r:r s cCs t|tƒS)N)rArl)r^r9r9r:r= sr=c@seZdZejZdS)rlN)rarbrcrLrVr…r9r9r9r:rl" sc@seZdZdd„Zdd„ZdS)Ú _UnpackFormcCs d|jS)Nztyping_extensions.)ro)r]r9r9r:rp& sz_UnpackForm.__repr__cCs tj||j›d�ƒ}t||fƒS)Nz accepts only single type)rLrqrorl)r]rIrrr9r9r:rs) sz_UnpackForm.__getitem__N)rarbrcrprsr9r9r9r:rm% srmaA 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]]: ... cCs t|tƒS)N)rArl)r^r9r9r:r=; scs\eZdZdZdZejZddd„Zdd„Z dd „Z ‡fd d „Z d d „Z dd„Z dd„Z‡ZS)Ú_UnpackaA 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]]: ... rvNcKs ||_dS)N)rv)r]rwrxr9r9r:ryN sz_Unpack.__init__cCs2t|ƒ}|jdkr&|tj|dƒdd�Stdƒ‚dS)Nz Unpack accepts only single type.T)rez$Unpack cannot be further subscripted)r{rvrLrqrC)r]rrrHr9r9r:rsQ s  z_Unpack.__getitem__cCs.tj|j||ƒ}||jkr|St|ƒ|dd�S)NT)re)rLr|rvr{)r]r}r~rr9r9r:r|Y s z_Unpack._eval_typecs.tƒjƒ}|jdk r*|djtj|jƒƒ7}|S)Nz[{}])r‚rprvrgrLrƒ)r]r„)r…r9r:rp_ s  z_Unpack.__repr__cCstt|ƒj|jfƒS)N)r†r{rarv)r]r9r9r:r‡e sz_Unpack.__hash__cCs,t|tƒstS|jdk r$|j|jkS||kS)N)rArnrˆrv)r]r‰r9r9r:rŠh s    z_Unpack.__eq__cCs|jj|ƒdS)N)rvrT)r]rUr9r9r:rTp sz_Unpack._get_type_vars)rv)N)rarbrcrdr5rLrVr…ryrsr|rpr‡rŠrTr‹r9r9)r…r:rn@ s   rncCs t|tƒS)N)rArn)r^r9r9r:r=u sc@sZeZdZdZejZdd„Zdd„Zdd„Z dd „Z d d „Z d d „Z dd„Z esVdd„ZdS)r aQType 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] ccs |jVdS)N)Ú __unpacked__)r]r9r9r:Ú__iter__¨ szTypeVarTuple.__iter__c CsX||_ytjdƒjjddƒ}Wnttfk r:d}YnX|dkrJ||_t||_ dS)NrzrarrK) raršr›rœrér�r rbrro)r]r�rOr9r9r:ry« s zTypeVarTuple.__init__cCs|jS)N)ra)r]r9r9r:rp¸ szTypeVarTuple.__repr__cCs tj|ƒS)N)rîr‡)r]r9r9r:r‡» szTypeVarTuple.__hash__cCs||kS)Nr9)r]r‰r9r9r:rо szTypeVarTuple.__eq__cCs|jS)N)ra)r]r9r9r:r-Á szTypeVarTuple.__reduce__cOsd|krtdƒ‚dS)Nrez&Cannot subclass special typing classes)rC)r]r©rxr9r9r:röÄ szTypeVarTuple.__init_subclass__cCs||kr|j|ƒdS)N)rW)r]rUr9r9r:rTÊ szTypeVarTuple._get_type_varsN)rarbrcrdrLrVr…rpryrpr‡rŠr-rörrTr9r9r9r:r y s* )Ú__objrcCstdt|ƒj›�tjd�|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. zRuntime type is )Úfile)Úprintr{raršÚstderr)rqr9r9r:r'Ò s)Ú__argrcCs tdƒ‚dS)a1Assert 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. zExpected code to be unreachableN)r·)rur9r9r:ré s)Ú eq_defaultÚ order_defaultÚkw_only_defaultÚfield_descriptors.)rvrwrxryrcs‡‡‡‡fdd„}|S)aDecorator that marks a function, class, or metaclass as providing dataclass-like behavior. Example: from 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_descriptors`` 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. csˆˆˆˆdœ|_|S)N)rvrwrxry)Z__dataclass_transform__)Z cls_or_fn)rvryrxrwr9r:Ú decoratorH s  z&dataclass_transform..decoratorr9)rvrwrxryrzr9)rvryrxrwr:r sE)rrr)rrK)rrS)N)rr)rr)rrŒ)rr)rrr)rrrm)NNF)rrK)rrS)rr)rrS)rr)rrS)rr)rr)rr)rr)rr)rrS)rr)rrS)rr)œr—r¦Úcollections.abcr&ršrZrNrLÚ version_inforr{rrÚ__all__rXr;rîrDrJrRr[rEr/Z_FinalTypingBaser\rVrfrgrhrirkrrr\rnrur r!r#r�r‘Z_overload_dummyr%r r–rrrrrr§ÚMutableSequencerrÚ_collections_abcr­r³rÀrrZ_aliasÚMutableMappingrÚDictrrrr$r*r-r¥rïrØrÛr&rÝrûrÞrørqr)r(rrrr"r r Ú__text_signature__rr6rarbrdr!r4r˜r"rr#rMr1r2r3r2r?Ú ImportErrorrOr+rCrrDrEr@rArFr rÐrUr÷rVrrWrXrYr,rZr[r rbr rcr.rdr0r1rerfrhrirjrkrlrr=rmrnr r'rrrLrár_ZAnyr¸r9r9r9r:Ús¢              3     .      &         !B(     ,>    , '<h#        j ,    / * O +          %       3 V   6N