ghfddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddlZddlZe jdkrddlZgdZdZeZe jdkZdejjvZGddZeZe jd krd Znd ZejZejd Zejd Z ejdZ!ejddZ"ejddZ#e jdkrddlm$Z$nGddeZ%Gdde%Z$ej&Z&Gddej'dZ(Gddej(dZ)ej*Z*e jdkrej+Z+ndZ+d Z,e jd!krej-Z-n7d"Z.d#Z/Gd$d%ej0dZ1Gd&d'e)dZ2e2d()Z-ej3Z3e4ed*rej5Z5ej6Z6ej7Z7n-ej8ej9ej8e:Z;d+Z5d,Z6d-Z7ej<ZZ>ej?Z?ej@Z@ejAZAejBZBejCZCejDZDejEZEejFZFejGZGe jdkr dd.lmHZHmIZImJZJmKZKnd/ZLGd0d1ejMdZMedZNeMejjKd2eNeNf3ZKeMejjId4eNf3ZIeMejOd4d5ejPeQf6ZJeMejRd4d7ejPeQf6ZHgd8d9d:gd;gd<ZSeTejUhd=zZVd>ZWddAZXe jdBkrejYZYnGd dCZZdDZ[dEZ\GdFdGeejYZ]e^dHZ_GdIdJej`e]ZYe jdBkrejaZandKZaeaZbe jdLkr2ejcZcejdZdejeZeejfZfejgZgejhZhejiZineaGdMdNeYZceaGdOdPeYZdeaGdQdReYZeeaGdSdTeYZfeaGdUdVeYZgeaGdWdXeYe"ZheaGdYdZeYe"Zie4ed[re4ed\rejjZjejkZkn8eaGd]d[eYe"ZjeaGd^d\eYe#Zke4ed_ p e4ed` ZlelrGdadbeZme4ed_rejnZnnGdcddemZoeoZn[oe4ed`rejpZpnGdedfemZqeqZp[qelr[mdgZrerrejsZsejtZtejuZunodhejvejwjxvZydiZzGdjdkeZte{etdldmiZ|dnZ}Gdodpe(dZ~e~dqZsejtetfZdrZue4edsrejZndtZe4edurejZndvZd dwZedZNdxZd dyZe jdd4d krejZejZndzZd{Ze4ed|rejZn e)d}Zd~ZdZGddZGddeZerddlmZnGddeZe4edrejZejZn)GddZGddeZGddeZerddlmZn+e4edrGddeZnGddeeZe4eds+e4eds d dgddZnejZGddeZn'ejZe jdkrGddejdZGddZdZejdZe jdkrejZn e)dZe4edrejZn e)dZe4edrejZn e)dZe4edrejZnGdde)dZedZe4edrejZn e(dZe4edrejZn e(dZe4edrejZn e(dZe4edrejZejZne)dZe)dZe4edurejZn e)dZdZe jdLkr ejZdZn3Gdde)dZGddej0dZedZdZdZerddlmZn*e4edrGddeZnGddeZe4edrejZndedefdZe4edrejZndZe4ed¦rejZndedefdĄZe jdLkrejZnhddgdgdgdmdŜdeQdeQdeQdeQdejejej<ej$ejdej$ffdfdej$dejegeffd̈́Ze4edΦrejZn,ejdejdej$fЦZdedefdфZe jdkrejZnejdӦZGdԄdզZe jd krdքZndׄZe4edsefd؄ZndلZesee_deQfdڄZeeeddhZdeQfdۄZe4edܦr d d݄Zee_n dބZesee_e jdBkrejZnNd d߄ZejZeThdZGddeZe{eddmiZdZefdZee_e4ejd;r ejjZnRGdd;ejZeŠeȦeŠeɦeŠeʦe4e dre jZndZe jdkrejZn GddZe jdkrejZnLe jdLkrdZndZe jd kr"eThdZGddej0dZGddZe4edrejZejZndedeQfdZdedejefdZe4edrejZn GddZee ddZeր+ ddlZeeddZe؁ eeئZn #e$rYnwxYweցeZede jdkr ddlmZmZn!GddejZdddgejddZe4edrejZn ddddddZdddddeTddZGddZgdZedeDej`Z`ejZejZdS(N)uAnyClassVar ConcatenateFinal LiteralString ParamSpec ParamSpecArgsParamSpecKwargsSelfTypeTypeVar TypeVarTupleUnpack Awaitable AsyncIterator AsyncIterable CoroutineAsyncGeneratorAsyncContextManagerBufferChainMapContextManagerCounterDeque DefaultDict NamedTuple OrderedDict TypedDict SupportsAbs SupportsBytesSupportsComplex SupportsFloat SupportsIndex SupportsInt SupportsRoundReaderWriter Annotated assert_never assert_typeclear_overloadsdataclass_transform deprecatedDocevaluate_forward_ref get_overloadsfinalFormatget_annotationsget_args get_originget_original_basesget_protocol_membersget_type_hintsIntVar is_protocol is_typeddictLiteralNewTypeoverloadoverrideProtocolSentinel reveal_typeruntimeruntime_checkableText TypeAlias TypeAliasTypeTypeForm TypeGuardTypeIs TYPE_CHECKINGNeverNoReturnReadOnlyRequired NotRequired NoDefault NoExtraItems AbstractSetAnyStrBinaryIOCallable Collection ContainerDict ForwardRef FrozenSet GeneratorGenericHashableIO ItemsViewIterableIteratorKeysViewListMapping MappingViewMatchMutableMappingMutableSequence MutableSetOptionalPattern ReversibleSequenceSetSizedTextIOTupleUnion ValuesViewcast no_type_checkno_type_check_decoratorT)r rbeta__forward_is_class__ceZdZdZdS) _SentinelcdS)Nz selfs q/builddir/build/BUILD/imunify360-venv-2.6.0/opt/imunify360/venv/lib/python3.11/site-packages/typing_extensions.py__repr__z_Sentinel.__repr__s|N__name__ __module__ __qualname__rrrrrrs#rrr cdt|tjtjtjfSN) isinstancetyping _GenericAlias_types GenericAlias UnionTypets r_should_collect_from_parametersrs) $f&96;KL   rcNt|tjtjfSr)rrrrrrs rrrs!f2F4GHIIIrTKTVTT_co) covariantT_contra) contravariantr )rc(eZdZfdZfdZxZS)_AnyMetacv|turtdt|S)Nz6typing_extensions.Any cannot be used with isinstance())r TypeErrorsuper__instancecheck__)robj __class__s rrz_AnyMeta.__instancecheck__s3s{{ XYYY77,,S11 1rcZ|turdStS)Nztyping_extensions.Any)rrr)rrs rrz_AnyMeta.__repr__s(s{{..77##%% %r)rrrrr __classcell__rs@rrrsQ 2 2 2 2 2  & & & & & & & & &rrc"eZdZdZfdZxZS)raqSpecial type indicating an unconstrained type. - Any is compatible with every type. - Any assumed to have all methods. - All values assumed to be instances of Any. Note that all the above statements are true from the point of view of static type checkers. At runtime, Any should not be used with instance checks. cn|turtdtj|g|Ri|S)NzAny cannot be instantiated)rrr__new__clsargskwargsrs rrz Any.__new__sAczz <==="577?3888888 8r)rrr__doc__rrrs@rrrsB   9 9 9 9 9 9 9 9 9rr) metaclasscneZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z ejd Zd S) _SpecialForm)_namer_getitemcD||_|j|_|j|_dSr)rrrr)rgetitems r__init__z_SpecialForm.__init__s  %  rc6|dvr|jSt|)N>rr)rAttributeError)ritems r __getattr__z_SpecialForm.__getattr__s$ / / /: T"""rc&td|)NzCannot subclass rrbasess r__mro_entries__z_SpecialForm.__mro_entries__s3433444rcd|jSNztyping_extensions.rrs rrz_SpecialForm.__repr__s0DJ000rc|jSrrrs r __reduce__z_SpecialForm.__reduce__ zrc&td|)NzCannot instantiate rrrkwdss r__call__z_SpecialForm.__call__s6d66777rc*tj||fSrrrvrothers r__or__z_SpecialForm.__or__s|D%K((rc*tj||fSrrrs r__ror__z_SpecialForm.__ror__s|E4K((rc&t|d)Nz! cannot be used with isinstance()rrrs rrz_SpecialForm.__instancecheck__4BBBCCCrc&t|d)Nz! cannot be used with issubclass()r)rrs r__subclasscheck__z_SpecialForm.__subclasscheck__rrc.|||Sr)rr parameterss r __getitem__z_SpecialForm.__getitem__ s}}T:...rN)rrr __slots__rrrrrrrrrrr _tp_cacherrrrrrs0I''' ### 555111888))))))DDDDDD /////rr)_rootceZdZdZdS)_ExtensionsSpecialFormcd|jzSrrrs rrz_ExtensionsSpecialForm.__repr__s#dj00rNrrrrrrs#11111rrcF d|_n#ttf$rYnwxYw|S)aThis 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) __final__rr)fs rr4r4s>, AKK *    D     c*tj|Sr)rr)names rr<r<>s >$  r)rrcg}|D]G}t|tr||j2||Ht |S)zJAn internal helper for Literal creation: flatten Literals among parameters)r_LiteralGenericAliasextend__args__appendtuple)rparamsps r_flatten_literal_paramsrFsa ! !A!122 ! aj)))) a    V}}rc#:K|D]}|t|fVdSr)type)rrs r_value_and_type_iterrPs8  AT!WW*      rceZdZdZdZdS)rct|tstStt |j}tt |j}||kSr)rrNotImplementedsetrr)rrthese_args_dedupedother_args_dedupeds r__eq__z_LiteralGenericAlias.__eq__UsYe%9:: &%%!$%9$-%H%H!I!I !$%9%.%I%I!J!J %);; ;rc^ttt|jSr)hash frozensetrrrs r__hash__z_LiteralGenericAlias.__hash__\s# "6t}"E"EFFGG GrN)rrrrrrrrrrTs7 < < < H H H H Hrrc eZdZdefdZdZdS) _LiteralFormdocc0d|_|x|_|_dS)Nr?)r_docr)rrs rrz_LiteralForm.__init__`s"DJ'* *DI rct|ts|f}t|}tt |} t |}t |t |krVg}|D]6}||vr0||d||7|r J|t|}n#t$rYnwxYwt||S)Nr) rrrlistrrlenrremoverr)rrval_type_pairs deduped_pairsnew_parameterspairs rrz_LiteralForm.__getitem__dsj%00 +(] 0< + + + + + : : : : :rra 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.)rr3ct|d|} |t|j|j|jj<n#t $rYnwxYwtS)aDecorator for overloaded functions/methods. In a stub file, place two or more stub definitions for the same function in a row, each decorated with @overload. For example: @overload def utf8(value: None) -> None: ... @overload def utf8(value: bytes) -> bytes: ... @overload def utf8(value: str) -> bytes: ... In a non-stub file (i.e. a regular .py file), do the same but follow it with an implementation. The implementation should *not* be decorated with @overload. For example: @overload def utf8(value: None) -> None: ... @overload def utf8(value: bytes) -> bytes: ... @overload def utf8(value: str) -> bytes: ... def utf8(value): # implementation goes here The overloads for a function can be retrieved at runtime using the get_overloads() function. __func__)getattr_overload_registryrr__code__co_firstlinenor_overload_dummy)funcrs rrArAsn< D*d + +  q| ,Q^ < )      D s*> A  A ct|d|}|jtvrgSt|j}|j|vrgSt ||jS)z6Return all defined overloads for *func* as a sequence.r)rrrrr values)rrmod_dicts rr3r3sg D*d + + <1 1 1I%al3 > ) )IHQ^,3355666rc8tdS)z$Clear all overloads in the registry.N)rclearrrrr.r.s  """""r)rrrr_cV|do|dS)N__) startswithendswith)attrs r _is_dunderr$s%t$$<t)<)<_instr_nparamsr*)r$object __setattr__setattr __origin__)rr#val allowed_attrss rr1z _SpecialGenericAlias.__setattr__s_GGGM$ 44=#8#8""4s33333s33333rc t|ts|f}dtfd|D}|jrnt||jkrVt|t|jz|jkr)g||jt||jz dR}t|}||jkr||jr d|jt|jz }nt |j}|jst |dt d||jkrdndd|d |d |||S) Nz*Parameters to generic types must be types.c3BK|]}tj|VdSrr _type_check.0rmsgs r z3_SpecialGenericAlias.__getitem__..s0FF!6-a55FFFFFFr at least  is not a generic classToo manyfew arguments for ; actual , expected )rrr*r r/rr copy_with)rr actual_lenexpectedr<s @rrz _SpecialGenericAlias.__getitem__sfe,, # >CFFFFvFFFFFF RKK$-//KK#dn"5"55FFQ6QDN3v;;3N3O3O$PQQVJT]**>2P4=3t~;N;N+NPPHH"4=11H}F#t$D$D$DEEEAZ$-%?%?66UAA&*AA)AA6>AA >>&)) )r) rrrrr1rrrrrs@rr&r&sw48tb & & & & & & & 4 4 4   * *   * * * * *rr&r)r(r)rr(r) rYrrdrerrarsr[rZrprAbstractContextManagerAbstractAsyncContextManagerr)zcollections.abc contextlibtyping_extensions>r__match_args____protocol_attrs____non_callable_proto_members__ct}|jddD]_}|jdvr t|di}g|j|RD]5}|ds|t vr||6`|S)N>r`rC__annotations___abc_)r__mro__rr__dict__r!_EXCLUDED_ATTRSadd)rattrsbase annotationsr#s r_get_protocol_attrsr\7s EEE CRC    =3 3 3 d$5r:: 2dm2k22  DOOG,, _1L1L $  Lrr__main__c tj|dzp|S#t$rYnwxYw tj|dzjd|S#tt f$rYnwxYwdS)Nrr)sys_getframemodulenamer _getframe f_globalsget ValueError)depthdefaults r_callerrgCs &uqy11Nabc functools)rgres r_allow_reckless_class_checksrmTs u~~!;;;rcLt|jrtddS)Nz Protocols cannot be instantiated)r _is_protocolrrrrs r_no_initrq[s/ :: " @>?? ? @ @rcNt|tstddS)aRaise TypeError if `arg` is not an instance of `type` in `issubclass(arg, )`. In most cases, this is verified by type.__subclasscheck__. Checking it again unnecessarily would slow down issubclass() checks, so, we don't perform this check unless we absolutely have to. For various error paths, however, we want to ensure that *this* error message is shown to the user where relevant, rather than a typing.py-specific error message. z"issubclass() arg 1 must be a classN)rrrargs r_type_check_issubclass_arg_1ru_s2#t$$ B@AA A B Brc8eZdZdZdZdZdZdZdefdZ dS) _ProtocolMetac |dkrt|dkrnttjht|zrs|D]p}|ttjttjhvsH|jt|j gvs!t|std|qtj j||||fi|S)NrCrIz5Protocols can only inherit from other protocols, got )r rCrrr0r`r_PROTO_ALLOWLISTrcrr=rrjABCMetar)mclsrr namespacerrZs rrz_ProtocolMeta.__new__ysz!!c%jj1nnFO,s5zz9 !  D6? SSS=,<,@,@RT,U,UUU&t,,V(,#',,;&tT5)NNvNN Nrctjj|g|Ri|t|ddrt ||_dSdS)NroF)rjrzrrr\rOrrrs rrz_ProtocolMeta.__init__s\ K  6t 6 6 6v 6 6 6sNE22 B).s&&L&LqH}&L&L&L&L&L&Lrr) r__init_subclass__rVrcany __bases__rorrrrCrqrs rrzProtocol.__init_subclass__s %EGG %t 6v 6 6 6<##NE:: M#&&L&Lcm&L&L&L#L#L "55'2$ (CLH4E$E$E'  ( ($E$Er) rrrrrCrrrorrrrs@rrCrCsR/)  $ ( ( ( ( ( ( ( ( (rrCct|tjrt|ddst d|d|_t |tstj dkr~t|_ |j D]c} tt||d}|s|j |>#t$r}t d|d|d}~wwxYw|S) ajMark a protocol class as a runtime protocol. Such protocol 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 one trick ponies in collections.abc such as Iterable. For example:: @runtime_checkable class Closable(Protocol): def close(self): ... assert isinstance(open('/some/file'), Closable) Warning: this will check only the presence of the required methods, not their type signatures! roFz@@runtime_checkable can be only applied to protocol classes, got T)r rINz,Failed to determine whether protocol member z is a method member) issubclassrr`rrrrrwr_ version_inforrPrOcallablerX Exception)rr# is_callablees rrGrGs3&#v~.. -gc>SX6Y6Y -,$',,-- -#'  c= ) ) ES-=-K-K 25C .. E E E"*73d+C+C"D"DK'E:>>tDDD!#-t--- sC C% C  C%rrc<eZdZdZdZejdefdZdS)r'z(An ABC with one abstract method __int__.rrcdSrrrs r__int__zSupportsInt.__int__O DrN) rrrrrrjabstractmethodrrrrrr'r'JsH66  S        rr'c<eZdZdZdZejdefdZdS)r%z*An ABC with one abstract method __float__.rrcdSrrrs r __float__zSupportsFloat.__float__XrrN) rrrrrrjrfloatrrrrr%r%SH88  u        rr%c<eZdZdZdZejdefdZdS)r$z,An ABC with one abstract method __complex__.rrcdSrrrs r __complex__zSupportsComplex.__complex__arrN) rrrrrrjrcomplexrrrrr$r$\sH::          rr$c<eZdZdZdZejdefdZdS)r#z*An ABC with one abstract method __bytes__.rrcdSrrrs r __bytes__zSupportsBytes.__bytes__jrrN) rrrrrrjrbytesrrrrr#r#errr#c8eZdZdZejdefdZdS)r&rrcdSrrrs r __index__zSupportsIndex.__index__rrrN)rrrrrjrrrrrrr&r&nsB  s        rr&c<eZdZdZdZejdefdZdS)r"z_ An ABC with one abstract method __abs__ that is covariant in its return type. rrcdSrrrs r__abs__zSupportsAbs.__abs__}rrN) rrrrrrjrrrrrrr"r"vsN    T        rr"cBeZdZdZdZejddedefdZ dS) r(za An ABC with one abstract method __round__ that is covariant in its return type. rrndigitsrcdSrr)rrs r __round__zSupportsRound.__round__rrNr) rrrrrrjrrrrrrrr(r(sZ     S         rr(r)r*cBeZdZdZdZejddedefdZ dS) r)zeProtocol for simple I/O reader instances. This protocol only supports blocking I/O. r.sizercdS)zRead data from the input stream and return it. If *size* is specified, at most *size* items (bytes/characters) will be read. Nr)rrs rreadz Reader.readrN).) rrrrrrjrrrrrrrr)r)sZ     S d        rc@eZdZdZdZejdedefdZ dS)r*zeProtocol for simple I/O writer instances. This protocol only supports blocking I/O. rdatarcdS)zIWrite *data* to the output stream and return the number of items written.Nr)rrs rwritez Writer.writerrN) rrrrrrjrrrrrrrr*r*s]    \h \c \ \ \   \ \ \rrTrUceZdZdZdS) SingletonMetac6td|d|j)Nz cannot set z attribute of immutable type rr)rr#values rr1zSingletonMeta.__setattr__s)SdSS3<SS rN)rrrr1rrrrrs#     rrc(eZdZdZdZdZdZdZdS) NoDefaultTypez$The type of the NoDefault singleton.rcxtdpt|SNrTglobalsrcr0rrs rrzNoDefaultType.__new__s)99==--D1D1D DrcdS)Nztyping_extensions.NoDefaultrrs rrzNoDefaultType.__repr__s00rcdSrrrs rrzNoDefaultType.__reduce__s;rNrrrrrrrrrrrrrsO22  E E E 1 1 1     rrc(eZdZdZdZdZdZdZdS)NoExtraItemsTypez'The type of the NoExtraItems singleton.rcxtdpt|SNrUrrs rrzNoExtraItemsType.__new__s)99==00GFNN34G4G GrcdS)Nztyping_extensions.NoExtraItemsrrs rrzNoExtraItemsType.__repr__s33rcdSrrrs rrzNoExtraItemsType.__reduce__s!>rNrrrrrrsO55  H H H 4 4 4 " " " " "rrFmodulec#NK t|}|turt|}|r |d}npdS|turtVt|\}nJ|turtVt|\}n&|t urt Vt|\}ndS)NTr)r8r+r7rRrSrQ)annotation_typeannotation_originannotation_argss r_get_typeddict_qualifiersrs  *? ; ;  I--"*?";";"&5a&8OOE"h..#+O#<#< "k11!!!!#+O#<#< "h..#+O#<#< % rc,eZdZddeddZeZdZeZdS)_TypedDictMetaTNtotalclosed extra_itemsc D]5}t|tur|tjurt d6||t urt d|dt dDrtjf}nd}|dd} ttdg|tR||_ j dkr|_ td s_ i} d| | nxtjd krftt d rt!j|n|d "t!jt(j ninidt,r"fdDn fdDt1} t1} t1} t1}|}D]}|j}tjd kr)| |di| |dd| |dd| |dd||dd|rwtjd krgdvrcd}t1t7|}t8|vrt dt:|vrt d|}| D]\}}t1t7|}t8|vr| |nLt:|vr| |n-|r| |n| |t>|vr+| || |||| |tjd krfd}|_!n| _"tG| _$tG| _%tG| _&tG|_'|_(|_)|_*S)aICreate new typed dict class object. This method is called when TypedDict is subclassed, or when TypedDict is instantiated. This way TypedDict supports all three syntax forms described in its docstring. Subclasses and instances of TypedDict return actual dictionaries. zHcannot inherit from both a TypedDict type and a non-TypedDict base classNzCannot combine closed=z and extra_itemsc3JK|]}t|tjVdSr)rrr`rs rr=z)_TypedDictMeta.__new__..&s.@@Q:a00@@@@@@rrrSrC__orig_bases__r!get_annotate_from_class_namespace __annotate__ownerz?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typecPi|]"\}}|tj|j#Srrr9rr;ntpr<tp_dicts r z*_TypedDictMeta.__new__..KsD+++2v)"c':LMMM+++rcBi|]\}}|tj|Srr8)r;rrr<s rrz*_TypedDictMeta.__new__..Ps<+++2v)"c22+++r__required_keys____optional_keys____readonly_keys____mutable_keys____extra_items__z5Special key __extra_items__ does not support Requiredz8Special key __extra_items__ does not support NotRequiredci}D]B}|tur |j}|tj|||}||CItj| }|t jkr! fd|D}nQ|t jkrtj }n,|t j t j fvr }nt||||S)NrcPi|]"\}}|tj|j#Srrrs rrz@_TypedDictMeta.__new__..__annotate__..sD###$)Ar!"6#5b#gFX#Y#Y#Y###r) r`r annotationlibcall_annotate_functionupdater5STRINGitemsannotations_to_string FORWARDREFVALUENotImplementedError) formatannosrZ base_annotate base_annosownrr< own_annotateown_annotationsown_checked_annotationsrs rrz,_TypedDictMeta.__new__..__annotate__s3E %117??$(,(9 (0$%2%I)6&?&?&?  Z0000#/+B(&AAA!V]22#####-0YY[[###C 6=00+A/RRF$5v|#DDD51&999LL%%% Lr)+rrrr`rrUrpoprdictrrhasattrrr_rrrrcrr5r _TAKES_MODULErrrVrrrRrSrXrQdiscardrrSrrrrr __total__ __closed__r)rrrnsrrrrZ generic_basens_annotationsr[ required_keys optional_keys readonly_keys mutable_keysextra_items_type base_dictr qualifiersannotation_keyrr<rrrrs ` @@@@@rrz_TypedDictMeta.__new__s F F::^33FN8R8R#%EFFF!k&E&E S S S STTT@@%@@@@@ " &0 ! VV$5t<:?T?Tt?T?TVXYYG#G #z11'+$7$455 /).&KL)"0!W,,=*MNN:#0#RSU#V#VLL$&66.#9#9L+&3&J$f&7w'''OO')OO"$SC +++++!0!6!6!8!8+++'' ++++!0!6!6!8!8+++' EEMEEMEEM55L*  K K M #w..&&y}}5F'K'KLLL$$Y]]3F%K%KLLL$$Y]]3F%K%KLLL$$Y]]3F%K%KLLL##IMM2Db$I$IJJJJ  33+g55,0GGG"9"="=>O"P"P !:?!K!KLL z))##*,,#&$3   6 7 7 73J3P3P3R3R : :/ !:?!K!KLL z))!%%n5555 J..!%%n55556!%%n5555!%%n555z)) ((888!%%n5555 $$^444!)).99997**!!!!!!!!!!8(4$$*5'(1-(@(@G %(1-(@(@G %(1-(@(@G %'0'>'>G $ %G !'G &6G #Nrc td)Nz4TypedDict does not support instance and class checksrrs rrz _TypedDictMeta.__subclasscheck__sRSS Sr) rrrrUrrrrrrrrrrsX37 ,[ [ [ [ [ z T T T.rrr!rc "|tus|g|turd}nd}d|d|d}|d|zdz} tj| td |d ur |d ur |||d <d}|tur ||d <t}|}n|rt d|r;t jdkrt dtjdtd dt|i} t|rdnd} | | | d<t|d| |||} tf| _ | S)N2Failing to pass a value for the 'fields' parameter(Passing `None` as the 'fields' parameter`z = TypedDict(z, {})`z is deprecated and will be disallowed in Python 3.15. To create a TypedDict class with 0 fields using the functional syntax, pass an empty dictionary, e.g. rrI stacklevelFTrrz@TypedDict takes either a dict or keyword arguments, but not bothrhz$TypedDict takes no keyword argumentszThe kwargs-based syntax for TypedDict definitions is deprecated in Python 3.11, will be removed in Python 3.13, and may not be understood by third-party type checkers.rSrlrrr) _markerwarningswarnDeprecationWarningrUrr_rrrgrr!r) typenamefieldstyping_is_inlinerrrrdeprecated_thingexampledeprecation_msgrrtds r_create_typeddictr8s W    H! $N E(EEEEEG#OOO  O M/+=! L L L LU""vT'9'9f>P#)x ,..(3}%* FF  -,-- -  7** FGGG M;#      f .$4;qq!<<<   &B|  Hb"E&(3555&L rc(eZdZefddeddZdZdS)_TypedDictSpecialFormTNrc (t||fd|||d|S)NFr3rrr)r8)rr1r2rrrrs rrz_TypedDictSpecialForm.__call__s>%"''  rctfSr) _TypedDictrs rrz%_TypedDictSpecialForm.__mro_entries__s = r)rrrr-rUrrrrrr:r:sQ  $     * ! ! ! ! !rr:c~t|tstdtd|dddtS)aqA simple typed namespace. At runtime it is equivalent to a plain dict. TypedDict creates a dictionary type such that a type checker will expect all instances to have a certain set of keys, where each key is associated with a value of a consistent type. This expectation is not checked at runtime. 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 an additional equivalent form:: Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str}) By default, all keys must be present in a TypedDict. It is possible to override this by specifying totality:: class Point2D(TypedDict, total=False): x: int y: int This means that a Point2D TypedDict can have any of the keys omitted. A type checker is only expected to support a literal False or True as the value of the total argument. True is the default, and makes all items defined in the class body be required. The Required and NotRequired special forms can also be used to mark individual keys as being required or not required:: class Point2D(TypedDict): x: int # the "x" key must always be present (Required is the default) y: NotRequired[int] # the "y" key can be omitted See PEP 655 for more details on Required and NotRequired. z9TypedDict[...] should be used with a single dict argumentzTr<)rrrr8rU)rrs rr!r!sWb$%% K ! !$     rc,t|tS)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 )r_TYPEDDICT_TYPESrs rr>r>Ts".///rr-c|S)aAssert (to the type checker) that the value is of the given type. When the type checker encounters a call to assert_type(), it emits an error if the value is not of the specified type:: def greet(name: str) -> None: assert_type(name, str) # ok assert_type(name, int) # type checker error At runtime this returns the first argument unchanged and otherwise does nothing. r)r4typs rr-r-fs  rrQczt|tjrt|jSt |dr5|jt ttfvrt|j dSt|tj r@td|j D}||j kr|S| |St tdr_t|tjrEtd|j D}||j kr|Stj|j|St tdrdt|tjrJtd|j D}||j kr|St!jt$j|S|S)z=Strips Annotated, Required and NotRequired from a given type.r3rc34K|]}t|VdSr _strip_extrasr;as rr=z _strip_extras..*!G!Gq-"2"2!G!G!G!G!G!Grrc34K|]}t|VdSrrGrIs rr=z _strip_extras..rKrrc34K|]}t|VdSrrGrIs rr=z _strip_extras..rKr)rr_AnnotatedAliasrHr3rrRrSrQrrrrFrrrrkreduceoperatoror_)r stripped_argss rrHrHzs a/ 0 0 / .. . 1l # # 0 ;PX8Y(Y(Y A// / a- . . .!!G!GAJ!G!G!GGGM **;;}-- - 6> * * Dz!V=P/Q/Q D!!G!GAJ!G!G!GGGM **&q|]CC C 6; ' ' AJq&:J,K,K A!!G!GAJ!G!G!GGGM **#HL-@@ @rctj|||d}tjdkrt |||||r|Sd|DS)aReturn 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. T)globalnslocalnsinclude_extrasrc4i|]\}}|t|SrrG)r;krs rrz"get_type_hints..s&===1=##===r)rr;r_r_clean_optionalr)rrTrUrVhints rr;r;sr@$ (GD     g % % Cx 9 9 9  K== ====rcjt|tjsdS|jdturdSdS)z detects Union[..., None] patternFrRT)rr_UnionGenericAliasr _NoneTypers r_could_be_inserted_optionalr^s7!V677 5 :b> * *5trc(|rt|trdStj|}|sdS|j}|D]C\}}t |r ||vs||"||}|t}t|tr|at|tj r|j }n:|} t| dr| j } t| dt| di}||}n||}t|t|tj  }tj|||} | |ksIttdr9t| tjrt|tjs| ||<EdS)N __wrapped__ __globals__) is_argumentr)rrr _get_defaultsrSrr^r]rr ModuleTyperVrr`rr] _eval_typer) rhintsrTrUr(original_hintsrroriginal_valuensobjoriginal_evaluateds rrYrYs  3--  F',,  F, ;;==( 1( 1KD%/66 x''D>-+D1N%!*.#.. #!#v'899E#&< #%e];;6$)$5E&e];;6#*5-#D#D"*_&G!+"$.sF4E$F$F F""""(!2>8W!U!U "U** ,,+163CDD+#5&*:;; + 1d Q( 1( 1rct|tjrtSt|tjt jttfr|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) rrrNr+_BaseGenericAliasrrr r r3r`rBs rr8r8si b&0 1 1   b63V5H(/; < < !=   > !trcTt|tjr|jg|jRSt|tjt jfrW|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) rNrRr)rrrNr3 __metadata__rrrrr8rrjrYEllipsisr )rress rr7r7s b&0 1 1 5M4BO44 4 b6/1DE F F +C"~~!999c!fH>T>TCH~~s2w/JrrrIc&t|d)a&Special marker indicating that an assignment should be recognized as a proper type alias definition by type checkers. For example:: Predicate: TypeAlias = Callable[..., bool] It's invalid when used anywhere except as in the example above.  is not subscriptablerrs rrIrI4s4666777rc*fd|_|_dS)NctuSr)rTrfsrz_set_default..Ds WI%=r) has_default __default__) type_paramrfs `r _set_defaultrzCs"====J$JrcDtd}|dkr ||_dSdS)NrIrlrM)rgr) typevarlikedef_mods r _set_moduler~Hs4AG%%%!( &%rceZdZdZdZeZdS) _DefaultMixinzMixin for TypeVarLike defaults.rN)rrrrrrzrrrrrrOs))IHHHrrceZdZdedefdZdS)_TypeVarLikeMeta_TypeVarLikeMeta__instancerc,t||jSr)r_backported_typevarlike)rrs rrz"_TypeVarLikeMeta.__instancecheck__Xs*c&ABBBrN)rrrrboolrrrrrrWs>C3C4CCCCCCrr)rc<eZdZdZejZdddedddZddZ dS) rzType variable.NF)boundrrrfinfer_variancec  ttdrtj|g|R||||d n3tj|g|R|||d |r|s|rtd| _t |t  fd}| _ S)NrJrrrrrrrz1Variance cannot be specified with infer_variance.cr6|jt|kr |jfz }|Sr)rw__parameters__indexr rx)aliasrtypevars r_tvar_prepare_substz,TypeVar.__new__.._tvar_prepare_substwsN''))3,227;;s4yyHHW022D r)rrrrd__infer_variance__rzr~__typing_prepare_subst__) rrrrrrfr constraintsrrs @rrzTypeVar.__new__esv// < .H HH53._paramspec_prepare_substs-LL++D >>i&;&;&=&=>9T99#89DD >>#$DU$D$DEEEv;;!##F,A$q',J,J#6666 7DDQ..FET"1"XEuT!W~~EQUVV EED r)rrr rrzr~r) rrrrrrrfrrs @rrzParamSpec.__new__sv// >",T7@;H , G , , ,  " " "      2JI . rrc2tdtd)Nrz*.ParamSpec' is not an acceptable base typerrs rrzParamSpec.__init_subclass__sYXYYYZZ Zrr) rrrrrr rrTrrrrrr r sd&&"("2(,#5#()# # # # # J [ [ [ [ [ [rc~eZdZdZejZedZedZ dddde ddZ dZ d Z d Zd Zd ZdS) r a'Parameter specification variable. Usage:: P = ParamSpec('P') Parameter specification variables exist primarily for the benefit of static type checkers. They are used to forward the parameter types of one callable to another callable, a pattern commonly found in higher order functions and decorators. They are only valid when used in ``Concatenate``, or s the first argument to ``Callable``. In Python 3.10 and higher, they are also supported in user-defined Generics at runtime. See class Generic for more information on generic types. An example for annotating a decorator:: T = TypeVar('T') P = ParamSpec('P') def add_logging(f: Callable[P, T]) -> Callable[P, T]: '''A type-safe decorator to add logging to a function.''' def inner(*args: P.args, **kwargs: P.kwargs) -> T: logging.info(f'{f.__name__} was called') return f(*args, **kwargs) return inner @add_logging def add_two(x: float, y: float) -> float: '''Add two numbers together.''' return x + y Parameter specification variables defined with covariant=True or contravariant=True can be used to declare covariant or contravariant generic types. These keyword arguments are valid, but their actual semantics are yet to be decided. See PEP 612 for details. Parameter specification variables can be introspected. e.g.: P.__name__ == 'T' P.__bound__ == None P.__covariant__ == False P.__contravariant__ == False Note that only parameter specification variables defined in global scope can be pickled. c t|Sr)r rs rrzParamSpec.args/s && &rc t|Sr)r rs rrzParamSpec.kwargs3s"4(( (rNFrc|t||g||_t||_t||_t||_|rtj|d|_ nd|_ t||t}|dkr ||_ dSdS)NzBound must be a type.rM) r rrr __covariant____contravariant__rrr9 __bound__rrgr)rrrrrrrfr}s rrzParamSpec.__init__7s MM$ ' ' ' DM!%iD %)-%8%8D "&*>&:&:D # &!'!3E;R!S!S!%  " "4 1 1 1iiG---").-rcV|jrd}n|jrd}n |jrd}nd}||jzS)N+-~)rrrr)rprefixs rrzParamSpec.__repr__IsJ& # ' DM) )rc6t|Srr0rrs rrzParamSpec.__hash__T??4(( (rc ||uSrrrs rrzParamSpec.__eq__W 5= rc|jSrrrs rrzParamSpec.__reduce__Z = rcdSrrrps rrzParamSpec.__call__^ Dr)rrrrrrrpropertyrrrTrrrrrrrrrr r s, , ^N  ' '  '  ) )  )+/%u$)9 * * * * *$ * * * ) ) ) ! ! ! ! ! !     rr _type_convert)allow_special_formsc|tdSt|trRtjdkrt |Stjdkrt ||St |||S|S)z=For converting None to type(None), and strings to ForwardRef.N)r )rrr)ris_class)rrrr_rr])rtrrs rrrhs|{Dzz!#s## T#y00%c??*#y00%c&9999!#f?RSSSSJrc`eZdZejZfdZdZdZdZ e dZ dZ dZ xZS)_ConcatenateGenericAliascft|||_||_dSr)rrr3r)rr+rrs rrz!_ConcatenateGenericAlias.__init__{s- GG  T " " "$DO DMMMrctj|jddfd|jDdS)N[, c3.K|]}|VdSrr)r;rt _type_reprs rr=z4_ConcatenateGenericAlias.__repr__..s+!K!Kc**S//!K!K!K!K!K!Kr])rrr3joinr)rrs @rrz!_ConcatenateGenericAlias.__repr__sd*J!z$/22OO !K!K!K!KT]!K!K!KKKOOO Prc8t|j|jfSr)rr3rrs rrz!_ConcatenateGenericAlias.__hash__s$-899 9rcdSrrrps rrz!_ConcatenateGenericAlias.__call__rrc>td|jDS)Nc3\K|]'}t|tjtf#|V(dSr)rrrr )r;rs rr=z:_ConcatenateGenericAlias.__parameters__..sLjfni=X.Y.Yr)rrrs rrz'_ConcatenateGenericAlias.__parameters__s2!] rczt|dtrg|dd|djR}nkt|dttfrg|dd|dRS|ddus*t|dt st d||j|SNrR.MThe last parameter to Concatenate should be a ParamSpec variable or ellipsis.) rrrr rr rrr3rrs rrFz"_ConcatenateGenericAlias.copy_withs&*&>?? ;=6#2#;=)<==F2Ju 66 ;22vbz222bzS((Jvbz9,M,M(!:;;;>>$/6:: :rc H |jttfvrtd||jst|dt |t s|f}td|D}|j}|D]G}t|dd}| |||}#t |tr| |}|t|kr(t|dttur g||j }|t|krtd|t|dkr!t|ds |dksJ|f}t ||trJt ||t s/g|d|t ||||dzdR}It|}t|}||kr#td ||krd nd d |d |d|t#t%|j| g}|jD]O} t | t(r|| .t | t,r | } t | t.jrt3| s@t5t6dr=t | t6jr#t| ddrt| dnst | t5t6ds t.jnt.jt6jfr,| j} | r#t fd| D} | | } || Q|t |S)Nz%Cannot subscript already-subscripted r?c34K|]}t|VdSr)rr;rs rr=z7_ConcatenateGenericAlias.__getitem__..s*!A!Aq-"2"2!A!A!A!A!A!Arrrxrrrr@rArBrCrDrEr __unpacked__Fz is not valid as type argumentc3(K|] }|V dSrr)r;xsubsts rr=z7_ConcatenateGenericAlias.__getitem__..s''D'DQa'D'D'D'D'D'Dr)r3r`rCrrrr _unpack_argsrr rr rTrxrr rrziprrrrrr _is_unpackrrrrF) rrrparamprepareralenplennew_argsrt subparamssubargsrs @rrz$_ConcatenateGenericAlias.__getitem__s7H"555 N N NOOO& B4 @ @ @AAAdE** w!A!AD!A!A!ABD(F J J!%)CTJJ&"74..DDy11J U++ASYY#E=)DDIUU99u'89CII~~'(G(G(GHHH6{{a''tAw0G0G' Avvvv $w"47D11J!+474L M M J JbqbI5a>>IDQLIIt99Dv;;Dt||7TD[[66e77D77#770477 T0$7788EH} % %c4((OOC(((c7+++*C#C)=>>PCMc??P$FN;;P!+30C D D P !(^U C C P(3(N(N(NOOO"6>::@F(()6+>?+ !$ 2I +"''D'D'D'D)'D'D'D"D"D!'l$$$$>>%//22 2r)rrrrrrrrrrrrrFrrrs@rrrvs(  ! ! ! ! !  P P P  : : :          ; ; ;J 3J 3J 3J 3J 3J 3J 3rrc,eZdZdZfdZfdZxZS)rrct|dttfrg|dd|dRSt|dtjrg|dd|djR}n4|ddus*t|dt stdttj| |Sr) rr rrrrr rrrF)rrrs rrFz"_ConcatenateGenericAlias.copy_withsfRj4-8876VCRC[66":666fRj&*IJJ?Avcrc{AVBZ-@AAFF *++z&*i/P/P+#%>???V.s(3Q3QaJqMM3Q3Q3Q3Q3Q3Qrc3K|]}|VdSrr)r;rs rr=z7_ConcatenateGenericAlias.__getitem__..s"/A/Aa/A/A/A/A/A/Ar)rrrrrr)rrrrs rrz$_ConcatenateGenericAlias.__getitem__ss++D11eU++D3Q3Q53Q3Q3Q0Q0QD /A/A5/A/A/A!BCCC r)rrrrFrrrs@rrrs[!J V V V V V         rceZdZdS)_EllipsisDummyN)rrrrrrrrsrrc|ddur$tjdkrg|ddtR}tjdkr t||tt fd}nt||}|dtur|St d|jD|_tjdkr|St d |jD|_|S) NrR.)rrrI)rrrT)_typevar_types_paramspec_tvarsc30K|]}|tur|ndVdS).Nrrs rr=z,_create_concatenate_alias..sL!C!C()'(~&=&=3!C!C!C!C!C!Crrc3,K|]}|tu |VdSrrrs rr=z,_create_concatenate_alias..s<'D'DQ+,N+B+B()+B+B+B+B'D'Dr) r_rrrrr rrr)r+r concatenates r_create_concatenate_aliasr  s"~!1I!=!=7z#2#777  :%%.vz8?7K9=??? /vzBB "~^++ !C!C-8-A!C!C!CCCK '!!!&'D'D+2L'D'D'D"D"DK rc,|dkrtdt|ts|f}|ddus*t|dtstddgfd|ddD|dR}t ||S)Nrz&Cannot take a Concatenate of no types.rR.rz/Concatenate[arg, ...]: each arg must be a type.c3BK|]}tj|VdSrr8r:s rr=z'_concatenate_getitem..-s0HH1F&q#..HHHHHHr)rrrr r )rrr<s @r_concatenate_getitemr #sR@AAA j% ( (# ] rNc ! !Z 2 %J%J !:;; ; ;C$HHHH 3B3HHH$rN$$J $T: 6 66rc"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. )r rs rrr7s$D*555rrLc^tj||d}tj||fS)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).  accepts only a single type.rr9rrrrs rrLrLKs5X!*.S.S.STT#D4'222rrMc^tj||d}tj||fS)awSpecial typing form used to annotate the return type of a user-defined type narrower function. ``TypeIs`` only accepts a single type argument. At runtime, functions marked this way should return a boolean. ``TypeIs`` 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 ``TypeIs[...]`` as its return type to alert static type checkers to this intention. Using ``-> TypeIs`` 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 intersection of the type inside ``TypeIs`` and the argument's previously known type. For example:: def is_awaitable(val: object) -> TypeIs[Awaitable[Any]]: return hasattr(val, '__await__') def f(val: Union[int, Awaitable[int]]) -> int: if is_awaitable(val): assert_type(val, Awaitable[int]) else: assert_type(val, int) ``TypeIs`` also works with type variables. For more information, see PEP 742 (Narrowing types with TypeIs). rrrs rrMrMs5L!*.S.S.STT#D4'222rrKceZdZdZdS) _TypeFormFormc|Srrrs rrz_TypeFormForm.__call__JrN)rrrrrrrrrs#     rrc^tj||d}tj||fS)aA special form representing the value that results from the evaluation of a type expression. This value encodes the information supplied in the type expression, and it represents the type described by that type expression. When used in a type expression, TypeForm describes a set of type form objects. It accepts a single type argument, which must be a valid type expression. ``TypeForm[T]`` describes the set of all type form objects that represent the type T or types that are assignable to T. Usage: def cast[T](typ: TypeForm[T], value: Any) -> T: ... reveal_type(cast(int, "x")) # int See PEP 747 for more information. rrrs rrKrKs4&!*.S.S.STT#D4'222rr c&t|d)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. rrrrs rr r s"4666777rrc&t|d)zUsed to spell the type of "self" in classes. Example:: from typing import Self class ReturnsSelf: def parse(self, data: bytes) -> Self: ... return self rrrrs rrrs4666777rrOc&t|d)aThe 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 rrrrs rrOrOs04666777rrRchtj||jd}tj||fS)aA 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. rrr9rrrs rrRrR s6"!*.Y.Y.YZZ#D4'222rchtj||jd}tj||fS)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, ) rrrs rrSrS0 s6!*.Y.Y.YZZ#D4'222rchtj||jd}tj||fS)aA special typing construct to mark an item of a TypedDict as read-only. For example: class Movie(TypedDict): title: ReadOnly[str] year: int def mutate_movie(m: Movie) -> None: m["year"] = 1992 # allowed m["title"] = "The Matrix" # typechecker error There is no runtime checking for this property. rrrs rrQrQE s6 !*.Y.Y.YZZ#D4'222raType unpack operator. The type unpack operator takes the child types from some container type, such as `tuple[int, str]` or a `TypeVarTuple`, and 'pulls them out'. For example: # For some generic class `Foo`: Foo[Unpack[tuple[int, str]]] # Equivalent to Foo[int, str] Ts = TypeVarTuple('Ts') # Specifies that `Bar` is generic in an arbitrary number of types. # (Think of `Ts` as a tuple of an arbitrary number of individual # `TypeVar`s, which the `Unpack` is 'pulling out' directly into the # `Generic[]`.) class Bar(Generic[Unpack[Ts]]): ... Bar[int] # Valid Bar[int, str] # Also valid From Python 3.11, this can also be done using the `*` operator: Foo[*tuple[int, str]] class Bar(Generic[*Ts]): ... The operator can also be used along with a `TypedDict` to annotate `**kwargs` in a function signature. For instance: class Movie(TypedDict): name: str year: int # This function expects two keyword arguments - *name* of type `str` and # *year* of type `int`. def foo(**kwargs: Unpack[Movie]): ... Note that there is only some runtime checking of this operator. Not everything the runtime allows may be accepted by static type checkers. For more information, see PEP 646 and PEP 692. c.t|tuSr)r8rrs rrr s#&((rceZdZfdZxZS)_UnpackSpecialFormcbt|t|_dSr)rr _UNPACK_DOCr)rrrs rrz_UnpackSpecialForm.__init__ s& GG  W % % %&DLLLr)rrrrrrs@rr"r" s8 ' ' ' ' ' ' ' ' 'rr"cneZdZejdkrejZedZ edZ fdZ xZ S) _UnpackAliasrc|jtusJt|jdksJ|j\}t |t jtjfr$|jturtd|jSdS)Nrz*Unpack[...] must be used with a tuple type) r3rr rrrrrrrr)rrts r__typing_unpacked_tuple_args__z+_UnpackAlias.__typing_unpacked_tuple_args__ s?f,,,,t}%%****=DC# 4f6IJKK $>..#$PQQQ|#4rc|jtusJt|jdksJt |jdt S)Nrr)r3rr rrrrs r#__typing_is_unpacked_typevartuple__z0_UnpackAlias.__typing_is_unpacked_typevartuple__ sG?f,,,,t}%%****dmA. == =rcX|jr|St|Sr)r*rr)rrrs rrz_UnpackAlias.__getitem__ s+7  77&&t,, ,r) rrrr_rrrrrr(r*rrrs@rr&r& s  g % %I       > >  >  - - - - - - - - -rr&c^tj||jd}t||fS)Nr)rr9rr&rs rrr s1!*.Y.Y.YZZD4'***rc,t|tSr)rr&r s rrr s#|,,,rcg}|D]L}t|dd}|"|r |ddus||7||M|S)Nr(rR.)rrr)rnewargsrtrs rrr spG  #?FF   WR[C5G5G NN7 # # # # NN3     Nr)rrc2eZdZdZejZeddZdZ dS)rzType variable tuple.ructj|t|tfd}|_S)Nc r|j}|}||dzdD])}t|trt d|*t |}t |}|}||z dz }d} d} t |D]e\} } t| tsKt| dd} | r8t | dkr%| ddur| t d| } | d} f| 't|| }t||| z dz }n$||z|krt d |d |d |dz |||z kr) rtj }n ||||z }g|d|| g||z z|| g||z |z |z dz z|||z dRS) Nrz(More than one TypeVarTuple parameter in r(rIrR.z6More than one unpacked arbitrary-length tuple argumentrrrDz, expected at least ) rrrrrr  enumeraterrminrwrrx)rrrtypevartuple_indexrrrleftrightvar_tuple_indexfillargrXrtr replacementtvts r_typevartuple_prepare_substz9TypeVarTuple.__new__.._typevartuple_prepare_subst s-%+\\#%6%6"#$6$:$;$;<E!%66'NuNN 4yy6{{)11A5"&'oo 1 1FAs%c400 1")#/OQU"V"V"1s7||q'8'8WR[C=O=O.:&/%F'"'"!"/0O&-ajG".t_55Dto'='ABBEEE\D((#%TU%T%T/3%T%TIMPQ%T%TUUU4%<''COO,=,='".s"?"?KK"&tTE\'9":K%4%[i#5#<= i4%<$#69K#Ka#OP  $,--( r)rrrzr~r)rrrfr<r;s @rrzTypeVarTuple.__new__ s[%d++C g & & &    + + + + + Z,GC (Jrc td)N&Cannot subclass special typing classesrrs rrzTypeVarTuple.__init_subclass__ sDEE ErN) rrrrrrrrTrrrrrrr sT"""("5*33 3 3 3 3 j F F F F FrcPeZdZdZejZdZeddZ dZ dZ dZ dZ d Zd S) raType variable tuple. Usage:: Ts = TypeVarTuple('Ts') In the same way that a normal type variable is a stand-in for a single type such as ``int``, a type variable *tuple* is a stand-in for a *tuple* type such as ``Tuple[int, str]``. Type variable tuples can be used in ``Generic`` declarations. Consider the following example:: class Array(Generic[*Ts]): ... The ``Ts`` type variable tuple here behaves like ``tuple[T1, T2]``, where ``T1`` and ``T2`` are type variables. To use these type variables as type parameters of ``Array``, we must *unpack* the type variable tuple using the star operator: ``*Ts``. The signature of ``Array`` then behaves as if we had simply written ``class Array(Generic[T1, T2]): ...``. In contrast to ``Generic[T1, T2]``, however, ``Generic[*Shape]`` allows us to parameterise the class with an *arbitrary* number of type parameters. Type variable tuples can be used anywhere a normal ``TypeVar`` can. This includes class definitions, as shown above, as well as function signatures and variable annotations:: class Array(Generic[*Ts]): def __init__(self, shape: Tuple[*Ts]): self._shape: Tuple[*Ts] = shape def get_shape(self) -> Tuple[*Ts]: return self._shape shape = (Height(480), Width(640)) x: Array[Height, Width] = Array(shape) y = abs(x) # Inferred type is Array[Height, Width] z = x + x # ... is Array[Height, Width] x.get_shape() # ... is tuple[Height, Width] c#K|jVdSr)rrs r__iter__zTypeVarTuple.__iter__1 s# # # # # #rruc||_t||t}|dkr||_t ||_dS)NrM)rrrrgrrr)rrrfr}s rrzTypeVarTuple.__init__4 sO DM  " "4 1 1 1iiG---") &t D   rc|jSrrrs rrzTypeVarTuple.__repr__? rrc6t|Srrrs rrzTypeVarTuple.__hash__B rrc ||uSrrrs rrzTypeVarTuple.__eq__E rrc|jSrrrs rrzTypeVarTuple.__reduce__H rrc,d|vrtddS)Nrr>rrs rrzTypeVarTuple.__init_subclass__K s$d"" HIII#"rN)rrrrrrrrArTrrrrrrrrrrr s) ) XN  $ $ $-6 - - - - - ! ! ! ) ) ) ! ! ! ! ! ! J J J J JrrErrcftdt|jtj|S)aReveal 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)printrrr_stderrr s rrErES s0 7c!377cjIIII r_ASSERT_NEVER_REPR_MAX_LENGTHdr,rtct|}t|tkr|dtdz}td|)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. Nz...z*Expected code to be unreachable, but got: )reprr rLAssertionError)rtrs rr,r,p sN(S  u::5 5 58889EAEQ%QQRRRr) eq_default order_defaultkw_only_defaultfrozen_defaultfield_specifiersrQrRrSrTrU.rc &fd}|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. - ``frozen_default`` indicates whether the ``frozen`` parameter is assumed to be True or False if it is omitted by the caller. - ``field_specifiers`` specifies a static list of supported classes or functions that describe fields, similar to ``dataclasses.field()``. At runtime, this decorator records its arguments in the ``__dataclass_transform__`` attribute on the decorated object. See PEP 681 for details. c$d|_|S)N)rQrRrSrTrUr)__dataclass_transform__) cls_or_fnrQrUrTrSrrRs r decoratorz&dataclass_transform..decorator s,(!.#2"0$4 11I - rr)rQrRrSrTrUrrZs`````` rr/r/ sCR          rrB_F)rcF d|_n#ttf$rYnwxYw|S)aHIndicate that a method is intended to override a method in a base class. Usage: class Base: def method(self) -> None: pass class Child(Base): @override def method(self) -> None: super().method() When this decorator is applied to a method, the type checker will validate that it overrides a method with the same name on a base class. This helps prevent bugs that may occur when a base class is changed without an equivalent change to a child class. There is no runtime checking of these properties. The decorator sets the ``__override__`` attribute to ``True`` on the decorated object to allow runtime introspection. See PEP 698 for details. T) __override__rrrss rrBrB s@4 #C   *    D    r)rr{r_Tc neZdZdZedddedejeje de ddfd Z d e de fd Z dS) r0aIndicate that a class, function or overload is deprecated. When this decorator is applied to an object, the type checker will generate a diagnostic on usage of the deprecated object. Usage: @deprecated("Use B instead") class A: pass @deprecated("Use g instead") def f(): pass @overload @deprecated("int support is deprecated") def g(x: int) -> int: ... @overload def g(x: str) -> int: ... The warning specified by *category* will be emitted at runtime on use of deprecated objects. For functions, that happens on calls; for classes, on instantiation and on creation of subclasses. If the *category* is ``None``, no warning is emitted at runtime. The *stacklevel* determines where the warning is emitted. If it is ``1`` (the default), the warning is emitted at the direct caller of the deprecated object; if it is higher, it is emitted further up the stack. Static type checker behavior is not affected by the *category* and *stacklevel* arguments. The deprecation message passed to the decorator is saved in the ``__deprecated__`` attribute on the decorated object. If applied to an overload, the decorator must be after the ``@overload`` decorator for the attribute to exist on the overload as returned by ``get_overloads()``. See PEP 702 for details. rcategoryr+messagerar+rNct|ts$tdt|j||_||_||_dS)Nz2Expected an object of type str for 'message', not )rrrrrrbrar+)rrbrar+s rrzdeprecated.__init__= s^gs++ 2G}}-22#DL$DM(DOOOrrtch |j |j |j _St t rddl}ddlm}j |j  fd}t|_ j t |r: j |j  fd}t|_ n%|j  fd}|_ x_|_ |_Strddl}ddl}ddl}|j  fd}|jr2t(jdkr|j|}n|jj|_ x_|_|St1d) Nr) MethodTypec|urtjdztjur |g|Ri|S|jtjur|s|rt |jd|S)Nrr`z() takes no arguments)r.r/r0rrrr)rrrrtrar< original_newr+s rrz$deprecated.__call__..__new__] sczz cHVWXXXX#6>99+|CA$AAA&AAA88d8f8'3<(N(N(NOOO+|C000rcHtjdz|i|SNrr`r.r/rrrar<original_init_subclassr+s rrz.deprecated.__call__..__init_subclass__q 5 cHVWXXXX55tFvFFFrcHtjdz|i|Srirjrks rrz.deprecated.__call__..__init_subclass__z rmrcHtjdz|i|Srirj)rrrtrar<r+s rwrapperz$deprecated.__call__..wrapper s4M#ZRS^TTTT3////rrzY@deprecated decorator with non-None category must be applied to a class or callable, not )rbrar+__deprecated__rrrktypesrerwraps staticmethodrr classmethodrasyncio.coroutinesr coroutinesiscoroutinefunctionr_rmarkcoroutinefunction _is_coroutiner)rrtrkrerrasynciorrprar<rlrgr+s ` @@@@@rrzdeprecated.__call__N s,C}HJ%(" C&&C     ,,,,,,"{  .. 1 1 1 1 1 1 1 1/. 1+733 ),)>&4jAA>-C-L*$Y_%;<<GGGGGGG=<G-88I,J,JC))%Y_%;<<GGGGGGG=<G->C)>AA"W%;36!0 # ))))     %%0000000&%0%99#>>Q'722"?'"?"H"H070B0P->AA"W%;80388r)rrrrr0rrrnrWarningrrr^rrrrr0r0 s( ( \?Q  ) ) ) ) ofk'&:;  )   ) ) ) ) )"L L "L L L L L L rr0cZ|dup't|ttttfSN.)rrr r rrss rrr s.cz Z %y*BC   rcp|dup2t|ttttt jfSr~)rrr r rrrss rrr s9cz  Z (/     rc tj|rkt|tjrQt |jdkr9t|jdtr|rt|dsdS|st|d|tur=t|dr|jst|dt |j}t |}||kr|}t|drd|jD}td|D}|dkr |||z krdS||krHt||dtturdStd |D}||z}d |}t jd krd nd }td||krdndd|d|d|d| dS)Check correct count for parameters of a generic cls (internal helper). This gives a nice error message in case of count mismatch. rrNr?rc0g|]}t||Srrrs r z"_check_generic.. #QQQA:a==QaQQQrc3@K|]}t|tVdSr)rrrs rr=z!_check_generic.. s,#T#TAJq,$?$?#T#T#T#T#T#Trrxc3PK|]!}t|dttuV"dSrxNrrTrs rr=z!_check_generic.. R)O)O>?*1M9)M)M09*:)O)O)O)O)O)Orr>r argumentsrr@rArB z for rDrE)risclassrrr`r rrr rrr-rsumrrTr_r)rrelenr expect_val num_tv_tuplesnum_default_tvthingss r_check_genericr sv OC  ZV^%D%D C&''1,,3-a0)<<--#:a=11- F =s;;;<< < 7??3 011 A9K A3 ? ? ?@@@s)**D: 4<<Js,-- 4QQ);QQQ ##T#T#T#T#T T T !A%%DD=4H,H,HF$;; 4 0-KK())%()O)OCM)O)O)O&O&ONN*D!3T!3!3J$'$4$?$?[[\FPTD[[66ePPfPP$'PP26PPCMPPQQ Q7 . rrrxNc3PK|]!}t|dttuV"dSrrrs rr=z!_check_generic.. rrr>r@rArBrCrDrE)rr rrrrTr)rrrrrrs rrr sN  =s;;;<< <: 4<<Js,-- 4QQ);QQQ $;; 4 0-KK())%()O)OCM)O)O)O&O&ONN*D!3T!3!3JPTD[[66ePP$'PP26PPCMPPQQ Q/ .] sLLLAQe^^a^^^r)rrrrrr&rrTrrrrrrr) rr typevar_typesenforce_default_orderingdefault_encounteredtype_var_tuple_encounteredrrwr collectedrs @rrr7 s  "NM$F#G#G #&+" 4 4A(++ -1**1m,, 5?<5P5P UNN+ R")!]I"F"Fi"WK"R5E"+-D#E#EE.2++,R')Q!)Q)Q)QRRR Q.q11 4 LLLL)9LLLMMMMAu%% 444A%7%<%<44 $E11!LL3334U||rcxg}t}d}d}|D]}t|trt|tr2|D].}t |gD]}||vr||/`t |drf||vra|rJt|dttu}|r|rtd|rd}n|rtd|d||t|rd}t|dd D]}||vr||t|S) zCollect all type variables and parameter specifications in args in order of first appearance (lexicographic order). For example:: assert _collect_parameters((T, Callable[P, T])) == (T, P) F__typing_subst__rxrTrrrr) rrrr_collect_parametersrrrrTrr) rrrrrrrrrws rrri s $F#G#G #&+"" -" -A!T""! -Au%% -99A%8!%=%=99 $J66&--i88899.// -J&&/ V#A}i@@ Q$6E+E"+-D#E#EE'V26//0V"+-Ua-U-U-U#V#VV%%a(((,Q//615. $4b99--A **"))!,,,-Z   rcd|D}d|D}tj||||}|x|_|j_|S)Ncg|]\}}|Srrr;rrs rrz!_make_nmtuple.. s&&&1!&&&rc Hi|]\}}|tj|d|d S)zfield z annotation must be a typer8rs rrz!_make_nmtuple.. sG***1a&,Q0V0V0V0VWW***rr(r)r namedtuplerSr)rrrrr(r2r[nm_tpls r _make_nmtupler sm&&&&&**#(*** 'f19&JJJBMM!? r>rrrSceZdZdZdS)_NamedTupleMetac <t|vsJ|D](}|tur|tjurtd)t d|D}dvr d}ndvrdd}ni}g}|D]^}|vr|||r@td|dt |dkrdnd d d |_t|| fd |Dd }||_ tj|vr^ttdrttj |_n*tjjj} t| |_ D]\} } | t vrt#d| z| t$vr| |jvrt)|| |  t+| j} | | || m#t.$rX} dt+| jd| d|}t2jdkr| |t9|| d} ~ wwxYw#t"$rYwxYwtj|vr||S)Nz3can only inherit from a NamedTuple type and Genericc3:K|]}|turtn|VdSr) _NamedTupler)r;rZs rr=z*_NamedTupleMeta.__new__.. s0SST4;#6#6%%DSSSSSSrrSrrzNon-default namedtuple field z cannot follow default fieldsrrrc g|] }| Srr)r;rrs rrz+_NamedTupleMeta.__new__.. s777A"Q%777rrr_generic_class_getitemz&Cannot overwrite NamedTuple attribute zError calling __set_name__ on z instance z in r)rrr`rrrr rrrrrrur__class_getitem__r_prohibited_namedtuple_fieldsr_special_namedtuple_fields_fieldsr2r __set_name__ BaseExceptionrr_radd_note RuntimeErrorr)rr1rrrZrr default_names field_namer class_getitemkeyr4set_namerr<s ` rrz_NamedTupleMeta.__new__ sy%'''' O O{**t6>/I/I#MOOOSSUSSSSSE B&&,-2%%*>*1--M# C C ##!((4444"C#%BJ%B%B.1-.@.@1.D.Dss"%B%B(,yy'?'?%B%BCCCC #%++--7777777,'F %F ~&&6#;<<J/:6;X/Y/YF,,$*N$D$MM/:=/I/IF,HHJJ ? ?S777()QTW)WXXX :::&.00RW555?#'99#9?$HS&#6666,???!DcAS!D!D,/!D!D7?!D!D  #/7:: ! 3 %&23&7&7Q >? * ;4~&&((***Ms+!I)6 H I&AI!!I&) I65I6N)rrrrrrrrr s(C C C C C rrrc(t|vsJtfSr)rr)rs r_namedtuple_mro_entriesr sU""""~rc |tur|rd}d}nLd}d|d|d}d|zdz}n8|%|rtd d }d|d|d}d|zdz}n|rtd |tus|Etj||d t d|}t||t}tf|_ |S)aoTyped version of namedtuple. Usage:: class Employee(NamedTuple): name: str id: int This is equivalent to:: Employee = collections.namedtuple('Employee', ['name', 'id']) The resulting class has an extra __annotations__ attribute, giving a dict that maps field names to types. (The field names are also in the _fields attribute, which is part of the namedtuple API.) An alternative equivalent functional syntax is also accepted:: Employee = NamedTuple('Employee', [('name', str), ('id', int)]) z3Creating NamedTuple classes using keyword argumentszq{name} is deprecated and will be disallowed in Python {remove}. Use the class-based or functional syntax instead.r'r)z = NamedTuple(z, [])`z{name} is deprecated and will be disallowed in Python {remove}. To create a NamedTuple class with 0 fields using the functional syntax, pass an empty list, e.g. rNz\Cannot pass `None` as the 'fields' parameter and also specify fields using keyword argumentsr(zIEither list of fields or keywords can be provided to NamedTuple, not bothz3.15)rr rIr*r) r-rr.r/r r0rrrgrr)r1r2rr4r6r5nts rrr sn( W   "#X H  $X HhHHhHHH0 # " #" ^ "F $N HhHHhHHH0 # " #"  HGHH H W   M&&, > >'M rceZdZdZdS)raBase class for classes that implement the buffer protocol. The buffer protocol allows Python objects to expose a low-level memory buffer interface. Before Python 3.12, it is not possible to implement the buffer protocol in pure Python code, or even to check whether a class implements the buffer protocol. In Python 3.12 and higher, the ``__buffer__`` method allows access to the buffer protocol from Python code, and the ``collections.abc.Buffer`` ABC allows checking whether a class implements the buffer protocol. To indicate support for the buffer protocol in earlier versions, inherit from this ABC, either in a stub file or at runtime, or use ABC registration. This ABC provides no methods, because there is no Python-accessible methods shared by pre-3.12 buffer classes. It is useful primarily for static checks. N)rrrrrrrrrK s    rr9c |jd|jS#t$r&t dt |jdwxYw)aReturn the class's "original" bases prior to modification by `__mro_entries__`. Examples:: from typing import TypeVar, Generic from typing_extensions import NamedTuple, TypedDict T = TypeVar("T") class Foo(Generic[T]): ... class Bar(Foo[int], float): ... class Baz(list[str]): ... Eggs = NamedTuple("Eggs", [("a", int), ("b", str)]) Spam = TypedDict("Spam", {"a": int, "b": str}) assert get_original_bases(Bar) == (Foo[int], float) assert get_original_bases(Baz) == (list[str],) assert get_original_bases(Eggs) == (NamedTuple,) assert get_original_bases(Spam) == (TypedDict,) assert get_original_bases(int) == (object,) rz"Expected an instance of type, not N)rVrcrrrrrrs rr9r9i sf* <##$4cmDD D   KT#YY5GKK  s "0AcVeZdZdZdZdZdZdZdZe j dkrdZ d Z d Sd S) r@aLNewType creates simple unique types with almost zero runtime overhead. NewType(name, tp) is considered a subtype of tp by static type checkers. At runtime, NewType(name, tp) returns a dummy callable that simply returns its argument. Usage:: UserId = NewType('UserId', int) def name_by_id(user_id: UserId) -> str: ... UserId('user') # Fails type check name_by_id(42) # Fails type check name_by_id(UserId(42)) # OK num = UserId(5) + 1 # type: int c|Srrrs rrzNewType.__call__ rrc||_d|vr|dd}||_||_t }|dkr ||_dSdS)NrrRrM)r rpartitionr __supertype__rgr)rrrr}s rrzNewType.__init__ s` $D d{{s++B/ DM!#D iiG---").-rc6|jGfdd}|fS)NceZdZfdZdS)&NewType.__mro_entries__..Dummyc D|j}td|d|dd)NzGCannot subclass an instance of NewType. Perhaps you were looking for: `z = NewType(rz)`)rr)r subcls_name supercls_names rrz8NewType.__mro_entries__..Dummy.__init_subclass__ sU"%,K#W'WW4?WWERWWWrN)rrrr)rsrDummyr s.rrr)rrrrs @rrzNewType.__mro_entries__ sG!MM          8Orc$|jd|jS)Nr)rrrs rrzNewType.__repr__ so;;(9;; ;rc|jSr)rrs rrzNewType.__reduce__ s $ $rrc*tj||fSrrrs rrzNewType.__or__ s|D%K00rc*tj||fSrrrs rrzNewType.__ror__ s|E4K00rN) rrrrrrrrrr_rrrrrrr@r@ s     * * *     < < < % % %  w & & 1 1 1 1 1 1 1 1 ' &rr@c|dup$;*S# $ 3## rcn|dup1t|ttjtjt fSr)rrrrrrJr s rrr s8$;*S#  3## r> rrrrr3rrr __reduce_ex__rrr(ceZdZdZdS)_TypeAliasGenericAliasct|tvrt||St|j|Sr) _ATTRIBUTE_DELEGATION_EXCLUSIONSr0rrr3)rr#s rrz"_TypeAliasGenericAlias.__getattr__ s6;;;!--dD999t555rN)rrrrrrrrr s# 6 6 6 6 6rrceZdZdZdddefdZdededdffd Zdedefd Z dedefd Z defd Z e j d krddZdZdZdZdZdZe j dkr dZdZxZSxZS)rJaCreate named, parameterized type aliases. This provides a backport of the new `type` statement in Python 3.12: type ListOrSet[T] = list[T] | set[T] is equivalent to: T = TypeVar("T") ListOrSet = TypeAliasType("ListOrSet", list[T] | set[T], type_params=(T,)) The name ListOrSet can then be used as an alias for the type it refers to. The type_params argument should contain all the type parameters used in the value of the type alias. If the alias is not generic, this argument is omitted. Static type checkers should only support type aliases declared using TypeAliasType that follow these rules: - The first argument (the name) must be a string literal. - The TypeAliasType instance must be immediately assigned to a variable of the same name. (For example, 'X = TypeAliasType("Y", int)' is invalid, as is 'X, Y = TypeAliasType("X", int), TypeAliasType("Y", int)'). r) type_paramsrct|tstdt|tstd||_||_d}g}|D]}t|t ttfrt|rtd|t|dttu}|r|std|d|rd}t|tr| || |t||_t}|d kr||_||_dS) Nz#TypeAliasType name must be a stringztype_params must be a tupleFzExpected a type param, got rxznon-default type parameter 'z ' follows default type parameterTrM)rrrr __value____type_params__rrr rrrTrrrrgrr) rrrrdefault_value_encounteredrryrwr}s rrzTypeAliasType.__init__sdC(( G EFFFk511 ? =>>>"DN#.D (- %J) 2 2 ":y/QRRR"*-- R $$P*$P$PQQQJ yAAR-G[G#%F:%F%F%FGGG504-j,772%%j1111%%j1111"' "3"3D iiG---") DMMMrrrNct|dr||t||dS)Nr)r_raise_attribute_errorrr1)rrrrs rr1zTypeAliasType.__setattr__<sItZ(( 2++D111 GG  e , , , , ,rc0||dSr)rrrs r __delattr__zTypeAliasType.__delattr__As  ' ' - - - - -rc|dkrtd|dvrtd|dtd|d)Nrzreadonly attribute>rrrrz attribute 'z3' of 'typing.TypeAliasType' objects is not writablez0'typing.TypeAliasType' object has no attribute '')rrs rrz$TypeAliasType._raise_attribute_errorDsrz!!$%9:::YYY$&$&&& %NtNNNrc|jSrrrs rrzTypeAliasType.__repr__Rrrrrc|durdS|dSt|trdkrfd|DStj|djdS)N.rcBg|]}|dzS)r_check_single_param)r;rt recursionrs rrz5TypeAliasType._check_single_param..^s=... #!44S)A+FF...r Subscripting  requires a type.)rr rr9r)rrrs` `rrz!TypeAliasType._check_single_paramVsC<<3=4eT**.yA~~.....',....)Ot}OOOrctjdkrtfd|DStfd|DS)Nrc3BK|]}|VdSrrr;rrs rr=z2TypeAliasType._check_parameters..fsE,,T22rc3TK|]"}tj|djdV#dS)rrN)rr9rrs rr=z2TypeAliasType._check_parameters..jsY +NdmNNNr)r_rrrs` r_check_parameterszTypeAliasType._check_parametersds')) *!+ rc8|jstdt|ts|f}tjdkrt j||St|}| |}t||}|j |kr||_ |S)Nz+Only generic type aliases are subscriptabler) rrrrr_rrrrrrr)rr type_varsrs rrzTypeAliasType.__getitem__ps' O MNNNj%00 +(] 7***4<<<*:66I// ;;J*4<>> from typing_extensions import Protocol, is_protocol >>> class P(Protocol): ... def a(self) -> str: ... ... b: int >>> is_protocol(P) True >>> is_protocol(int) False roF)rrrrCrrBs rr=r=sH r4  *NE22 *(" *&/)  rct|st|dt|drt|jStt |S)aReturn the set of members defined in a Protocol. Example:: >>> from typing_extensions import Protocol, get_protocol_members >>> class P(Protocol): ... def a(self) -> str: ... ... b: int >>> get_protocol_members(P) frozenset({'a', 'b'}) Raise a TypeError for arguments that are not Protocols. z is not a ProtocolrO)r=rrrrOr\rBs rr:r:sd2 9r77788 8 2+ , , 4R233 3,R00111rr1cJeZdZdZdeddfdZdefdZdefdZde de fd Z dS) r1afDefine the documentation of a type annotation using ``Annotated``, to be used in class attributes, function and method parameters, return values, and variables. The value should be a positional-only string literal to allow static tools like editors and documentation generators to use it. This complements docstrings. The string value passed is available in the attribute ``documentation``. Example:: >>> from typing_extensions import Annotated, Doc >>> def hi(to: Annotated[str, Doc("Who to say hi to")]) -> None: ... documentationrNc||_dSrr)rrs rrz Doc.__init__s!.D   rcd|jdS)NzDoc()rrs rrz Doc.__repr__s1$,111 1rc*t|jSr)rrrs rrz Doc.__hash__s*++ +rrcZt|tstS|j|jkSr)rr1rrrs rrz Doc.__eq__s+eS)) &%%%)<< .fsM"U*UC"8"8Vf>OPU>V>VrTr`rrci|] }|j| Srr)r;rs rrz#get_annotations..sEEEeneEEErchi|].\}}|t|ts|nt|/Sr)rreval)r;rrrrs rrz#get_annotations..sO,,,U#E3// QEET%&5Q5Q,,,r)r5rrdr rrrrrcrGetSetDescriptorTyper_modulesrvarsrdrVrrSrrrr`rkpartialrra)rrrrr obj_dictann obj_globals module_namer obj_localsunwrapr return_values `` rr6r6smJ V3 3 3M   Yfl22WXX X c4 $ MsJ55H GHe44 ll#4d;;c6#>??CK!#|T::K Dd;;D")&*d"C"CKd3iiJFF V. / / M#0$77C,KJFF c]] M#0$77C!#}d;;KJFF S+ , , M%C04 4K 4*vvsKKKLL L ;I#t$$ TRRRSS S I &&&)iikk99    6=11#/Ffi&788#[Fv}-- 1$0 ?!G >%2F "#'8"== =; OEEEEENF,,,,,!iikk,,, rr2rrrrcv|jr|jSt|dd- |jj}d|_||_|S#t $rYnwxYw|t|dd}|Et|dd4tt j|j ddd}|t|dd}|t|trGt|dd}|r3t j|d}|rt|dd}nLt|tj rt|dd}n t|rt|dd}|i}|9i}t|tr"|t!|||t|dd}|Wt#|}t#|}|D]6}|j} t&r|jr| |vr||| <|| d7|j} | rgt1j| sS| |vr || }n^| |vr || }nQt5t6| rtt6| St9| |j} t=| ||}d|_||_|S) N__cell__T __owner____forward_module__rVrarr)__forward_evaluated____forward_value__rr- cell_contentsrdr_r!rcr/rrrrdrrr"rr_FORWARD_REF_HAS_CLASSr}r__forward_arg__ isidentifierkeyword iskeywordrbuiltins NameError__forward_code__r) forward_refrrrrrr'rr param_namertcodes r_eval_with_ownerr>s  , 10 0 ; D 1 1 = #,:59 105 -      =Kd;;E O %94@@L  >EEzSWG ?k=$??G ?%&& >%e\4@@ D [__[$??FD")&*d"C"CE6#455 >!%T::% >!%== ?G >F%&& + d5kk***  5#4"%):DAAK  "7mmG&\\F$ 1 1"^ *13>3S1w..*/GJ'JJz4000)      0g&7&<&< 0f}}s  3'' %x---nn$/Dw//E,0 )(- % s = A  A )rrrrr _recursive_guardc |tjkr|jS|j|vr|S t|||||}n##t$r|tjkr|cYSwxYwt |trt|}t |tr)t|ddd}t|||||||Stj dkr-|r+|rt|ni}|D]}|j|vr |||j<tj dkr!tj|||||jhzStj||||||jhzS)aEvaluate a forward reference as a type hint. This is similar to calling the ForwardRef.evaluate() method, but unlike that method, evaluate_forward_ref() also: * Recursively evaluates forward references nested within the type hint. * Rejects certain objects that are not valid type hints. * Replaces type hints that evaluate to None with types.NoneType. * Supports the *FORWARDREF* and *STRING* formats. *forward_ref* must be an instance of ForwardRef. *owner*, if given, should be the object that holds the annotations that the forward reference derived from, such as a module, class object, or function. It is used to infer the namespaces to use for looking up names. *globals* and *locals* can also be explicitly given to provide the global and local namespaces. *type_params* is a tuple of type parameters that are in scope when evaluating the forward reference. This parameter must be provided (though it may be an empty tuple) if *owner* is not given and the forward reference does not already have an owner set. *format* specifies the format of the annotation and is a member of the annotationlib.Format enum. r+r/TN)rrrrr?r )rr)recursive_guard)r5rr4r>r9rrrr]rr2r_rrrrre) r;rrrrr r?rtvars rr2r2s@ V] " ". .  &*: : :  $' EE   ***""""   eS ! ! &u%%E eZ ( ( u2D99E'(!1&    j ( ([ (%+3T&\\\F# 1 1=..,0F4=)  j ( ($ 0K4O3P P  $ 0K4O3P P  s9AAceZdZdZ d dedejefdZdZe j dkrdZ e j d krd Z d Z d ZdS)rDzCreate a unique sentinel object. *name* should be the name of the variable to which the return value shall be assigned. *repr*, if supplied, will be used for the repr of the sentinel object. If not provided, "" will be used. NrrOc2||_||nd|d|_dS)N<>)r_repr)rrrOs rrzSentinel.__init__Gs'  !-TT;t;;; rc|jSr)rHrs rrzSentinel.__repr__OrrrcJtt|jd)Nz object is not callablerrrrps rrzSentinel.__call__Us"tDzz2MMMNN Nrrc*tj||fSrrrs rrzSentinel.__or__Ys<e , ,rc*tj||fSrrrs rrzSentinel.__ror__\s<t , ,rcLtdt|jd)NzCannot pickle z objectrKrs r __getstate__zSentinel.__getstate___s%Gd)<GGGHHHrr)rrrrrrrnrrr_rrrrrOrrrrDrD>s&*???oc"???? '!! O O O 7"" - - - - - -IIIIIrrD)#rVrWrXrYrZr[r\r^rarbrcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzrNcdi|]-}tt||tt|.Sr)rrr)r;rs rrrs3TTTTgfd>S>STT764 TTTr)rr])rI)NNF)NNr)r)rjr8rcollections.abcrLenumrkrior6rPr_rrrrr.rr__all__PEP_560r GenericMeta_PEP_696_IMPLEMENTEDr]rr3rr-rrPrrrrrrrrr_Finalrrr r4r<r?rrrrrrrrAr3r. defaultdictr#rrrrrrrrrr rrrHrNrrrr_r$r&r]rJrnrrKryrEXCLUDED_ATTRIBUTESrWr\rgrCrmrqrurwrurr`rGrFr'r%r$r#r&r"r(r)r*_NEEDS_SINGLETONMETArrTrrUr_PEP_728_IMPLEMENTEDr!rr> signaturer9rrrrr>r8r:rAr-r;rHr^rYr8r7rIrzr~rrr r rr r rrrr rr rrLrMrKrr rrOrRrSrQr$rrr"r&rrrErLr,r/rurvrYrBr[r0r^rrrrrrrrrr _prohibitedrrrrrrrABCregister memoryview bytearrayrr9r@rJrrrr=r:r^rr1 _CapsuleType_socket_CAPI ImportErrorrrr5r6IntEnumr r2r>rD _typing_namesrrr+rrrris     wA A A H  '+==063D3NN  )++w    JJJ ?FN3V^DV^Dv~f--- 6>*D 9 9 9w & & & & &4 & & & 9 9 9 9 9 9 9 9 9 ? (/(/(/(/(/6=(/(/(/(/\11111V01111  w LEE @   z!!nGG H H H H Hv34 H H H H:::::-T::::<l 1 2 2 2G( 76?##?#H(M,OO10 +1488&&&P 7 7 7### {     $ $    . ? {$ )))UUUUUUUUUUUUU===&*&*&*&*&*v:$&*&*&*&*PT I$$!1 9/EI*)&YLN*)) /$') N /.. "/$') ,-JK" )F677;;;       wHH<<<<@@@BBB&b&b&b&b&b&V_--b&b&b&H[0(((((6>]((((,w0111j w$K(M,O(M(M$K(MMh(htn 72x \WWR22 \ YF YFF$  \ \ \ \ \(# \ \ \  $$$KGGFN,K,K(K 76; II     -     I 76>""&LL " " " " "] " " " "$#%%L r0 I*N&LL 1 1&2D E E PPM*e.e.e.e.e.e.e.e.Nnk2rBBJ;;;z!!!!! D!!!!2< < < |-~> 0 0 0 76=!!$KK     76:C1*NN0'>'>'>'>RT I21212121lBQB7"""JHH0, 76;8 II 8 8 8%%% )))CCCCCtCCC 'Y#Y#Y#Y#Y#Y,#Y#Y#Y#YN 76?##;7(M,OO77777 777.77777*7770Z        WV[!!V+[+[+[+[+[.+[+[+[+[+[bbbbbbD-bbbLwv}%%` 76? + + - 5      , r3r3r3r3r34r3r3r3r3l &> '!!     v'Fd    ,0 7 7 7w$KK 6 6 6 76;13 II,3,3,3` 768+3 ]FF&3&3&3T 76:3HH.d 33]30 76?##8(MM88\8& 7668 ;DD88\8" 7678 LEE88\84 76:'3H$KK333&333" 76:3HH333&' Tw ]F))))'''''34'''' -----v+4----6+++---OJ####### WV^$$LJ;F;F;F;F;F!1;F;F;F;F;F|KJKJKJKJKJ}KJKJKJ\ 76=!!$KK!( 76233($*$H!!$'! 76>""S&LLS%SuSSSS4w 4 # %$ SSSSS S  S !, LVZ0&/#vz/2RR S   S*S !a SSSSl 76:&HH FOCO$D E E EB!b!!!!!Jz!!$JJ   BGGGGGGGGRg       (wv~&&XQ-43Q3Q3Q3Q3Qn Q Q QD+*F[D[[[[&$WWV^T%J%JKD 76'((l9....`!3F6!6!6!p 9%8"w"JJ%+$6!!*+X+X+X!Y!YDDDDD$DDDL,, b"EEK%,????B"9J 7;?H%% _ #FF        * OOJ OOI OOE 76'((2>wnGG9191919191919191xw(MM 7""        '!!,59 6 6 6 , , ( 6 6 6 6 6V%9 6 6 6 6^0^0^0^0^0^0^0^0B 76=!!+2$K!6  D    *22V-=c-B2222* 765 = *CC========@wv}d33 '..  4;;L      K NN=!!!v555555555 )-TE%|D 76)**r!6#D4VVVVVv"VVVVVr"I"I"I"I"I"I"I"IP&&& N TT]TTT .     s-t tt