hc ddlZddlZddlZddlZddlZddlZddlZddlZddlZ ddl Z ddl Z gdZ dZ eZejdkZGddZeZejdkrdZnejd krd Znd Ze jZe jd Ze jd Ze jdZe jddZe jddZejdkrddl mZnGddeZGddeZe jZGdde jdZ e j!Z!ejdkre j"Z"ndZ"dZ#ejdkre j$Z$n7d Z%d!Z&Gd"d#e j'dZ(Gd$d%e dZ)e)d&'Z$e j*Z*e+e d(re j,Z,e j-Z-e j.Z.n-ej/ej0ej/e1Z2d)Z,d*Z-d+Z.e j3Z3e j4Z4e j5Z5e j6Z6e j7Z7e j8Z8e j9Z9e j:Z:e j;Z;e j<ZZ>ejdkr dd,l m?Z?m@Z@mAZAmBZBnd-ZCeDe d.e j'ZEGd/d.eEdZFedZGeFejjBd0eGeGf1ZBeFejj@d2eGf1Z@eFejHd2d3e jIeJf4ZAeFejKd2d5e jIeJf4Z?gd6d7d8gd9gd:ZLeMe jNhd;zZOd<ZPdd=ZQejd>kre jRZRnFdd?ZSd@ZTdAZUGdBdCee jRZVeWdDZXGdEdFe jYeVZRejd>kre jZZZndGZZeZZ[ejdHkr2e j\Z\e j]Z]e j^Z^e j_Z_e j`Z`e jaZae jbZbneZGdIdJeRZ\eZGdKdLeRZ]eZGdMdNeRZ^eZGdOdPeRZ_eZGdQdReRZ`eZGdSdTeReZaeZGdUdVeReZbdWZcdXZdedre jeZee jfZfe jgZgn|dYejhe jijjvZkdZZlGd[d\eZfemefd]d^iZnecd_efddXd`daZee+e d\r e jfeffZoneffZodbZge+e dcre jpZpnddZpe+e dere jqZqndfZrddgZqe+e dhre jsZse jtZtn"Gdidje j'dZtGdkdhZsejdd2dkre juZue jvZvn: ddll mwZwn#ex$r e j'ZwYnwxYw ddml myZzn#ex$r e j'ZzYnwxYwdnZudoZve+e dpre j{Z{n,ejdd2d kr e dqZ{n e dpdr'Z{e+e dsre j|Z|n)GdtdueZ}Gdvdwe}Z~e~Z|[~[}dxZdyZGdzd{ZGd|d}eZerdd~l mZnGddeZe+e dre jZe jZn)GddZGddeZGddeZerddl mZn+e+e drGddeZnGddeeZe+e dsGddeZe jdZe+e dre jZe jZnkre jZnWddZe jZeMhdZGddeZemedd^iZdZeceefdZe+ejd9r ejjZnRGdd9ejZeeeeeee+e dre jZndZejdkre jZn GddZe+e dre jZndZGddZe+e dre jZe jZndedeJfdZdede jefdZe+e dre jZn GddZeDe ddZeʀ+ ddlZeDeddZé ee̦Zn #ex$rYnwxYweʁeZe de jZe jZe jZe jZe jZe jZe jZe jZe jZe jYZYe jZe jZe jZe jZe jZe jZe jZe jZe jZe jZe jZe jZe jZe jIZIe jZe jZe jZe jZe jZe jZe jZe jZe jZe jZe jZe jZdS)N)mAnyClassVar ConcatenateFinal LiteralString ParamSpec ParamSpecArgsParamSpecKwargsSelfTypeTypeVar TypeVarTupleUnpack Awaitable AsyncIterator AsyncIterable CoroutineAsyncGeneratorAsyncContextManagerBufferChainMapContextManagerCounterDeque DefaultDict NamedTuple OrderedDict TypedDict SupportsAbs SupportsBytesSupportsComplex SupportsFloat SupportsIndex SupportsInt SupportsRound Annotated assert_never assert_typeclear_overloadsdataclass_transform deprecatedDoc get_overloadsfinalget_args get_originget_original_basesget_protocol_membersget_type_hintsIntVar is_protocol is_typeddictLiteralNewTypeoverloadoverrideProtocol reveal_typeruntimeruntime_checkableText TypeAlias TypeAliasType TypeGuardTypeIs TYPE_CHECKINGNeverNoReturnReadOnlyRequired NotRequired AbstractSetAnyStrBinaryIOCallable Collection ContainerDict ForwardRef FrozenSet GeneratorGenericHashableIO ItemsViewIterableIteratorKeysViewListMapping MappingViewMatchMutableMappingMutableSequence MutableSet NoDefaultOptionalPattern ReversibleSequenceSetSizedTextIOTupleUnion ValuesViewcast no_type_checkno_type_check_decoratorT) rbetaceZdZdZdS) _SentinelcdS)Nz selfs }/builddir/build/BUILD/imunify360-venv-2.5.2/opt/imunify360/venv/lib/python3.11/site-packages/pip/_vendor/typing_extensions.py__repr__z_Sentinel.__repr__s|N__name__ __module__ __qualname__rzrvr{ryrtrts#r{rtrp cdt|tjtjtjfSN) isinstancetyping _GenericAlias_types GenericAlias UnionTypets ry_should_collect_from_parametersrs) $f&96;KL   r{rp cNt|tjtjfSr)rrrrrrs ryrrs!f2F4GHIIIr{cFt|tjo|j Sr)rrr_specialrs ryrrs!V122E1:~Er{TKTVTT_co) covariantT_contra) contravariant)rp )rc(eZdZfdZfdZxZS)_AnyMetacv|turtdt|S)Nz6typing_extensions.Any cannot be used with isinstance())r TypeErrorsuper__instancecheck__)rxobj __class__s ryrz_AnyMeta.__instancecheck__s3s{{ XYYY77,,S11 1r{cZ|turdStS)Nztyping_extensions.Any)rrrz)rxrs ryrzz_AnyMeta.__repr__s(s{{..77##%% %r{)r}r~rrrz __classcell__rs@ryrrsQ 2 2 2 2 2  & & & & & & & & &r{rc"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 ryrz Any.__new__sAczz <==="577?3888888 8r{)r}r~r__doc__rrrs@ryrrsB   9 9 9 9 9 9 9 9 9r{r) metaclassceZdZdZdS)_ExtensionsSpecialFormcd|jzSNztyping_extensions._namerws ryrzz_ExtensionsSpecialForm.__repr__s#dj00r{Nr|rvr{ryrrs#11111r{r)_rootcF 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__AttributeErrorr)fs ryr.r.s>, AKK *    D     c*tj|Sr)rr )names ryr4r4s >$  r{)rprcg}|D]G}t|tr||j2||Ht |S)zJAn internal helper for Literal creation: flatten Literals among parameters)r_LiteralGenericAliasextend__args__appendtuple) parametersparamsps ry_flatten_literal_paramsrsa ! !A!122 ! aj)))) a    V}}r{c#:K|D]}|t|fVdSr)type)rrs ry_value_and_type_iterrs8  AT!WW*      r{ceZdZdZdZdS)rct|tstStt |j}tt |j}||kSr)rrNotImplementedsetrr)rxotherthese_args_dedupedother_args_dedupeds ry__eq__z_LiteralGenericAlias.__eq__sYe%9:: &%%!$%9$-%H%H!I!I !$%9%.%I%I!J!J %);; ;r{c^ttt|jSr)hash frozensetrrrws ry__hash__z_LiteralGenericAlias.__hash__s# "6t}"E"EFFGG Gr{N)r}r~rrrrvr{ryrrs7 < < < H H H H Hr{rc eZdZdefdZdZdS) _LiteralFormdocc0d|_|x|_|_dS)Nr7)r_docr)rxrs ry__init__z_LiteralForm.__init__!s"DJ'* *DI r{ct|ts|f}t|}tt |} t |}t |t |krVg}|D]6}||vr0||d||7|r J|t|}n#t$rYnwxYwt||S)Nr) rrrlistrrlenrremoverr)rxrval_type_pairs deduped_pairsnew_parameterspairs ry __getitem__z_LiteralForm.__getitem__%sj%00 +(] 0< + + + + + : : : : :r{ra 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.)rr-ct|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_registryr~r__code__co_firstlinenor_overload_dummy)funcrs ryr9r9Zsn< 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)rr~rrrvalues)rrmod_dicts ryr-r-sg D*d + + <1 1 1I%al3 > ) )IHQ^,3355666r{c8tdS)z$Clear all overloads in the registry.N)rclearrvr{ryr)r)s  """""r{)rrrrScV|do|dS)N__) startswithendswith)attrs ry _is_dunderrs%t$$<t)<)<_instrrrr) rrraddrobject __setattr__setattrr)rxrval allowed_attrss ryr z _SpecialGenericAlias.__setattr__sGGGM*f.BBB!!,///$ 44=#8#8""4s33333s33333r{c 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 ry z3_SpecialGenericAlias.__getitem__..s0FF!6-a55FFFFFFr{ at least  is not a generic classToo manyfew arguments for ; actual , expected )rrrrrrr copy_with)rxr actual_lenexpectedrs @ryrz _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{) r}r~rrr r _tp_cacherrrs@ryrrsw48tb & & & & & & & 4 4 4   * *   * * * * *r{rp)rr)rrr) rMrrXrYrrUrhrOrNrerAbstractContextManagerAbstractAsyncContextManagerr)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>rTr;__annotations___abc_)r__mro__r}r__dict__r_EXCLUDED_ATTRSr)rattrsbase annotationsrs ry_get_protocol_attrsr3s EEE CRC    =3 3 3 d$5r:: 2dm2k22  DOOG,, _1L1L $  Lr{c tj|jddS#tt f$rYdSwxYw)Nr}__main__)sys _getframe f_globalsgetr ValueErrordepths ry_callerr=sQ}U##-11*jIII J 'tts,/AArprqc$t|dvS)zAllow instance and class checks for special stdlib modules. The abc and functools modules indiscriminately call isinstance() and issubclass() on the whole MRO of a user class, which may contain protocols. >Nabc functools)r=r;s ry_allow_reckless_class_checksrBs u~~!;;;r{cLt|jrtddS)Nz Protocols cannot be instantiated)r _is_protocolrrxrrs ry_no_initrF%s/ :: " @>?? ? @ @r{cNt|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 ry_type_check_issubclass_arg_1rJ)s2#t$$ B@AA A B Br{c8eZdZdZdZdZdZdZdefdZ dS) _ProtocolMetac |dkrt|dkrnttjht|zrs|D]p}|ttjttjhvsH|jt|j gvs!t|std|qtj j||||fi|S)Nr;r!z5Protocols can only inherit from other protocols, got )rr;rrrrTr}_PROTO_ALLOWLISTr9r~r5rr@ABCMetar)mclsrbases namespacerr1s ryrz_ProtocolMeta.__new__Csz!!c%jj1nnFO,s5zz9 !  D6? SSS=,<,@,@RT,U,UUU&t,,V(,#',,;&tT5)NNvNN Nr{ctjj|g|Ri|t|ddrt ||_dSdS)NrDF)r@rOrrr3r'rrrs ryrz_ProtocolMeta.__init__Ss\ K  6t 6 6 6v 6 6 6sNE22 B).s&&L&LqH}&L&L&L&L&L&Lr{rX) r__init_subclass__r.r9any __bases__rDr[rXrr;rFrs ryrozProtocol.__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{) r}r~rrr;r __slots__rDrVrorrs@ryr;r;sR/)  $ ( ( ( ( ( ( ( ( (r{r;ct|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! rDFz@@runtime_checkable can be only applied to protocol classes, got T)rp r!Nz,Failed to determine whether protocol member z is a method member) issubclassrrTrrrVrrLr6 version_inforr(r'callabler Exception)rr is_callablees ryr>r>s3&#v~.. -gc>SX6Y6Y -,$',,-- -#'  c= ) ) ES-=-K-K 25C .. E E E"*73d+C+C"D"DK'E:>>tDDD!#-t--- sC C% C  C%rprtc<eZdZdZdZejdefdZdS)r$z(An ABC with one abstract method __int__.rvrdcdSrrvrws ry__int__zSupportsInt.__int__ Dr{N) r}r~rrrrr@abstractmethodrgr~rvr{ryr$r$sH66  S        r{r$c<eZdZdZdZejdefdZdS)r"z*An ABC with one abstract method __float__.rvrdcdSrrvrws ry __float__zSupportsFloat.__float__"rr{N) r}r~rrrrr@rfloatrrvr{ryr"r"H88  u        r{r"c<eZdZdZdZejdefdZdS)r!z,An ABC with one abstract method __complex__.rvrdcdSrrvrws ry __complex__zSupportsComplex.__complex__+rr{N) r}r~rrrrr@rcomplexrrvr{ryr!r!&sH::          r{r!c<eZdZdZdZejdefdZdS)r z*An ABC with one abstract method __bytes__.rvrdcdSrrvrws ry __bytes__zSupportsBytes.__bytes__4rr{N) r}r~rrrrr@rbytesrrvr{ryr r /rr{r c8eZdZdZejdefdZdS)r#rvrdcdSrrvrws ry __index__zSupportsIndex.__index__<rr{N)r}r~rrrr@rrgrrvr{ryr#r#8sB  s        r{r#c<eZdZdZdZejdefdZdS)rz_ An ABC with one abstract method __abs__ that is covariant in its return type. rvrdcdSrrvrws ry__abs__zSupportsAbs.__abs__Grr{N) r}r~rrrrr@rrrrvr{ryrr@sN    T        r{rcBeZdZdZdZejddedefdZ dS) r%za An ABC with one abstract method __round__ that is covariant in its return type. rvrndigitsrdcdSrrv)rxrs ry __round__zSupportsRound.__round__Rrr{N)r) r}r~rrrrr@rrgrrrvr{ryr%r%KsZ     S         r{r%cfd}|S)NctjjdkrbtjdkrRt |t d}t |jd|}tj||S|_ |S)Npypyr)__call____mro_entries__rv) r6implementationrrv staticmethodrr}rAupdate_wrapperr)rcls_dictr mro_entriess ryinnerz#_ensure_subclassable..innerXs~   "f , ,1AF1J1J(..#/ #<#<HT]B11A+AACC66 6#.D Kr{rv)rrs` ry_ensure_subclassablerWs#      Lr{Fmodulec#NK t|}|turt|}|r |d}npdS|turtVt|\}nJ|turtVt|\}n&|t urt Vt|\}ndS)NTr)r0r&r/rHrIrG)annotation_typeannotation_originannotation_argss ry_get_typeddict_qualifiersr~s  *? ; ;  I--"*?";";"&5a&8OOE"h..#+O#<#< "k11!!!!#+O#<#< "h..#+O#<#< % r{c*eZdZddddZeZdZeZdS)_TypedDictMetaTFtotalclosedc|D]5}t|tur|tjurt d6t d|Drtjf}nd}ttdg|tR||_j dkr|_ tds|_ i}d|vr |d} nd|vr|dd} ni} d tr"fd | D} n fd | D} t} t} t} t} d }|D]}|j}||di| |d d| |dd| |dd| |dd|dd }||}|r |t$}|rgd| vrc| d}tt)|}t*|vrt dt,|vrt d|}|| | D]\}}tt)|}t*|vr| |nLt,|vr| |n-|r| |n| |t0|vr+| || || || ||_t7| _t7| _t7| _t7| _tds|_ |_!|_"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 classc3JK|]}t|tjVdSr)rurrTrms ryrz)_TypedDictMeta.__new__..s.@@Q:a00@@@@@@r{rvr;__orig_bases__r+ __annotate__rz?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typecPi|]"\}}|tj|j#S)r)rrr~)rntprtp_dicts ry z*_TypedDictMeta.__new__..sD###2v)"c':LMMM###r{cBi|]\}}|tj|Srvr)rrrrs ryrz*_TypedDictMeta.__new__..s<###2v)"c22###r{N__required_keys____optional_keys____readonly_keys____mutable_keys____extra_items__z5Special key __extra_items__ does not support Requiredz8Special key __extra_items__ does not support NotRequired __total__)#rrrrTrrprdictr}rhasattrr _TAKES_MODULEitemsrr.updater9rEpoprrHrIrrGdiscardr+rrrrrr __closed__r)rrrQnsrrr1 generic_baser2own_annotations required_keys optional_keys readonly_keys mutable_keysextra_items_type base_dictbase_extra_items_typer qualifiersannotation_keyrrs @@ryrz_TypedDictMeta.__new__s F F::^33FN8R8R#%EFFF@@%@@@@@ " &0 ! ll>:?T?Tt?T?TVXYYG#G #z11'+$7$455 /).&K B&&"$%6"72%%"4"^"4Q"7"7"$SC #####!0!6!6!8!8### ####!0!6!6!8!8### EEMEEMEEM55L#  = = M ""9==1BB#G#GHHH$$Y]]3F%K%KLLL$$Y]]3F%K%KLLL$$Y]]3F%K%KLLL##IMM2Db$I$IJJJ(1 6G(N(N%(4'<$ )*2#(  3+>>"1"5"56G"H"H !:?!K!KLL z))##*,,#&$3    / / /3B3H3H3J3J : :/ !:?!K!KLL z))!%%n5555 J..!%%n55556!%%n5555!%%n555z)) ((888!%%n5555 $$^444!)).9999&1G #(1-(@(@G %(1-(@(@G %(1-(@(@G %'0'>'>G $7K00 *$)!!'G &6G #Nr{c td)Nz4TypedDict does not support instance and class checksrrcs ryrZz _TypedDictMeta.__subclasscheck__sRSS Sr{N)r}r~rrrrrZrrvr{ryrrsU37n n n n n ` T T T.r{rrrvctfSr) _TypedDictrQs ryrs r{rc |tus|P|turd}nd}d|d|d}|d|zdz}tj|td |d ur |d ur||d <d }|}n|rt d|r;t jdkrt dtjdtd dt|i}t} | | |d<t|d|||} tf| _ | S)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. 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. rYr! stacklevelFTrz@TypedDict takes either a dict or keyword arguments, but not bothr>z$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.r+r~rvr) _markerwarningswarnDeprecationWarningrr6rvrr=rrr) typenamefieldsrrrdeprecated_thingexampledeprecation_msgrrtds ryrrsr` W    #W  #M E(EEEEEG#OOO  O M/+=! L L L LU""vT'9'9#)x FF  -,-- -  7** FGGG M;#      f .  %B|  Hb"E& I I I&L r{cvttdr|tjurdSt|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 rF)rrrr_TYPEDDICT_TYPESrs ryr6r6ls9 6; ' ' B&2B,B,B5".///r{r(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. rv)r typs ryr(r(s  r{rGcpt|trt|jSt |dr5|jt t tfvrt|jdSt|tj r@td|jD}||jkr|S| |St tdr_t|tjrEtd|jD}||jkr|Stj|j|St tdrdt|tjrJtd|jD}||jkr|St!jt$j|S|S)z=Strips Annotated, Required and NotRequired from a given type.rrc34K|]}t|VdSr _strip_extrasras ryrz _strip_extras..*!G!Gq-"2"2!G!G!G!G!G!Gr{rc34K|]}t|VdSrrrs ryrz _strip_extras..rr{rc34K|]}t|VdSrrrs ryrz _strip_extras..rr{)r_AnnotatedAliasrrrrHrIrGrrrrrrrrrAreduceoperatoror_)r stripped_argss ryrrs a ) ) / .. . 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-@@ @r{cttdrtj|||d}ntj|||}|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. r&T)globalnslocalnsinclude_extras)rrc4i|]\}}|t|Srvr)rkrs ryrz"get_type_hints..s&===1=##===r{)rrr3r)rrrrhints ryr3r3s|@ 6; ' ' R(hDD(xQQQD  K== ====r{r&c@eZdZdZfdZdZdZdZdZdZ xZ S)raKRuntime representation of an annotated type. At its core 'Annotated[t, dec1, dec2, ...]' is an alias for the type 't' with extra annotations. The alias behaves like a normal typing alias, instantiating is the same as instantiating the underlying type, binding it to types is also the same. ct|tr|j|z}|j}t ||||_dSr)rr __metadata__rrr)rxrmetadatars ryrz_AnnotatedAlias.__init__sR&/22 +!.9* GG  VV , , , (D   r{cft|dksJ|d}t||jS)Nrr)rrr)rxrnew_types ryrz_AnnotatedAlias.copy_withs5v;;!####ayH"8T->?? ?r{cdtj|jddd|jDdS)Nztyping_extensions.Annotated[, c34K|]}t|VdSr)reprrs ryrz+_AnnotatedAlias.__repr__..s( D DQa D D D D D Dr{])r _type_reprrjoinrrws ryrzz_AnnotatedAlias.__repr__s\H63DT_3U3UHHyy D D$2C D D DDDHHH Ir{cHtjt|jg|jRffSr)rgetitemr&rrrws ry __reduce__z_AnnotatedAlias.__reduce__s,#DO@d.?@@& r{c~t|tstS|j|jkrdS|j|jkS)NF)rrrrrrxrs ryrz_AnnotatedAlias.__eq__s@e_55 &%%%"222u$(:: :r{c8t|j|jfSr)rrrrws ryrz_AnnotatedAlias.__hash__s$*;<== =r{) r}r~rrrrrzrrrrrs@ryrrs   ) ) ) ) ) @ @ @  I I I     ; ; ; > > > > > > >r{rcBeZdZdZdZdZejdZdZ dS)r&aAdd 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()] rvc td)Nz&Type Annotated cannot be instantiated.rrTs ryrzAnnotated.__new__*DEE Er{cTt|trt|dkrtdtt f}t |d|vr |d}nd}tj|d|}t|dd}t||S)Nr!zUAnnotated[...] should be used with at least two arguments (a type and an annotation).rz$Annotated[t, ...]: t must be a type.r) rrrrrrr0rrr)rrallowed_special_formsrrrs ry__class_getitem__zAnnotated.__class_getitem__-sfe,, 0F a!/000&.u$5 !&)$$(===<+F1Is;;VABBZ((H"6844 4r{c2td|jd)NCannot subclass z .Annotated)rr~rTs ryrozAnnotated.__init_subclass__<s$=3>=== r{N) r}r~rrrrrrr rrorvr{ryr&r&sf  @  F F F   5 5   5     r{)_BaseGenericAlias)rct|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) rrr&rr_typing_GenericAliasrr r rrTrs ryr0r0Tsg b/ * *   b6/1EGX(/; < < !=   > !tr{cft|tr|jg|jRSt|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) rFrvrNr*)rrrrrrr!rrr0rir@rMEllipsisr)rress ryr/r/ls b/ * * 5M4BO44 4 b6/1EF G G r:u-- r+C"~~!999c!fH>T>TCH~~s2w/Jrr{r@c&t|d)a&Special marker indicating that an assignment should be recognized as a proper type alias definition by type checkers. For example:: Predicate: TypeAlias = Callable[..., bool] It's invalid when used anywhere except as in the example above.  is not subscriptablerrxrs ryr@r@s4666777r{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.rbceZdZdZdS)NoDefaultTypeMetac6td|d|j)Nz cannot set z attribute of immutable type rr})rrvalues ryr zNoDefaultTypeMeta.__setattr__s)SdSS3<SS r{N)r}r~rr rvr{ryr)r)s#     r{r)c(eZdZdZdZdZdZdZdS) NoDefaultTypez$The type of the NoDefault singleton.rvcxtdpt|SNrb)globalsr9rrrfs ryrzNoDefaultType.__new__s)99==--D1D1D Dr{cdS)Nztyping_extensions.NoDefaultrvrws ryrzzNoDefaultType.__repr__s00r{cdSr0rvrws ryrzNoDefaultType.__reduce__s;r{N)r}r~rrrrrrzrrvr{ryr.r.sO22  E E E 1 1 1     r{r.c*fd|_|_dS)NctuSr)rbdefaultsryrz_set_default..s WI%=r{) has_default __default__) type_paramr7s `ry _set_defaultr;s"====J$Jr{cDtd}|dkr ||_dSdS)Nrpr;r%)r=r~) typevarlikedef_mods ry _set_moduler?s4AG%%%!( &%r{ceZdZdZdZeZdS) _DefaultMixinzMixin for TypeVarLike defaults.rvN)r}r~rrrrr;rrvr{ryrArAs))IHHHr{rAceZdZdedefdZdS)_TypeVarLikeMeta_TypeVarLikeMeta__instancerdc,t||jSr)r_backported_typevarlike)rrDs ryrz"_TypeVarLikeMeta.__instancecheck__s*c&ABBBr{N)r}r~rrboolrrvr{ryrCrCs>C3C4CCCCCCr{rC)r c<eZdZdZejZdddedddZddZ dS) r zType variable.NF)boundrrr7infer_variancec  ttdrtj|g|R||||d n3tj|g|R|||d |r|s|rtd| _t |t  fd}| _ S)NrArIrrrJrIrrz1Variance cannot be specified with infer_variance.cr6|jt|kr |jfz }|Sr)r8__parameters__indexrr9)aliasrtypevars ry_tvar_prepare_substz,TypeVar.__new__.._tvar_prepare_substsN''))3,227;;s4yyHHW022D r{)rrr r:__infer_variance__r;r?__typing_prepare_subst__) rrrIrrr7rJ constraintsrSrRs @ryrzTypeVar.__new__sv// < .H HH53s*e_55 &%%?e&66 6r{Nrjrvr{ryr r ,sK  % % % 8 8 8 7 7 7 7 7r{r )rrc<eZdZdZejZddddeddZddZ dS) rzParameter specification.NFrIrrrJr7cttdrtj|||||ntj|||||_t |t fd}|_S)NrArLrMc|j}|}|t|krr g|j}|t|krt d|t|dkr&t j|ds |dksJ|f}nJt||tr/g|d|t||||dzdR}|S)NToo few arguments for rr) rOrPrr8r9rr_is_param_exprrrr)rQrri paramspecs ry_paramspec_prepare_substz3ParamSpec.__new__.._paramspec_prepare_substbs-LL++D >>i&;&;&=&=>9T99#89DD >>#$DU$D$DEEEv;;!##F,A$q',J,J#6666 7DDQ..FET"1"XEuT!W~~EQUVV EED r{)rrrrTr;r?rU) rrrIrrrJr7rwrvs @ryrzParamSpec.__new__Psv// >",T7@;H , G , , ,  " " "      2JI . r{rdc2tdtd)NrXz*.ParamSpec' is not an acceptable base typer+rfs ryrozParamSpec.__init_subclass__usYXYYYZZ Zr{rY) r}r~rrrrrFrbrrorvr{ryrrKsd&&"("2(,#5#()# # # # # J [ [ [ [ [ [r{c~eZdZdZejZedZedZ dddde ddZ dZ d Z d Zd Zd ZdS) 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|Sr)r rws ryrzParamSpec.argss && &r{c t|Sr)r rws ryrzParamSpec.kwargss"4(( (r{NFrpc|t||g||_t||_t||_t||_|rtj|d|_ nd|_ t||t}|dkr ||_ dSdS)NzBound must be a type.r%) rrr}rG __covariant____contravariant__rTrr __bound__rAr=r~)rxrrIrrrJr7r>s ryrzParamSpec.__init__s MM$ ' ' ' DM!%iD %)-%8%8D "&*>&:&:D # &!'!3E;R!S!S!%  " "4 1 1 1iiG---").-r{cV|jrd}n|jrd}n |jrd}nd}||jzS)N+-~)rTr}r~r})rxprefixs ryrzzParamSpec.__repr__sJ& # ' DM) )r{c6t|Srrrrws ryrzParamSpec.__hash__??4(( (r{c ||uSrrvrs ryrzParamSpec.__eq__ 5= r{c|jSrr}rws ryrzParamSpec.__reduce__ = r{cdSrrvrEs ryrzParamSpec.__call__ Dr{)r}r~rrrr rpropertyrrrbrrzrrrrrvr{ryrr|s, , ^N  ' '  '  ) )  )+/%u$)9 * * * * *$ * * * ) ) ) ! ! ! ! ! !     r{rcXeZdZejZdZfdZdZdZ dZ e dZ xZ S)_ConcatenateGenericAliasFcft|||_||_dSr)rrrr)rxrrrs ryrz!_ConcatenateGenericAlias.__init__s- GG  T " " "$DO DMMMr{ctj|jddfd|jDdS)N[r c3.K|]}|VdSrrv)rrIrs ryrz4_ConcatenateGenericAlias.__repr__..s+!K!Kc**S//!K!K!K!K!K!Kr{r)rrrrr)rxrs @ryrzz!_ConcatenateGenericAlias.__repr__sd*J!z$/22OO !K!K!K!KT]!K!K!KKKOOO Pr{c8t|j|jfSr)rrrrws ryrz!_ConcatenateGenericAlias.__hash__s$-899 9r{cdSrrvrEs ryrz!_ConcatenateGenericAlias.__call__rr{c>td|jDS)Nc3\K|]'}t|tjtf#|V(dSr)rrr r)rrs ryrz:_ConcatenateGenericAlias.__parameters__..sLjfni=X.Y.Yr{)rrrws ryrOz'_ConcatenateGenericAlias.__parameters__s2!] r{)r}r~rrrrrrrzrrrrOrrs@ryrrs(  ! ! ! ! !  P P P  : : :            r{rc |dkrtdt|ts|f}t|dtstddtfd|D}t ||S)Nrvz&Cannot take a Concatenate of no types.r*zAThe last parameter to Concatenate should be a ParamSpec variable.z/Concatenate[arg, ...]: each arg must be a type.c3BK|]}tj|VdSrrrs ryrz'_concatenate_getitem..s0FFav)!S11FFFFFFr{)rrrrr)rxrrs @ry_concatenate_getitemrsR@AAA j% ( (# ] jni 0 0/.// / ;CFFFF:FFFFFJ #D* 5 55r{c"t||S)&Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a higher order function which adds, removes or transforms parameters of a callable. For example:: Callable[Concatenate[int, P], int] See PEP 612 for detailed information. rr's ryrrs$D*555r{ceZdZdZdS)_ConcatenateFormc"t||Srrr's ryrz_ConcatenateForm.__getitem__)s'j99 9r{Nr}r~rrrvr{ryrr(s# : : : : :r{rrrBc^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).  accepts only a single type.rrrrxritems ryrBrB>s5X!*.S.S.STT#D4'222r{ceZdZdZdS)_TypeGuardFormchtj||jd}tj||fSNz accepts only a single typerrrrrs ryrz_TypeGuardForm.__getitem__o;%j)-&P&P&PRRD'tg66 6r{Nrrvr{ryrrn# 7 7 7 7 7r{rrrCc^tj||d}tj||fS)zSpecial 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 ``TypeGuard`` 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 ryrCrCs5L!*.S.S.STT#D4'222r{ceZdZdZdS) _TypeIsFormchtj||jd}tj||fSrrrs ryrz_TypeIsForm.__getitem__rr{Nrrvr{ryrrrr{rrcneZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z ejd Zd S) _SpecialForm)rr_getitemcD||_|j|_|j|_dSr)rr}rr)rxrs ryrz_SpecialForm.__init__s  %  r{c6|dvr|jSt|)N>r}r)rr)rxrs ry __getattr__z_SpecialForm.__getattr__s$ / / /: T"""r{c&td|)Nrr)rxrQs ryrz_SpecialForm.__mro_entries__ s3433444r{cd|jSrrrws ryrzz_SpecialForm.__repr__s0DJ000r{c|jSrrrws ryrz_SpecialForm.__reduce__s zr{c&td|)NzCannot instantiate rrxrkwdss ryrz_SpecialForm.__call__s6d66777r{c*tj||fSrrrkrs ry__or__z_SpecialForm.__or__s|D%K((r{c*tj||fSrrrs ry__ror__z_SpecialForm.__ror__s|E4K((r{c&t|d)Nz! cannot be used with isinstance()rrxrs ryrz_SpecialForm.__instancecheck__4BBBCCCr{c&t|d)Nz! cannot be used with issubclass()r)rxrs ryrZz_SpecialForm.__subclasscheck__"rr{c.|||Sr)rr's ryrz_SpecialForm.__getitem__%s}}T:...r{N)r}r~rrrrrrrzrrrrrrZrr rrvr{ryrrs0I''' ### 555111888))))))DDDDDD /////r{rrc&t|d)aPRepresents an arbitrary literal string. Example:: from pip._vendor.typing_extensions import LiteralString def query(sql: LiteralString) -> ...: ... query("SELECT * FROM table") # ok query(f"SELECT * FROM {input()}") # not ok See PEP 675 for details. r&rrxrs ryrr-s"4666777r{r c&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 r&rrs ryr r Ds4666777r{rEc&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 pip._vendor.typing_extensions import Never def never_call_me(arg: Never) -> None: pass def int_or_str(arg: int | str) -> None: never_call_me(arg) # type checker error match arg: case int(): print("It's an int") case str(): print("It's a str") case _: never_call_me(arg) # ok, arg is of type Never r&rrs ryrErEYs04666777r{rHchtj||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. rrrs ryrHrHxs6"!*.Y.Y.YZZ#D4'222r{chtj||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, ) rrrs ryrIrIs6!*.Y.Y.YZZ#D4'222r{ceZdZdZdS) _RequiredFormchtj||jd}tj||fSNrrrs ryrz_RequiredForm.__getitem__;%j)-&Q&Q&QSSD'tg66 6r{Nrrvr{ryrrrr{rrrIrchtj||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 ryrGrGs6 !*.Y.Y.YZZ#D4'222r{ceZdZdZdS) _ReadOnlyFormchtj||jd}tj||fSrrrs ryrz_ReadOnlyForm.__getitem__rr{Nrrvr{ryrrrr{raA special typing construct to mark a key 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 propery. aType 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)r0rrs ry _is_unpackr! s#&((r{ceZdZfdZxZS)_UnpackSpecialFormcbt|t|_dSr)rr _UNPACK_DOCr)rxrrs ryrz_UnpackSpecialForm.__init__& s& GG  W % % %&DLLLr{)r}r~rrrrs@ryrr% s8 ' ' ' ' ' ' ' ' 'r{rc2eZdZejZedZdS) _UnpackAliasc|jtusJt|jdksJ|j\}t |t jtjfr$|jturtd|jSdS)Nrz*Unpack[...] must be used with a tuple type) rrrrrrrrrrr)rxrIs ry__typing_unpacked_tuple_args__z+_UnpackAlias.__typing_unpacked_tuple_args__- s?f,,,,t}%%****=DC# 4f6IJKK $>..#$PQQQ|#4r{N)r}r~rrr rrrrvr{ryrr* s4N       r{rc^tj||jd}t||fSrrrrrrs ryrr8 s1!*.Y.Y.YZZD4'***r{c,t|tSrrrrs ryrr= #|,,,r{ceZdZejZdS)rN)r}r~rrr rrvr{ryrrA sN r{ceZdZdZdS) _UnpackFormc^tj||jd}t||fSrrrs ryrz_UnpackForm.__getitem__E s8%j)-&Q&Q&QSSDtg.. .r{Nrrvr{ryrrD s# / / / / /r{rrc,t|tSrrrs ryrrL rr{)rrcg}|D]L}t|dd}|"|r |ddus||7||M|S)Nrr*.)rrr)rnewargsrIsubargss ry _unpack_argsrU sp $ $Cc#CTJJG"G" s8J8Jw''''s####r{c2eZdZdZejZeddZdZ dS)rzType variable tuple.r6ctj|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 rr!r*.z6More than one unpacked arbitrary-length tuple argumentrrsrz, expected at least ) rOrPrrrr enumeraterrminr8rr9)rQrrtypevartuple_indexparamalenplenleftrightvar_tuple_indexfillargrrIr replacementtvts ry_typevartuple_prepare_substz9TypeVarTuple.__new__.._typevartuple_prepare_substj 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{)rrr;r?rU)rrr7rrs @ryrzTypeVarTuple.__new__e s[%d++C g & & &    + + + + + Z,GC (Jr{c td)N&Cannot subclass special typing classesrrs ryrozTypeVarTuple.__init_subclass__ rr{N) r}r~rrrrrFrbrrorvr{ryrr` sT"""("5*33 3 3 3 3 j F F F F Fr{cPeZdZdZejZdZeddZ 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) __unpacked__rws ry__iter__zTypeVarTuple.__iter__ s# # # # # #r{r6c||_t||t}|dkr||_t ||_dS)Nr%)r}rArr=r~rr )rxrr7r>s ryrzTypeVarTuple.__init__ sO DM  " "4 1 1 1iiG---") &t D   r{c|jSrrrws ryrzzTypeVarTuple.__repr__ rr{c6t|Srrrws ryrzTypeVarTuple.__hash__ rr{c ||uSrrvrs ryrzTypeVarTuple.__eq__ rr{c|jSrrrws ryrzTypeVarTuple.__reduce__ rr{c,d|vrtddS)Nrrrrs ryrozTypeVarTuple.__init_subclass__ s$d"" HIII#"r{N)r}r~rrrr rr rbrrzrrrrorvr{ryrr s) ) XN  $ $ $-6 - - - - - ! ! ! ) ) ) ! ! ! ! ! ! J J J J Jr{r<rrdcftdt|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)printrr}r6stderrrs ryr<r< s0 7c!377cjIIII r{_ASSERT_NEVER_REPR_MAX_LENGTHdr'rIct|}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: )r rrAssertionError)rIr,s ryr'r' sN(S  u::5 5 58889EAEQ%QQRRRr{) eq_default order_defaultkw_only_defaultfrozen_defaultfield_specifiersrrrrr.rc &fd}|S)aDecorator that marks a function, class, or metaclass as providing dataclass-like behavior. Example: from pip._vendor.typing_extensions import dataclass_transform _T = TypeVar("_T") # Used on a decorator function @dataclass_transform() def create_model(cls: type[_T]) -> type[_T]: ... return cls @create_model class CustomerModel: id: int name: str # Used on a base class @dataclass_transform() class ModelBase: ... class CustomerModel(ModelBase): id: int name: str # Used on a metaclass @dataclass_transform() class ModelMeta(type): ... class ModelBase(metaclass=ModelMeta): ... class CustomerModel(ModelBase): id: int name: str Each of the ``CustomerModel`` classes defined in this example will now behave similarly to a dataclass created with the ``@dataclasses.dataclass`` decorator. For example, the type checker will synthesize an ``__init__`` method. The arguments to this decorator can be used to customize this behavior: - ``eq_default`` indicates whether the ``eq`` parameter is assumed to be True or False if it is omitted by the caller. - ``order_default`` indicates whether the ``order`` parameter is assumed to be True or False if it is omitted by the caller. - ``kw_only_default`` indicates whether the ``kw_only`` parameter is assumed to be True or False if it is omitted by the caller. - ``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)rrrrrr)__dataclass_transform__) cls_or_fnrrrrrrs ry decoratorz&dataclass_transform..decorators s,(!.#2"0$4 11I - r{rv)rrrrrrr$s`````` ryr*r** sCR          r{r:_F)rIcF 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__rrrHs ryr:r: s@4 #C   *    D    rr+_Tc neZdZdZedddedejeje de ddfd Z d e de fd Z dS) r+aIndicate 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. rcategoryrmessager+rrdNct|ts$tdt|j||_||_||_dS)Nz2Expected an object of type str for 'message', not )rrrrr}r,r+r)rxr,r+rs ryrzdeprecated.__init__ s^gs++ 2G}}-22#DL$DM(DOOOr{rIc |j|j|j  _St t rddl}ddlm}j |j  fd}t|_ j t |r: j |j  fd}t|_ n%|j  fd}|_ x_|_|_Str2ddl}|j  fd}x_|_|St!d)Nr) MethodTypec|urtjdztjur |g|Ri|S|jtjur|s|rt |jd|S)Nrr*z() takes no arguments)rrrrrrr})rrrrIr+r original_newrs ryrz$deprecated.__call__..__new__ sczz cHVWXXXX#6>99+|CA$AAA&AAA88d8f8'3<(N(N(NOOO+|C000r{cHtjdz|i|SNrr*rrrrr+roriginal_init_subclassrs ryroz.deprecated.__call__..__init_subclass__ 5 cHVWXXXX55tFvFFFr{cHtjdz|i|Sr3r4r5s ryroz.deprecated.__call__..__init_subclass__ r7r{cHtjdz|i|Sr3r4)rrrIr+rrs rywrapperz$deprecated.__call__..wrapper" s4M#ZRS^TTTT3////r{zY@deprecated decorator with non-None category must be applied to a class or callable, not )r,r+r__deprecated__rrrAtypesr/rwrapsrror classmethodrwr) rxrIrAr/rror:r+rr6r1rs ` @@@@@ryrzdeprecated.__call__ sJ,C}HJ%(" 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?BA"W%;80388r{)r}r~rrrrrrcr Warningrgrr(rrvr{ryr+r+ s( ( \?Q  ) ) ) ) ofk'&:;  )   ) ) ) ) )"D D "D D D D D D r{c |st|d|tur=t|dr|jst|dt |j}t |}||kr|}t|drd|jD}t d|D}|dkr |||z krdS||krHt ||dtturdSt d|D}||z}d |}tj d 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. rrOc0g|]}t||Srvrrrs ry z"_check_generic..G #QQQA:a==QaQQQr{c3@K|]}t|tVdSr)rrrDs ryrz!_check_generic..H s,#T#TAJq,$?$?#T#T#T#T#T#Tr{rNr9c3PK|]!}t|dttuV"dSr9NrrbrDs ryrz!_check_generic..W R)O)O>?*1M9)M)M09*:)O)O)O)O)O)Or{rr argumentsrrrr z for rr) rrrrOrsumrrbr6rv)rrelenr expect_val num_tv_tuplesnum_default_tvthingss ry_check_genericrT8 s  =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 .o rFr{r9Nc3PK|]!}t|dttuV"dSrIrJrDs ryrz!_check_generic..| rKr{rrrrrrr)rrrrOrrbrN)rrrOrrPrRs ryrTrTd 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{) rr r[r_rrrbrrrrrOr)r< typevar_typesenforce_default_orderingdefault_encounteredtype_var_tuple_encounteredrr8rfs @ryr`r` s^  "NM$F#G#G #&+" N NA(++ -1**A}-- !5..+ R")!]I"F"Fi"WK"R5E"+-D#E#EE.2++,R')Q!)Q)Q)QRRR Q.q11 N LLLL)9LLLMMMU||r{cxg}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__r9rbTrcrdrOrv) r[rrr_collect_parametersrrrrbrr_) rrrhrirjrr^ collectedr8s ryrmrm 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   r{cd|D}d|D}tj||||}|x|_|j_tjdkr||_|S)Ncg|]\}}|Srvrvrrrs ryrEz!_make_nmtuple.. s&&&1!&&&r{c Hi|]\}}|tj|d|d S)zfield z annotation must be a typerrqs ryrz!_make_nmtuple.. sG***1a&,Q0V0V0V0VWW***r{rrr)ri namedtupler+rr6rv _field_types)rr<rrrr2nm_tpls ry _make_nmtuplerw s&&&&&**#(*** 'f19&JJJBMM!?  f $ $"-F  r{>r}r~r+ceZdZdZdS)_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)rr1s ryrz*_NamedTupleMeta.__new__../ s0SST4;#6#6%%DSSSSSSr{r+rrzNon-default namedtuple field z cannot follow default fieldsrrMr c g|] }| Srvrv)rrrs ryrEz+_NamedTupleMeta.__new__..B s777A"Q%777r{r~rs_generic_class_getitemz&Cannot overwrite NamedTuple attribute zError calling __set_name__ on z instance z in r{)r|rrTrrrrrrwrrqrr>rrr_prohibited_namedtuple_fieldsr_special_namedtuple_fields_fieldsr r __set_name__ BaseExceptionr}r6rvadd_note RuntimeErrorro)rrrQrr1r< default_names field_namerv class_getitemkeyr set_namerzrs ` ryrz_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)r}r~rrrvr{ryryry( s(C C C C C r{ryrc(t|vsJtfSr)rr|rs ry_namedtuple_mro_entriesrp sU""""~r{c |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.rrz = 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. rYNz\Cannot pass `None` as the 'fields' parameter and also specify fields using keyword argumentsrzIEither list of fields or keywords can be provided to NamedTuple, not bothz3.15)rrr!rr) rrrrformatrrrwr=rr)rrrrrrnts ryrrt sn* W   "#X H  $X HhHHhHHH0 # " #" ^ "F $N HhHHhHHH0 # " #"  HGHH H W   M&&, > >'M r{ceZdZdZdS)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)r}r~rrrvr{ryrr s    r{r1c |jd|jS#t$r&t dt |jdwxYw)a(Return the class's "original" bases prior to modification by `__mro_entries__`. Examples:: from typing import TypeVar, Generic from pip._vendor.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)r.r9rqrrrr}rfs ryr1r1 sf* <##$4cmDD D   KT#YY5GKK  s "0AcVeZdZdZdZdZdZdZdZe j dkrdZ d Z d Sd S) r8aLNewType 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|Srrvrs ryrzNewType.__call__ sJr{c||_d|vr|dd}||_||_t }|dkr ||_dSdS)NrYr*r%)r rpartitionr} __supertype__r=r~)rxrrr>s ryrzNewType.__init__ s` $D d{{s++B/ DM!#D iiG---").-r{c6|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(r z)`)r}r)r subcls_name supercls_names ryroz8NewType.__mro_entries__..Dummy.__init_subclass__ sU"%,K#W'WW4?WWERWWWr{N)r}r~rro)rsryDummyr s.r{rr)rxrQrrs @ryrzNewType.__mro_entries__ sG!MM          8Or{c$|jd|jS)NrY)r~rrws ryrzzNewType.__repr__% so;;(9;; ;r{c|jSr)rrws ryrzNewType.__reduce__( s $ $r{rc*tj||fSrrrs ryrzNewType.__or__/ s|D%K00r{c*tj||fSrrrs ryrzNewType.__ror__2 s|E4K00r{N) r}r~rrrrrrzrr6rvrrrvr{ryr8r8 s     * * *     < < < % % %  w & & 1 1 1 1 1 1 1 1 ' &r{r8rAcn|dup1t|ttjtjt fS)z:Corresponds to is_unionable() in unionobject.c in CPython.N)rrrrrrArs ry _is_unionabler9 s8d{ j       /    r{ceZdZdZdddefdZdededdffd Zdedefd Z dedefd Z defd Z d Z dZ dZdZejdkr dZdZxZSxZS)rAaCreate 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)'). rv) type_paramsrcdt|tstd||_||_g}|D]B}t|t r||-||Ct||_ t}|dkr||_ ||_ dS)Nz#TypeAliasType name must be a stringr%) rrr __value____type_params__rrrrrOr=r~r})rxrr,rrr:r>s ryrzTypeAliasType.__init__^ sdC(( G EFFF"DN#.D J) 2 2 j,772%%j1111%%j1111"' "3"3D iiG---") DMMMr{r,rdNct|dr||t||dS)Nr})r_raise_attribute_errorrr )rxrr,rs ryr zTypeAliasType.__setattr__q sItZ(( 2++D111 GG  e , , , , ,r{c0||dSr)rrxrs ry __delattr__zTypeAliasType.__delattr__v s  ' ' - - - - -r{c|dkrtd|dvrtd|dtd|d)Nr}zreadonly attribute>rr~rOrz attribute 'z3' of 'typing.TypeAliasType' objects is not writablez0'typing.TypeAliasType' object has no attribute '')rrs ryrz$TypeAliasType._raise_attribute_errory srz!!$%9:::YYY$&$&&& %NtNNNr{c|jSrrrws ryrzzTypeAliasType.__repr__ rr{ct|ts|f}fd|D}tjt|S)NcLg|] }tj|djd!S)z Subscripting z requires a type.)rrr})rrrxs ryrEz-TypeAliasType.__getitem__.. sK"J$-JJJr{)rrrrr's` ryrzTypeAliasType.__getitem__ scj%00 +(] ' J 'eJ.?.?@@ @r{c|jSrrrws ryrzTypeAliasType.__reduce__ rr{c td)NzEtype 'typing_extensions.TypeAliasType' is not an acceptable base typerrTs ryrozTypeAliasType.__init_subclass__ sW r{c td)NzType alias is not callablerrws ryrzTypeAliasType.__call__ s899 9r{rcVt|stStj||fSrrrrrk)rxrs ryrzTypeAliasType.__or__ s+%U++*))|D%K00r{cVt|stStj||fSrr)rxrs ryrzTypeAliasType.__ror__ s)$T***))|D$J//r{)r}r~rrrrrr rErrrzrrrorr6rvrrrrs@ryrArAB s`  6=? ! ! ! ! ! ! !& -C - -d - - - - - -  .C .u . . . . s u     !c ! ! ! ! A A A ! ! !    : : :  w & & 1 1 1 0 0 0 0 0 0 0 ' & & &r{r5rc|t|to't|ddo|tuo |tjuS)aZReturn True if the given type is a Protocol. Example:: >>> from typing_extensions import Protocol, is_protocol >>> class P(Protocol): ... def a(self) -> str: ... ... b: int >>> is_protocol(P) True >>> is_protocol(int) False rDF)rrrr;rrs ryr5r5 sH r4  *NE22 *(" *&/)  r{ct|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 Protocolr')r5rrrr'r3rs ryr2r2 sd2 9r77788 8 2+ , , 4R233 3,R00111r{r,cJeZdZdZdeddfdZdefdZdefdZde de fd Z dS) r,afDefine 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: ... documentationrdNc||_dSrr)rxrs ryrz Doc.__init__ s!.D   r{cd|jdS)NzDoc()rrws ryrzz Doc.__repr__ s1$,111 1r{c*t|jSr)rrrws ryrz Doc.__hash__ s*++ +r{rcZt|tstS|j|jkSr)rr,rrrs ryrz Doc.__eq__ s+eS)) &%%%)<< r[rTr>r=r$r"r!r r#rr%r_PEP_728_IMPLEMENTEDrrr6 signaturerrrrrrrr(r3rr&rr0r/r ImportErrorrr!r@rbr)r.r;r?rArCr r r[rrrr rrrrBrrCr_Finalrr rErHrIrrGrrrrrrrrrr<rr'r*rjrkrMr:r%r+r(rTr[r]r_r`rmrrw _prohibitedrrryr|rrABCregister memoryview bytearrayrr1r8rArr5r2rRrr, _CapsuleType_socket_CAPIrrrJrKrLrNrOrPrQrUrVrWrXrYrZr[r\r]r^r_r`rardrerfrgrhrirlrmrnrorvr{ryrsJ   y y y x  '+==  )++w     JJJJFFF ?FN3V^DV^Dv~f--- 6>*D 9 9 9w & & & & &4 & & & 9 9 9 9 9 9 9 9 9 ?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===#*'&(<##0*0*0*0*0*:$0*0*0*0*dT 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   "P0 I*N&LL 1 1&2D E E PPM*w.w.w.w.w.w.w.w.rnk2rBBJ5566#*VUVVVV76Vpwv'((-"1>B*,000" 76=!!$KK     76:D>*NN0(>(>(>(>X 76;f I,OO%>%>%>%>%>&.d%>%>%>%>N88888888zBQB7"""JHH1,,,,,,, 111"014??????? 444%3400 76; IIbqbV## 8 8 8 8'&    I 76;) IID     "3     I(%%% )))CCCCCtCCC 'Y#Y#Y#Y#Y#Y,#Y#Y#Y#YN 76?##;7(M,OO77777 777.77777*7770Z        WV[!!V+[+[+[+[+[.+[+[+[+[+[bbbbbbD-bbbLwv}%%4B 6 6 6 76=!!# $K%>bqbV## 6 6 6 6:::::1::::#"     K 76;e  IIbqbV##,3,3,3,3^77777/t7777 ) + + + I\ 768Y ]FFbqbV##&3&3&3&3R77777,D7777 [# % % % FR(/(/(/(/(/6=(/(/(/(/V 76?##8(MM88\8& 7668 ;DD88\8" 7678 LEE88\84 76:N H$KKbqbV##333&3333"77777.d7777 }    H" -     K  76:, HHbqbV##3333&77777.d7777 }    H$' Tw ]F)))) bqbV##'''''34''''     v+4    +++----#####v+4####/////,D//// [{ 3 3 3F---YJ####### WV^$$VJ;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!!!!!H 78\""D$JJ   BRwv~&&MQ-4(Q(Q(Q(Q(QX Q Q QD+*F[D[[[[&$WWV^T%J%JKD 76'((b9$$$$L!3F6!6!6!p 9%8"w"JJ    %+$6!!*+X+X+X!Y!YDDDDD$DDDL,, b"EEK122$+???32?D 7;?H%% _ #FF        * OOJ OOI OOE 76'((2>wnGG9191919191919191x 76?##w0(MM   k0k0k0k0k0k0k0k0\ 76=!!+2$K!6  D    *22V-=c-B2222* 765 = *CC========@wv}d33 '..  4;;L      K NN=!!!  ? ?      {     . ? Y   ? ? ? { .  &(   ? .   ? j        {$  8s6V V)(V)-V44 WW u((u0/u0