źhmTxddlZddlZddlZddlZddlZddlZejdddkZereZ nddlm Z m Z dZ dZ gdZ ere gdeed rejZn!Gd d ejd Zed ZejdZejdZejdZejdd Zejdd ZejZeedrejdddkrejZnWejdddkr#Gddejd ZeddZn!Gddejd Zed ZeedrejZndZd Zeed!rej Z nWejdddkr#Gd"d#ejd Z!e!d!d$Z n!Gd%d&ejd Z"e"d Z ej#Z#ej$Z$ej%Z%Gd'd(e Z&ej'Z'ej(Z(ej)Z)ej*Z*eed)rej+Z+n'Gd*d)ej,ej-ee&ej,+Z+ej.Z.eed,rej/Z/ndd-l0m1Z2Gd.d,ej3eZ/ej4Z4eed/rej5Z5n_dejddcxkrd0krnnej6ej5eefZ5n)Gd1d/ej5ej7eefe&ej5+Z5eed2rej8Z8n)Gd3d2ej8ej9ee:fe&ej8+Z8eed4rej;Z;n5eed4r)Gd5d4ej;ej7eefe&ej;+Z;eed6rej<ZZ>ej?Z?d8Z@gd9ZAd:ZBd;ZCeed<rejDZDnVer,dd=lmEZEd>ZFGd?d@ejGZHGdAd NoReturn: raise Exception('no way') This type is invalid in other positions, e.g., ``List[NoReturn]`` will fail in static type checkers. c td)Nz*NoReturn cannot be used with isinstance().rselfobjs r__instancecheck__z_NoReturn.__instancecheck__mHII Irc td)Nz*NoReturn cannot be used with issubclass().rErGrs r__subclasscheck__z_NoReturn.__subclasscheck__prJrN__name__ __module__ __qualname____doc__rrIrMrCrrrBrB_sK   J J J J J J J JrrBT_rootTKTVTT_co) covariantT_contra) contravariantr)rrceZdZdZdZdS) _FinalFormcd|jzSNztyping_extensions._namerGs r__repr__z_FinalForm.__repr__'$*4 4rchtj||jd}tj||fS)N accepts only single typetyping _type_checkrb _GenericAliasrGritems r __getitem__z_FinalForm.__getitem__s;%j)-&N&N&NPPD'tg66 6rNrOrPrQrdrnrCrrr^r^2 5 5 5 7 7 7 7 7rr^aWA 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.)doccFeZdZdZdZd dZdZdZfdZdZ d Z xZ S) _FinalaA special typing construct to indicate that a name cannot be re-assigned or overridden in a subclass. For example: MAX_SIZE: Final = 9000 MAX_SIZE += 1 # Error reported by type checker class Connection: TIMEOUT: Final[int] = 10 class FastConnector(Connection): TIMEOUT = 1 # Error reported by type checker There is no runtime checking of these properties. __type__Nc ||_dSNrtrGtpkwdss r__init__z_Final.__init__ DMMMrct|}|j0|tj||jddddSt |jddd)N accepts only single type.TrS cannot be further subscriptedtyperurirjrOrrGrmrs rrnz_Final.__getitem__st**C}$s6-d!l122.JJJLL!%''''s|ABB/OOOPP Prctj|j||}||jkr|St||dSNTrSri _eval_typerurrGglobalnslocalnsnew_tps rrz_Final._eval_typeE&t}hHHF&& 4::fD111 1rct}|j |dtj|jdz }|SN[]superrdruri _type_reprrGr __class__s rrdz_Final.__repr__H  ""A}(<*4=99<<<<HrcRtt|j|jfSrwhashrrOrurcs r__hash__z_Final.__hash__ d,dm<== =rcpt|tstS|j|j|jkS||uSrw) isinstancersNotImplementedrurGothers r__eq__z _Final.__eq__s;eV,, &%%}(}665= rrw rOrPrQrRrr{rnrrdrr __classcell__rs@rrsrss "      Q Q Q 2 2 2        > > > ! ! ! ! ! ! !rrsr1c|S)auThis 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. rC)fs rr1r1s (rc*tj|Srw)riTypeVarnames rr2r2s >$  rr3ceZdZdZdZdS) _LiteralFormcd|jzSr`rarcs rrdz_LiteralForm.__repr__rerc,tj||Srw)rirkrGrs rrnz_LiteralForm.__getitem__s'j99 9rNrorCrrrrs2 5 5 5 : : : : :rraoA 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.cFeZdZdZdZd dZdZdZfdZdZ d Z xZ S) _LiteralaA type that can be used to indicate to type checkers that the corresponding value has a value literally equivalent to the provided parameter. For example: var: Literal[4] = 4 The type checker understands that 'var' is literally equal to the value 4 and no other value. Literal[...] cannot be subclassed. There is no runtime checking verifying that the parameter is actually a value instead of a type.  __values__Nc ||_dSrwr)rGvaluesrzs rr{z_Literal.__init__! $DOOOrct|}|j%t|ts|f}||dSt |jddd)NTrSr~r)rrrtuplerrO)rGrrs rrnz_Literal.__getitem__$set**C&!&%00'$YFs6....s|ABB/OOOPP Prc|SrwrC)rGrrs rrz_Literal._eval_type,Krct}|j9|ddt t j|jdz }|S)Nr, r)rrdrjoinmaprirrs rrdz_Literal.__repr__/sV  ""A*N3v'8$/#J#JKKNNNNHrcRtt|j|jfSrw)rrrOrrcs rrz_Literal.__hash__5s d,do>?? ?rcpt|tstS|j|j|jkS||uSrw)rrrrrs rrz_Literal.__eq__8s<eX.. &%%*%*:::5= rrwrrs@rrrs $  % % % % Q Q Q          @ @ @ ! ! ! ! ! ! !rrceZdZfdZxZS)_ExtensionsGenericMetac|j2tjdjddvrt ddS|js!t |S|j|}|tur|S|j|j vrdS|j D]+}t|trt||rdS,dS)a*This mimics a more modern GenericMeta.__subclasscheck__() logic (that does not have problems with recursion) to work around interactions between collections, typing, and typing_extensions on older versions of Python, see https://github.com/python/typing/issues/501. Nr~rOabc functoolsCParameterized generics cannot be used with class or instance checksFT) __origin__sys _getframe f_globalsr __extra__rrM__subclasshook__r__mro____subclasses__rr issubclass)rGsubclassressclsrs rrMz(_ExtensionsGenericMeta.__subclasscheck__Ns ? &}Q)*5=QQQ!56665~ 777,,X66 6n--h77 n $ $J >X- - -4N1133  D$ ,, (D)) tt ur)rOrPrQrMrrs@rrrMs8rrr+ceZdZdZdZdS)r+rCc|jturtj|i|St jtj|g|Ri|Srw)_gorgr+ collectionsdequeri _generic_newrargsrzs r__new__z Deque.__new__wsKyE!!"($7$777&{'8#MMMMMM MrNrOrPrQrrrCrrr+r+rs/  N N N N Nr) metaclassextrar')_check_methodscNeZdZdZdZejdZedZ dS)r'rCc K|SrwrCrcs r __aenter__zAsyncContextManager.__aenter__s Krc KdSrwrC)rGexc_type exc_value tracebacks r __aexit__zAsyncContextManager.__aexit__s 4rcD|turt|ddStS)Nrr)r'_check_methods_in_mror)rCs rrz$AsyncContextManager.__subclasshook__s&))),Q kJJJ! !rN) rOrPrQrrrabstractmethodr classmethodrrCrrr'r'sb            " "  " " "rr-)rrr\ceZdZdZdZdS)r-rCc|jturtj|i|Stjtj|g|Ri|Srw)rr-rrirrs rrzOrderedDict.__new__sKyK''".====&{'>SdSSSdSS SrNrrCrrr-r-s/  T T T T Trr*ceZdZdZdZdS)r*rCc|jturtj|i|Stjtj|g|Ri|Srw)rr*rrirrs rrzCounter.__new__sKyG##"*D9D999&{':CO$OOO$OO OrNrrCrrr*r*s/  P P P P Prr(ceZdZdZdZdS)r(rCc|jturtj|i|Stjtj|g|Ri|Srw)rr(rrirrs rrzChainMap.__new__sKyH$$"+T:T:::&{';SP4PPP4PP PrNrrCrrr(r(s/  Q Q Q Q Qrr&ceZdZdZdS)r&rCN)rOrPrQrrCrrr&r&s rct|tsJt|dr|jS|j|j}|j|S)z@This function exists for compatibility with old typing versions.r)rrhasattrrrrs rrrsP c; ' ''' 'sGy . $n . $ Jr) Callabler"IterableIteratorr$r#HashableSized Container Collection Reversibler)r'cnt}|jddD]}|jdvr t|di}t |jt |zD]0}|ds|dvr||1|S)N)r6Generic__annotations___abc_)__abstractmethods__r __weakref__ _is_protocol_is_runtime_protocol__dict____args__r__next_in_mro__rr__orig_bases__r __tree_hash__rRrr{rrP_MutableMapping__markerr) setrrOgetattrlistr keys startswithadd)rattrsbase annotationsattrs r_get_protocol_attrsrs EEE CRC    =3 3 3 d$5r:: ++--..k6F6F6H6H1I1II DOOG,, >F2F2F $  LrcTtfdtDS)Nc3TK|]"}tt|dV#dSrw)callabler).0rrs r z,_is_callable_members_only..s7WWdxT40011WWWWWWr)allrrs`r_is_callable_members_onlyr!s0 WWWW>QRU>V>VWWW W WWrr6)_collect_type_varscLt|jrtddSNz Protocols cannot be instantiatedrrrrGrkwargss r_no_initr(/ :: " @>?? ? @ @rceZdZfdZxZS) _ProtocolMetactddrtrtjrdSjr+t fdt DrdStS)NrFTc3K|]E}t|o0tt|d pt|duVFdSrwrrr)rrrinstances rrz2_ProtocolMeta.__instancecheck__..sy== x..=$WS$%=%=>>><$//t;======r) rr!rrrr rrrI)rr/rs``rrIz_ProtocolMeta.__instancecheck__ sS.%88 *3// x1377 t =====$7s#;#;=====  477,,X66 6r)rOrPrQrIrrs@rr+r+ s8 7 7 7 7 7 7 7 7 7rr+cPeZdZdZdZdZfdZejdZ dZ xZ S)r6aBase 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: ... rCTcv|turtdt|S)NzIType Protocol cannot be instantiated; it can only be used as a base class)r6rrr)rrrzrs rrzProtocol.__new__>s=h!FGGG77??3'' 'rct|ts|f}|s&|tjurt d|jddtfd|D}|t urtd|Dsed}t||tjr%|dz }t||tj%t d|dzd ||tt|t|krt d nt||tj ||S) NParameter list to [...] cannot be empty*Parameters to generic types must be types.c3BK|]}tj|VdSrwrirjrpmsgs rrz-Protocol.__class_getitem__..Ls0FF!6-a55FFFFFFrc3JK|]}t|tjVdSrwrrirrr9s rrz-Protocol.__class_getitem__..O.IIQ:a88IIIIIIrrr~zBParameters to Protocol[...] must all be type variables. Parameter z is z.Parameters to Protocol[...] must all be unique) rrriTuplerrQr6r rrrrrk)rparamsir:s @r__class_getitem__zProtocol.__class_getitem__Dsfe,, #  Rc55P)9PPPRRR>CFFFFvFFFFFFhII&IIIII>A$VAY??Q%VAY??#=&'!e==17==>>>s6{{##s6{{22#HJJJ3 sF+++'V44 4rc x g}djvrtjjv}ntjjv}|rt ddjvrt j}d}jD]Z}t|tjr>|j tjtfvr$|j j }|t d|j }[||}nt|}t| | ksYd fd|D} dd|D} t d| d|d | d |}t|_ jd ds#t#d jD_fd } djvr| _jsdSjD]k}|t(tjfvsT|jdkr|j t,vs;t|t.r|jst dt1|lt2_dS)Nr !Cannot inherit from plain GenericzECannot inherit from Generic[...] and/or Protocol[...] multiple types.rc3>K|]}|vt|VdSrwstrrtgvarsets rrz-Protocol.__init_subclass__..~3*U*UaAWDTDT3q66DTDTDTDT*U*Urc34K|]}t|VdSrwrFrgs rrz-Protocol.__init_subclass__..(*A*Aa3q66*A*A*A*A*A*ArSome type variables () are not listed in rrrc3(K|] }|tuVdSrw)r6rbs rrz-Protocol.__init_subclass__..s&&L&LqH}&L&L&L&L&L&LrcjddstStdds7t jdjddvrtStdts7t jdjddvrtStdt|tstd tD]}|j D]r}||jvr|j| tccSnWt|d i}t|tjr"||vrt|tr |jrn stcSd S) Nrr Fr\rOrBInstance and class checks can only be used with @runtime protocols._proto_hooks|''==*))s$:EBB;}Q''1*=AUUU--#%:;;;055C}Q''1*=AUUU--#%BCCC!%..J#$HIII/44 . .D % . .4=00#}T2:'5 5 5 5 5 5!E&-d4Er&J&J &{FNCC" $ 3 3 *5- @ @!4 % 2!4"E----trrcollections.abc5Protocols can only inherit from other protocols, got )r rirr  __bases__rr"rrkrr6rOrrrrrYanyrrobjectrP_PROTO_WHITELISTr+reprr(r{) rrr'tvarserrorgvarsrthe_basetvarsets_varss_argsr\rJs ` @r__init_subclass__zProtocol.__init_subclass__^sE3<//#*<<#-7 E CDDD3<//*3+=>> . 4 4D"4)=>>4 O/III#'?#; ,"+!H#I#II!% 3=!EE!%jjG!%jjG"g--!%*U*U*U*U5*U*U*U!U!U!%*A*A5*A*A*A!A!A')O)O)O:B)O)OEK)O)O)OPPP!E!&uC <##ND99 M#&&L&Lcm&L&L&L#L#L      >"55'2$#   E E 888+<<< )999"477:<@.s.HHQ:a88HHHHHHrrDzACannot inherit from Generic[...] or Protocol[...] multiple times.rc3>K|]}|vt|VdSrwrFrHs rrz(_ProtocolMeta.__new__..rKrc34K|]}t|VdSrwrFrMs rrz(_ProtocolMeta.__new__..rOrc3<K|]}|jtjuVdSrw)rrirrSs rrz(_ProtocolMeta.__new__..sG4D4D8956LFN4R4D4D4D4D4D4Drrr6rPrQrrc3bK|]*}t|trt|n|V+dSrw)rrrrSs rrz(_ProtocolMeta.__new__..sO**'1K&@&@G%(((a******rc3\K|]'}t|to |tjuV(dSrw)rrrirrSs rrz(_ProtocolMeta.__new__..s8YYa:a--I!6>2IYYYYYYrc36K|]}|tju|VdSrw)rirrSs rrz(_ProtocolMeta.__new__..s.JJA!6>2I2Ia2I2I2I2IJJr)rrTrSrc3ZK|]&}|tjurdn|tjurdn|V'dS).rCN)ri_TypingEllipsis _TypingEmptyras rrz(_ProtocolMeta.__new__..sZ"3"3()*+f.D)D)D##()V-@(@(@"""#"3"3"3"3"3"3r _subs_tree)!r rrirrrrrr6rrrr`rrABCMetarupdaterr __setattr__rr rmr r  _abc_registry _abc_cacherrr}rr)rrbases namespacerdroriginr orig_basesrfrrhrirjcls_name initial_basesrGrJrs @rrz_ProtocolMeta.__new__s=== )))HH%HHHHHOO%OOHO"5))! 4 4Dv~--'(KLLL"4554 O/III ,"+!A#B#BB!% 3=!EE!%jjG!%jjG"g--!%*U*U*U*U5*U*U*U!U!U!%*A*A5*A*A*A!A!A034D4D=B4D4D4D1D1D$T99IS!')O)O)O:B)O)OEK)O)O)OPPP!E!M!d5kkS[&@&@&&5(**#(*****EYYSXYYYYY KJJJJJJJ   FGG H H Hc**223eY9=3??D +t $ $ 0 0=C2?16v @ @ @#(D 7;EE"3"3-1"3"3"3333@D M$0#5#5D !&3###%+%9""("3t\** KAG'Jd4??+<+<&=&=&=&+K&>&>&G&G&I&I"Krc\tj|i|jdds#t djD_jrjddD]}|ttj fvs|j dkr|j tvsht|tjr|jsGt|t r|jtj ust%dt'|t(_fd}djvr |_dSdS)Nrc3nK|]0}|tup"t|to |jtuV1dSrw)r6rr+rrSs rrz)_ProtocolMeta.__init__.. s_'?'?,-()H}(@'1!]'C'C(@'(|x'?'?'?'?'?'?'?rr~r]r^cjddstSt|tst dt D]}|jD]r}||jvr|j| tccSnWt|di}t|tj r"||vrt|tr |j rn stcSdS)NrrXrT) r rYrrrrrrrrirZr+rr[s rr\z+_ProtocolMeta.__init__.._proto_hooks|''==*))!%..J#$HIII/44 . .D % . .4=00#}T2:'5 5 5 5 5 5!E&-d4Er&J&J &{FNCC" $ 3 3 *5- @ @!4 % 2!4"E----trr)rr{r rYr`r_rrrarirrPrOrbr TypingMetarrrrcr(r)rrr'rr\rs` rr{z_ProtocolMeta.__init__s} EGG d -f - - -<##ND99 ?#&'?'?14 '?'?'?$?$?  (KOIID VV^$<<< O/@@@ M-===&tV->??>DHDU>&t[99>!Ov~==')H;?::)H)HIII (      *"55'2$$$65rc*tddrtrtjrdSjr+t fdt DrdStt S)NrFTc3K|]E}t|o0tt|d pt|duVFdSrwr.)rrr/rGs rrz2_ProtocolMeta.__instancecheck__..;sy??!x..>%gdD$&?&?@@@= 400<??????r) rr!rrrr rrrrI)rGr/rs``rrIz_ProtocolMeta.__instancecheck__3sT>599 -d33 x1488 t  ?????%8$=$=?????  4d++==hGG Grc|j2tjdjddvrt ddS|jddrM|jdds2tjdjddvrdSt d |jddrgt|sXtjdjddvr(tt| |St d tt| |S) Nr~rOrrFrr rrrirVrW) rrrrrr rYr!rrrM)rGrrs rrMz_ProtocolMeta.__subclasscheck__Bsf*=##-j9AUUU#%9:::u !!.$77 7 ))*@$GG 7=##-j9>HHH!5!6777 !!"8$?? ?1$77 ?=##-j9>HHH!d33EEcJJJ!>???d++==cBB Brc t|ts|f}|s3t|tjurt d|jddtfd|D}|tjtfvrtd|Ds t dt|dtt|t|kr t dt|d|}|}n|tjtj fvrt|}|}nZ|jtjtfvrt d t|t!||t|}|}|j|fnd }||j||jzt)|j||||j|j S) Nr3r4r5c38K|]}t|VdSrw)rjr8s rrz,_ProtocolMeta.__getitem__..ds-??1;q#..??????rc3JK|]}t|tjVdSrwr<r=s rrz,_ProtocolMeta.__getitem__..fr>rzParameters to z [...] must all be type variablesz[...] must all be uniquez%Cannot subscript already-subscripted rC)rdrrrr)rrrrir?rrQrr6r rcrrrrrrrrOr_rr rr )rGr@rdrprependr:s @rrnz_ProtocolMeta.__getitem__Zsfe,, #  SeDkk==Q):QQQSSS>C?????????F111II&IIIIIW#UdUUUWWWs6{{##s6{{22#MdMMMOOO&,888"6**V^X$>>> TT T TUUUtV,,,"6**!%!8tggbG>>$-")DN":"0"?"?(-'+)-(,-1-@"BB Br)NNNNN) rOrPrQrRrr{rIrMrirlrnrrs@rr+r+s  PT> > > > > > @* 3* 3* 3* 3* 3X H H H H H C C C C C0  % B% B  % B% B% B% B% Brc eZdZdZdZdZdZdS)r6aBase 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: ... rCTct|turtdtj|j|g|Ri|S)NzIType Protocol cannot be instantiated; it can be used only as a base class)rr6rrirr rs rrzProtocol.__new__sTSzzX%%!FGGG&s':CO$OOO$OO OrN)rOrPrQrRrrrrCrrr6r6s>  8   P P P P Prr8cpt|tr|jstd|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)rr+rrr rs rr8r8sQ#}-- -S5E -,$',,-- -#'  rr/c8eZdZdZejdefdZdS)r/rCreturncdSrwrCrcs r __index__zSupportsIndex.__index__s DrN)rOrPrQrrrintrrCrrr/r/sB  s        r)r r\c tjdjddvrtdn#tt f$rYnwxYwdS)Nr~rOrz4TypedDict does not support instance and class checksF)rrrrAttributeError ValueError)rrs r _check_failsrsq }Q)*5>HHH VWWW H  +    D us03AAc`|std|d|dd}}t|i|S)N)TypedDict.__new__(): not enough argumentsrr~)rr )rr'_s r _dict_newrsB IGHH Hq'484T$V$$$rz,($cls, _typename, _fields=None, /, **kwargs)totalc|std|d|dd}}|r|d|dd}}nJd|vr7|d}ddl}|dtdntd|r7 |\}n#t $r$td t |dzd wxYwd |vrJt |dkr7|d }ddl}|d tdnd}||}n|rtd dt|i} tj dj dd|d<n#tt f$rYnwxYwt|d||S)Nrrr~ _typenamez5Passing '_typename' as keyword argument is deprecatedr\) stacklevelzGTypedDict.__new__() missing 1 required positional argument: '_typename'z?TypedDict.__new__() takes from 2 to 3 positional arguments but z were given_fieldsz3Passing '_fields' as keyword argument is deprecatedz@TypedDict takes either a dict or keyword arguments, but not bothrrO__main__rPrCr)rr warningswarnDeprecationWarningrrr rrrrYr_TypedDictMeta)rrr'rtypenamerfieldsnss r_typeddict_newrs( IGHH Hq'484  5!!Wd122hdHH F " "zz+..H OOO MMQ,  < < < <455 5   . . . .!-FF  -,-- - f . "}Q//9==j*UUB|   +    D hBe<<<z*_TypedDictMeta.__new__..*s9381b6%b#..r__required_keys__rC__optional_keys__ __total__)rrrrr rYrritemsrr r frozensetrrrr)rrrrrtp_dictrown_annotationsown_annotation_keys required_keys optional_keysrr:rs @rrz_TypedDictMeta.__new__s/3k.A.ANNyByMggooc4$"==GK ff%6;;O"%o&:&:&<&<"="= SC?? ?rcdtj|jddd|jDdS)Nztyping_extensions.Annotated[rc34K|]}t|VdSrwrcr{s rrz+_AnnotatedAlias.__repr__..s( D DQa D D D D D Drr)rirrrrrcs rrdz_AnnotatedAlias.__repr__s\H63DT_3U3UHHyy D D$2C D D DDDHHH IrcHtjt|jf|jzffSrw)operatorgetitemr0rrrcs r __reduce__z_AnnotatedAlias.__reduce__s)#DO-0AA& rc~t|tstS|j|jkrdS|j|jkS)NF)rrrrrrs rrz_AnnotatedAlias.__eq__s@e_55 &%%%"222u$(:: :rc8t|j|jfSrw)rrrrcs rrz_AnnotatedAlias.__hash__s$*;<== =r) rOrPrQrRr{rrdrrrrrs@rrrns   ) ) ) ) ) @ @ @  I I I     ; ; ; > > > > > > >rrcBeZdZdZdZdZejdZdZ dS)r0aAdd 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()] rCc td)Nz&Type Annotated cannot be instantiated.rErrr's rrzAnnotated.__new__sDEE Erct|trt|dkrtdd}t j|d|}t|dd}t ||S)Nr\zUAnnotated[...] should be used with at least two arguments (a type and an annotation).$Annotated[t, ...]: t must be a type.rr~)rrrrrirjr)rr@r:rrs rrBzAnnotated.__class_getitem__s{fe,, 0F a!/0009C'q 377FVABBZ((H"6844 4rc2td|jd)NCannot subclass z .Annotated)rrPrs rrkzAnnotated.__init_subclass__s$=3>=== rN) rOrPrQrRrrrirlrBrkrCrrr0r0sf  @  F F F   5 5   5     rc(t|trt|jSt|tjrNt d|jD}||jkr|S||}|j |_ |S|S)z2Strips the annotations from a given type. c34K|]}t|VdSrw_strip_annotationsr{s rrz%_strip_annotations..s+!L!LA"4Q"7"7!L!L!L!L!L!Lr) rrrrrirkrr r_special)rI stripped_argsrs rrrs a ) ) 4%al33 3 a- . . !!L!L!L!L!LLLM **++m,,C:CLJrFcttj|||}|r|Sd|DS)a]Return type hints for an object. This is often the same as obj.__annotations__, but it handles forward references encoded as string literals, adds Optional[t] if a default value equal to None is set and recursively replaces all 'Annotated[T, ...]' with 'T' (unless 'include_extras=True'). The argument may be a module, class, method, or function. The annotations are returned as a dictionary. For classes, annotations include also inherited members. TypeError is raised if the argument is not of a type that can contain annotations, and an empty dictionary is returned if no annotations are present. BEWARE -- the behavior of globalns and localns is counterintuitive (unless you are familiar with how eval() and exec() work). The search order is locals first, then globals. - If no dict arguments are passed, an attempt is made to use the globals from obj (or the respective module's globals for classes), and these are also used as the locals. If the object does not appear to have globals, an empty dictionary is used. - If one dict argument is passed, it is used for both globals and locals. - If two dict arguments are passed, they specify globals and locals, respectively. )rrc4i|]\}}|t|SrCr)rkrIs rrz"get_type_hints..s'BBBTQ%a((BBBr)rir?r)rHrrinclude_extrashints rr?r?sD>$S8WMMM  KBBTZZ\\BBBBrc|t|dko)|do|dS)z3Returns True if name is a __dunder_variable_name__.__)rrendswithrs r _is_dunderrs44yy1}N!6!6N4==;N;NNrceZdZdZfdZedZdZdfd ZdZ e j fdZ d Z d Zfd Zd Zd ZxZS) AnnotatedMetazMetaclass for Annotatedc td|Dr$tdttzt j||||fi|S)Nc3(K|] }|tuVdSrw)rarSs rrz(AnnotatedMeta.__new__.. s&22q1F?222222rr)r`rrGr0rr)rrrrr'rs rrzAnnotatedMeta.__new__ sa22E22222 E 2S^^ CDDD"577?3eYII&II Irc6|dS)Nr\)r}rcs rrzAnnotatedMeta.__metadata__s??$$Q' 'rc|\}}}t|tstj|}n|d|}dd|D}|d|d|dS)Nrrc34K|]}t|VdSrwr)rargs rrz+AnnotatedMeta._tree_repr..s(&E&EStCyy&E&E&E&E&E&Errr)rrrir _tree_reprr)rGtreerrrtp_reprmetadata_reprss rrzAnnotatedMeta._tree_reprs$( !Cfe,, 7 +F33 )..v66!YY&E&EH&E&E&EEEN88G88~888 8rNc,|turtSt||}t|dtrD|ddtur/|dd}|dd}t|||dzfS|S)N)rdrr~rr\)r0rr}rr)rGrdrrsub_tp sub_annotrs rr}zAnnotatedMeta._subs_treesy    ''$$5t$<>Jrc4|jtd|}t|tr;|dt ur,|d}t|tr|dt u,t|tr|dS|S)z6Return the class used to create instance of this type.NzCCannot get the underlying type of a non-specialized Annotated type.rr~)rrr}rrr0)rGrs r _get_conszAnnotatedMeta._get_cons's&!BCCC??$$DT5)) d1g.B.BAwT5)) d1g.B.B$&& Aw rct|ts|f}|j!t|St|trt |dkrt dd}tj|d|}t|dd}| |j |j t|j t|f||f|S)Nr\z]Annotated[...] should be instantiated with at least two arguments (a type and an annotation).rrr~)rdrr)rrrrrnrrrirjrrOr_rr r)rGr@r:ryrrs rrnzAnnotatedMeta.__getitem__4sfe,, # *ww**6222.. -#f++//!/000='q 377 ,,>> t}-- "''(^" rcp|}||i|} ||_n#t$rYnwxYw|Srw)r__orig_class__r)rGrr'consresults r__call__zAnnotatedMeta.__call__LsZ>>##DT4*6**F (,%%!    Ms & 33c|j1t|s"t||St |rw)rrrrr)rGrs r __getattr__zAnnotatedMeta.__getattr__Us?*:d3C3C*t~~//666 && &rc t|s|dr$t||dS|jt |t |||dS)Nr)rrrrrrsetattrr)rGrvaluers rrzAnnotatedMeta.__setattr__[s~$ 74??7#;#; 7##D%00000($T***(($66666rc td)Nz+Annotated cannot be used with isinstance().rErFs rrIzAnnotatedMeta.__instancecheck__cIJJ Jrc td)Nz+Annotated cannot be used with issubclass().rErLs rrMzAnnotatedMeta.__subclasscheck__fr r)NN)rOrPrQrRrpropertyrrr}rrirlrnrrrrIrMrrs@rrrs"%% J J J J J  ( (  ( 9 9 9                  .    ' ' '  7 7 7 7 7 K K K K K K K K K KrrceZdZdZdS)r0avAdd 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()] NrOrPrQrRrCrrr0r0is    r)r )_BaseGenericAlias) GenericAliasct|trtSt|tjt t ttfr|j S|tj ur 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) rrr0rirkrr ParamSpecArgsParamSpecKwargsrr)rys rr>r>sf b/ * *   b6/?P(/; < < !=   > !trcft|tr|jf|jzSt|tjt frjt|ddrdS|j}t|tj j ur.|dturt|dd|df}|SdS)aGet 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) rFrCrNr)rrrrrirkrrr r>rrrEllipsisr)ryrs rr=r=s b/ * * 6M#bo5 5 b6/> ? ? r:u-- r+C"~~!999c!fH>T>TCH~~s2w/Jrrr:)rrceZdZdZdS)_TypeAliasFormcd|jzSr`rarcs rrdz_TypeAliasForm.__repr__rerNrOrPrQrdrCrrrr# 5 5 5 5 5rrc&t|d)&Special marker indicating that an assignment should be recognized as a proper type alias definition by type checkers. For example:: Predicate: TypeAlias = Callable[..., bool] It's invalid when used anywhere except as in the example above.  is not subscriptablerErs rr:r:s4666777rceZdZdZdS)rcd|jzSr`rarcs rrdz_TypeAliasForm.__repr__rerNrrCrrrrrraSpecial 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.ceZdZdZdZdS)_TypeAliasMetazMetaclass for TypeAliascdSNztyping_extensions.TypeAliasrCrcs rrdz_TypeAliasMeta.__repr__00rNrOrPrQrRrdrCrrr"r"s)%% 1 1 1 1 1rr"c(eZdZdZdZdZdZdZdS)_TypeAliasBaserrCc td)Nz+TypeAlias cannot be used with isinstance().rErFs rrIz _TypeAliasBase.__instancecheck__r rc td)Nz+TypeAlias cannot be used with issubclass().rErLs rrMz _TypeAliasBase.__subclasscheck__ r rcdSr$rCrcs rrdz_TypeAliasBase.__repr__ r%rN)rOrPrQrRrrIrMrdrCrrr(r(sX   K K K K K K 1 1 1 1 1rr()rrTrc"eZdZdZdZdZdZdS) _Immutablez3Mixin to indicate that object should not be copied.rCc|SrwrCrcs r__copy__z_Immutable.__copy__rrc|SrwrC)rGmemos r __deepcopy__z_Immutable.__deepcopy__ rrN)rOrPrQrRrr/r2rCrrr-r-s=AA         rr-ceZdZdZdZdZdS)raQThe args for a ParamSpec object. Given a ParamSpec object P, P.args is an instance of ParamSpecArgs. ParamSpecArgs objects have a reference back to their ParamSpec: P.args.__origin__ is P This type is meant for runtime introspection and has no special meaning to static type checkers. c||_dSrwrrGrs rr{zParamSpecArgs.__init__/rrc |jjdS)Nz.argsrrOrcs rrdzParamSpecArgs.__repr__2so.555 5rNrOrPrQrRr{rdrCrrrr#s<  % % % 6 6 6 6 6rceZdZdZdZdZdS)ra[The kwargs for a ParamSpec object. Given a ParamSpec object P, P.kwargs is an instance of ParamSpecKwargs. ParamSpecKwargs objects have a reference back to their ParamSpec: P.kwargs.__origin__ is P This type is meant for runtime introspection and has no special meaning to static type checkers. c||_dSrwr5r6s rr{zParamSpecKwargs.__init__Arrc |jjdS)Nz.kwargsr8rcs rrdzParamSpecKwargs.__repr__Dso.777 7rNr9rCrrrr5s<  % % % 8 8 8 8 8rrrceZdZdZejZedZedZ ddddfd Z dZ d Z d Z d Zd Zesd ZxZSxZS)ra'Parameter specification variable. Usage:: P = ParamSpec('P') Parameter specification variables exist primarily for the benefit of static type checkers. They are used to forward the parameter types of one callable to another callable, a pattern commonly found in higher order functions and decorators. They are only valid when used in ``Concatenate``, or s the first argument to ``Callable``. In Python 3.10 and higher, they are also supported in user-defined Generics at runtime. See class Generic for more information on generic types. An example for annotating a decorator:: T = TypeVar('T') P = ParamSpec('P') def add_logging(f: Callable[P, T]) -> Callable[P, T]: '''A type-safe decorator to add logging to a function.''' def inner(*args: P.args, **kwargs: P.kwargs) -> T: logging.info(f'{f.__name__} was called') return f(*args, **kwargs) return inner @add_logging def add_two(x: float, y: float) -> float: '''Add two numbers together.''' return x + y Parameter specification variables defined with covariant=True or contravariant=True can be used to declare covariant or contravariant generic types. These keyword arguments are valid, but their actual semantics are yet to be decided. See PEP 612 for details. Parameter specification variables can be introspected. e.g.: P.__name__ == 'T' P.__bound__ == None P.__covariant__ == False P.__contravariant__ == False Note that only parameter specification variables defined in global scope can be pickled. c t|Srw)rrcs rrzParamSpec.argss && &rc t|Srw)rrcs rr'zParamSpec.kwargss"4(( (rNF)boundrYr[ct|g||_t||_t||_|rt j|d|_nd|_ tj dj dd}n#ttf$rd}YnwxYw|dkr ||_dSdS)NzBound must be a type.r~rOrtyping_extensions)rr{rObool __covariant____contravariant__rirj __bound__rrrrYrrrP)rGrr@rYr[def_modrs rr{zParamSpec.__init__s GG  dV $ $ $ DM!%iD %)-%8%8D " &!'!3E;R!S!S!% -**488ZPP"J/    ---").-s8-B&&B<;B<cB|jrd}n |jrd}nd}||jzS)N+-~)rDrErO)rGprefixs rrdzParamSpec.__repr__s8! ' DM) )rc6t|Srw)rarrcs rrzParamSpec.__hash__s??4(( (rc ||uSrwrCrs rrzParamSpec.__eq__s 5= rc|jSrw)rOrcs rrzParamSpec.__reduce__s = rcdSrwrCr&s rrzParamSpec.__call__ Drc<||vr||dSdSrw)appendrGrds r_get_type_varszParamSpec._get_type_varss-u$$LL&&&&&%$r)rOrPrQrRrirrr rr'r{rdrrrrPEP_560rUrrs@rrrNs , , ^N  ' '  '  ) )  )+/%u * * * * * * *$ * * * ) ) ) ! ! ! ! ! !    ' ' ' ' ' ' ' ' ' ' ' 'rrceZdZerejZnejZdZej Z fdZ dZ dZ dZedZesdZxZSxZS)_ConcatenateGenericAliasFcft|||_||_dSrw)rr{rr )rGrrrs rr{z!_ConcatenateGenericAlias.__init__s- GG  T " " "$DO DMMMrctj|jddfd|jDdS)Nrrc3.K|]}|VdSrwrC)rrrs rrz4_ConcatenateGenericAlias.__repr__..s+!K!Kc**S//!K!K!K!K!K!Krr)rirrrr )rGrs @rrdz!_ConcatenateGenericAlias.__repr__sd*J!z$/22OO !K!K!K!KT]!K!K!KKKOOO Prc8t|j|jfSrw)rrr rcs rrz!_ConcatenateGenericAlias.__hash__s$-899 9rcdSrwrCr&s rrz!_ConcatenateGenericAlias.__call__rQrc>td|jDS)Nc3\K|]'}t|tjtf#|V(dSrw)rrirr)rrys rrz:_ConcatenateGenericAlias.__parameters__..sLjfni=X.Y.Yr)rr rcs rrz'_ConcatenateGenericAlias.__parameters__s2!] rc^|jr#|jrtj|j|dSdSdSrw)rrrirUrTs rrUz'_ConcatenateGenericAlias._get_type_varssL?Ft':F)$*=uEEEEEFFFFr)rOrPrQrVrirkr _TypingBaserrrr{rdrrr rrUrrs@rrXrXs  +,II*I ! ! ! ! !  P P P  : : :          F F F F F F F F F F F FrrXc |dkrtdt|ts|f}t|dtstddtfd|D}t ||S)NrCz&Cannot take a Concatenate of no types.rzAThe last parameter to Concatenate should be a ParamSpec variable.z/Concatenate[arg, ...]: each arg must be a type.c3BK|]}tj|VdSrwr7r8s rrz'_concatenate_getitem..s0FFav)!S11FFFFFFr)rrrrrX)rGrr:s @r_concatenate_getitemrdsR@AAA j% ( (# ] jni 0 0/.// / ;CFFFF:FFFFFJ #D* 5 55rc"t||S)&Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a higher order function which adds, removes or transforms parameters of a callable. For example:: Callable[Concatenate[int, P], int] See PEP 612 for detailed information. rdrs rrrs$D*555rceZdZdZdZdS)_ConcatenateFormcd|jzSr`rarcs rrdz_ConcatenateForm.__repr__ rerc"t||Srwrgrs rrnz_ConcatenateForm.__getitem__ 'j99 9rNrorCrrriri s2 5 5 5 : : : : :rrirfceZdZdZdZdS)_ConcatenateAliasMetazMetaclass for Concatenate.cdSNztyping_extensions.ConcatenaterCrcs rrdz_ConcatenateAliasMeta.__repr__!22rNr&rCrrrnrns)(( 3 3 3 3 3rrnc.eZdZdZdZdZdZdZdZdS)_ConcatenateAliasBaserfrCc td)Nz-Concatenate cannot be used with isinstance().rErFs rrIz'_ConcatenateAliasBase.__instancecheck__3KLL Lrc td)Nz-Concatenate cannot be used with issubclass().rErLs rrMz'_ConcatenateAliasBase.__subclasscheck__6rurcdSrprCrcs rrdz_ConcatenateAliasBase.__repr__9rqrc"t||Srwrgrs rrnz!_ConcatenateAliasBase.__getitem__<rlrN) rOrPrQrRrrIrMrdrnrCrrrsrs$sg   M M M M M M 3 3 3 : : : : :rrsr;ceZdZdZdS)_TypeGuardFormcd|jzSr`rarcs rrdz_TypeGuardForm.__repr__GrerNrrCrrrzrzFrrrzc^tj||d}tj||fS) Special typing form used to annotate the return type of a user-defined type guard function. ``TypeGuard`` only accepts a single type argument. At runtime, functions marked this way should return a boolean. ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static type checkers to determine a more precise type of an expression within a program's code flow. Usually type narrowing is done by analyzing conditional code flow and applying the narrowing to a block of code. The conditional expression here is sometimes referred to as a "type guard". Sometimes it would be convenient to use a user-defined boolean function as a type guard. Such a function should use ``TypeGuard[...]`` as its return type to alert static type checkers to this intention. Using ``-> TypeGuard`` tells the static type checker that for a given function: 1. The return value is a boolean. 2. If the return value is ``True``, the type of its argument is the type inside ``TypeGuard``. For example:: def is_str(val: Union[str, float]): # "isinstance" type guard if isinstance(val, str): # Type of ``val`` is narrowed to ``str`` ... else: # Else, type of ``val`` is narrowed to ``float``. ... Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower form of ``TypeA`` (it can even be a wider form) and this may lead to type-unsafe results. The main reason is to allow for things like narrowing ``List[object]`` to ``List[str]`` even though the latter is not a subtype of the former, since ``List`` is invariant. The responsibility of writing type-safe type guards is left to the user. ``TypeGuard`` also works with type variables. For more information, see PEP 647 (User-Defined Type Guards). r)rirjrkrls rr;r;Js5X!*.Q.Q.QRR#D4'222rceZdZdZdZdS)rzcd|jzSr`rarcs rrdz_TypeGuardForm.__repr__|rerchtj||jd}tj||fS)Nz accepts only a single typerhrls rrnz_TypeGuardForm.__getitem__s;%j)-&P&P&PRRD'tg66 6rNrorCrrrzrzzrprr}cFeZdZdZdZd dZdZdZfdZdZ d Z xZ S) _TypeGuardr}rtNc ||_dSrwrtrxs rr{z_TypeGuard.__init__r|rct|}|j0|tj||jddddSt |jddd)Nr~z accepts only a single type.TrSrrrs rrnz_TypeGuard.__getitem__st**C}$s6-d!l122.LLLNN!%''''s|ABB/OOOPP Prctj|j||}||jkr|St||dSrrrs rrz_TypeGuard._eval_typerrct}|j |dtj|jdz }|Srrrs rrdz_TypeGuard.__repr__rrcRtt|j|jfSrwrrcs rrz_TypeGuard.__hash__rrcpt|tstS|j|j|jkS||uSrw)rrrrurs rrz_TypeGuard.__eq__s;eZ00 &%%}(}665= rrwrrs@rrrs) ) V"      Q Q Q 2 2 2        > > > ! ! ! ! ! ! !rrr cneZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z ejd Zd S) _SpecialForm)rbrR_getitemcD||_|j|_|j|_dSrw)rrOrbrR)rGrs rr{z_SpecialForm.__init__ s #DM )DJ"?DLLLrc6|dvr|jSt|)N>rOrQ)rbr)rGrms rrz_SpecialForm.__getattr__s$333z! && &rc&td|)NrrE)rGrs r__mro_entries__z_SpecialForm.__mro_entries__s7t7788 8rcd|jSr`rarcs rrdz_SpecialForm.__repr__s4 44 4rc|jSrwrarcs rrz_SpecialForm.__reduce__s : rc&td|)NzCannot instantiate rE)rGrrzs rrz_SpecialForm.__call__s:$::;; ;rc*tj||fSrwriUnionrs r__or__z_SpecialForm.__or__!s<e , ,rc*tj||fSrwrrs r__ror__z_SpecialForm.__ror__$s<t , ,rc&t|d)Nz! cannot be used with isinstance()rErFs rrIz_SpecialForm.__instancecheck__'tFFFGG Grc&t|d)Nz! cannot be used with issubclass()rErLs rrMz_SpecialForm.__subclasscheck__*rrc.|||Srw)rrs rrnz_SpecialForm.__getitem__-s==z22 2rN)rOrPrQrr{rrrdrrrrrIrMrirlrnrCrrrrs4  + + +  ' ' '  9 9 9 5 5 5    < < < - - - - - - H H H H H H   3 3   3 3 3rrc&t|d)Used to spell the type of "self" in classes. Example:: from typing import Self class ReturnsSelf: def parse(self, data: bytes) -> Self: ... return self rrE)rGr@s rr r 1s4666777rc"eZdZdZdZdZdZdS)_SelfrrCc&t|d)Nz" cannot be used with isinstance().rErFs rrIz_Self.__instancecheck__RtGGGHH Hrc&t|d)Nz" cannot be used with issubclass().rErLs rrMz_Self.__subclasscheck__UrrNrNrCrrrrBsK   I I I I I I I IrrRequiredceZdZdZdS)_ExtensionsSpecialFormcd|jzSr`rarcs rrdz_ExtensionsSpecialForm.__repr__`rerNrrCrrrr_rrrchtj||jd}tj||fS)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. rgrhrls rrrcs6"!*.V.V.VWW#D4'222rchtj||jd}tj||fS)`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, ) rgrhrls r NotRequiredrws6!*.V.V.VWW#D4'222rceZdZdZdZdS) _RequiredFormcd|jzSr`rarcs rrdz_RequiredForm.__repr__rerctj|d|j}tj||fS)Nz{} accepts only single type)rirjformatrbrkrls rrnz_RequiredForm.__getitem__s@%j&C&J&J4:&V&VXXD'tg66 6rNrorCrrrrs2 5 5 5 7 7 7 7 7rrrrrcBeZdZdZd dZdZdZfdZdZdZ xZ S) _MaybeRequiredrtNc ||_dSrwrtrxs rr{z_MaybeRequired.__init__r|rc  t|}|j@|tj|d|jdddSt d|jdd)Nz{} accepts only single type.r~TrSz {} cannot be further subscripted)rrurirjrrOrrs rrnz_MaybeRequired.__getitem__st**C}$s6-d9@@abbAQRRTT!%''''>#VCL$45577 7rctj|j||}||jkr|St||dSrrrs rrz_MaybeRequired._eval_typerrct}|j/|dt j|jz }|S)Nz[{}])rrdrurrirrs rrdz_MaybeRequired.__repr__sH  ""A}(V]]6#4T]#C#CDDDHrcRtt|j|jfSrwrrcs rrz_MaybeRequired.__hash__rrct|t|stS|j|j|jkS||uSrw)rrrrurs rrz_MaybeRequired.__eq__sAeT$ZZ00 &%%}(}665= rrw) rOrPrQrr{rnrrdrrrrs@rrrs!      7 7 7 2 2 2        > > > ! ! ! ! ! ! !rrceZdZdZdS) _RequiredrNrrCrrrrs    rrceZdZdZdS) _NotRequiredrNrrCrrrrs rr)NNF)rrcollections.abcrrri version_inforVrrrrr__all__extendrr@_FinalTypingBaserBrrUrVrWrXrZrrrr^rsr1r2r3rr_overload_dummyr5r!rr"r%r$r#r+rMutableSequencer)r'_collections_abcrrrr,r-_aliasMutableMappingr*Dictrr(r&r4r9r<rrbrr!r6r"r(r~r+rmrjr8r7r/r.rr__text_signature__rrr rOrPrRr0r?rrkrrrr>r=r ImportErrorrr:rrr"r(rrr-rrrXrlrdrrirnrsr;rzrr rrrrrrrrrCrrrs   2A2 ) + /KK/....... <<<+ + + Z A NN???@@@ 76:%HHJJJJJF+4JJJJ(yt$$$HFN3V^DV^Dv~f--- 6>*D 9 9 9 ? 767Q 0! 4 > > LEEbqbV##77777V(7777 Jw L M M MEE 1!1!1!1!1!(1!1!1!1!f F   E 767 LEE.    769I#nGGbqbV##:::::v*$::::l9 1 2 2 2GG,!,!,!,!,!6*$,!,!,!,!\hT"""G( ?{ [6     $ $  767 N LEENNNNN !6#9!#<0!'NNNN& 76())" 4IHHHHH"""""fnT2"""   76=!!T$KK#"2A2&222222222&- 7"bBBKK T T T T Tk-v/DRV/L 6'3 T T T T 769 PnGG P P P P P+%+af%2+:M P P P P 76: QHH W[*%% Q Q Q Q Q Q;')>r2v)F3$- Q Q Q Q 76#$$*NNt,fnT8^.L#9*= . {$ === &XXX  76:gPHH dP))))))@@@77777 777$]$]$]$]$]$]]$]$]$]$]$@10000000@@@BBBBB BBBB$P$P$P$P$P]$P$P$P$PP 76&''0     76?## (MMy   II   %%% $RI $(*=*=*=*=*=X*HN%*=*=*=*=*=*=*=*=X{TGR88I#I @ 76;a  I*N,OO Z %>%>%>%>%>&.d%>%>%>%>N44444444l   "C"C"C"C"CLOOO`K`K`K`K`K*`K`K`KD     m    FBQB7"""JHH 81,,,,,,, 111"01,''''''' ,,,+ ,00 76;D+ IIbqbV##55555,D5555 8 8^ 8 8 bqbV##55555,D5555{ $) * * *II11111*111 111110NRV1111,T***I 76?##18(M,OO66666 666$88888*888& 76;l' II f'f'f'f'f'Df'f'f'Twv}%%*F(F(F(F(F(F4(F(F(FX 6 6 6 76=!!J4$K%>bqbV## 6 6^ 6 6 bqbV##:::::6.d::::#"     KK33333 1333 ::::: 7*?&*::::6('d333K 76;' IIbqbV##55555,D5555,3,3^,3,3\ bqbV##77777,D7777) + + + II\M!M!M!M!M!V,DM!M!M!M!^ &&&I 766U ;DDbqbV##(3(3(3(3(3v}D(3(3(3(3T88\88 IIIII'tIIII, 5t   D 76:]+H$KKKbqbV##55555!4D5555333&33333  bqbV##77777+47777}    H" -     KKK #!#!#!#!#!0#!#!#!#!J     N$    "      ~T     yt$$$H,T***KKKs$$V++ V:9V:>W WW