JFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3RbrJFIFxxC      C  " }!1AQa"q2#BR$3br %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz w!1AQaq"2B #3Rbr Փgm8%ddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddlZgdZdZeZe j&dk\Zde j*j,vZGddZeZe j&dk\rd Zne j&d k\rd Znd Ze j6Ze j8d Ze j8dZe j8dZe j8ddZ e j8ddZ!e j&dk\rddl m"Z"nGddeZ#Gdde#Z"e jHZ$Gdde jJdZ&e jNZ'e j&dk\r e jPZ(ndZ(dZ)e j&d k\r e jTZ*n3d!Z+d"Z,Gd#d$e jZdZ.Gd%d&e&dZ/e/d'(Z*e j`Z0e1e d)r%e jdZ2e jfZ3e jhZ4n6ejjejlejje7Z8d*Z2d+Z3d,Z4e jrZ9e jtZ:e jvZ;e jxZe j~Z?e jZ@e jZAe jZBe jZCe jZDe j&dk\r dd-l mEZEmFZFmGZGmHZHnd.ZIeJe d/e jZZKGd0d/eKdZLedZMeLejjd1eMeMf2ZHeLejjd3eMf2ZFeLejd3d4e jePf5ZGeLejd3d6e jePf5ZEgd7d8d9gd:gd;ZReSe jhd<zZUd=ZVd d>ZWe j&d?k\r e jZXnEd!d@ZYdAZZdBZ[GdCdDee jZ\e]dEZ^GdFdGe je\ZXe j&d?k\r e jZ`ndHZ`e`Zae j&dIk\rUe jZbe jZce jZde jZee jZfe jZge jZhnve`GdJdKeXZbe`GdLdMeXZce`GdNdOeXZde`GdPdQeXZee`GdRdSeXZfe`GdTdUeXe Zge`GdVdWeXe ZhdXZie1e dY xs e1e dZ Zjejr Gd[d\eZke1e dYr e jZlnGd]d^ekZmemZl[me1e dZr e jZnnGd_d`ekZoeoZn[oejr[kdaZpepr%e jZqe jZre jZsn~dbeje jjvZwdcZxGdddeeZrejerdfdgiZzeidhefddendidjZqe1e dere jerfZ{nerfZ{dkZse1e dlr e jZ|ndmZ|e1e dnr e jZ}ndoZ~d"dpZ}edZMdqZd#drZe1e dsre jZe jZn!Gdtdue jZdZGdvdsZe j&dd3dk\re jZe jZn ddwl mZ ddxl mZdyZdzZe1e d{re jZn%e j&dd3d k\r e&d|Zn e&d{d}(Zd~ZdZGddZGddeZerddl mZn GddeZe1e dre jZe jZn GddZGddeZGddeZerddl mZn"e1e dr GddeZn GddeeZe1e ds+e1e ds d$daddZn e j&ZGddeZn4e j(Ze j&dkrGdde j(dZGddZdZe j.dZe j&dk\re j2Zn2e j&dd3d k\r e&dZnGdde&dZedd(Ze1e dre j6Zn2e j&dd3d k\r e&dZnGdde&dZedd(Ze1e dre j:Zn2e j&dd3d k\r e&dZnGdde&dZedd(Ze1e dre j>Zn?e j&dd3d k\rGdde&dZedZnGdde&dZedd(ZGdde jBdZ%e1e dre jDZne%dZe1e dre jFZne%dZe1e dre jHZne%dZe1e dre jJZe jLZnDe j&dd3d k\re&dZe&dZn!Gdde&dZedd(Zedd(Ze1e dnre jPZn2e j&dd3d k\r e&dZnGdde&dZedndì(ZdZe j&dIk\re jVZdńZnse j&dd3d k\r0GdƄde&dZGdȄde jZdZedʄZd˄Zn1Gd̄de jZdZGd̈́de&dZede(ZdЄZdфZerddl mZn!e1e dӫr GdԄdeZn GdՄdeZe1e d֫re jdZndedefdلZe1e dګre jfZndZe1e dܫre jhZndedefdބZe j&dIk\re jjZnddadadadgdߜdePdePdePdePde jle jne jre jDe jpde jDffdfde jDde jpegeffdZe1e dre jrZn6e j8de jpde jDfZdedefdZe1edrejvZne j8dZGddZe j&dkrdZndZe1e dӫsefdZndZesee _dePfdZeeJe ddhZdePfdZe1e dr d$dZee _n dZesee _e j&d?k\re jZnNd%dZe jZeShdZGddeZejeddgiZdZeie˫efdZe1ejd:rejjZnLGdd:ejZe̐jeϫe̐jeЫe̐jeѫe1e dre jZndZe j&dk\re jZn GddZe j&dk\re jZnCdZe j&dkr$eShdZGdde jZdZGd d Ze1e d re jZe jZn"d edePfd Zؐd ede jefdZe1e dre jZn GddZeJe ddZe݀ ddlZeJeސddZe߁ ee߫Z e݁eZejde1edxr7ejjduxrdejjvZGddejZerejZndddaejddZe1e dre jZn4ddddddZ d&ddaddZddddejeSddZe jZe jZe jZe jpZe jZe jZe jZe j*Ze jZe jZ_e jZe jZe jZe jZe jZe jZe jZe jZe jZe jZe jZe jZe jZe jZOe jZe jZe jZe jZe jZe jZe jlZe jnZe jZe j Ze j Ze jZy#e$re jZZY `wxYw#e$re jZZY qwxYw#e$rYwxYw('N)rAnyClassVar 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 deprecatedDocevaluate_forward_ref get_overloadsfinalFormatget_annotationsget_args get_originget_original_basesget_protocol_membersget_type_hintsIntVar is_protocol is_typeddictLiteralNewTypeoverloadoverrideProtocol 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) rbeta__forward_is_class__ceZdZdZy) _Sentinelcy)Nz selfs @/opt/hc_python/lib/python3.12/site-packages/typing_extensions.py__repr__z_Sentinel.__repr__sN__name__ __module__ __qualname__rr|rrrzrzsrrzru ctt|tjtjtj fSN) isinstancetyping _GenericAlias_types GenericAlias UnionTypets r_should_collect_from_parametersrs- $$f&9&96;K;KL  rru cVt|tjtjfSr)rrrrrrs rrrs !f22F4G4GHIIrcTt|tjxr |j Sr)rrr_specialrs rrrs !V112E1::~ErTKTVTT_co) covariantT_contra) contravariantru )rc(eZdZfdZfdZxZS)_AnyMetacH|tur tdt| |S)Nz6typing_extensions.Any cannot be used with isinstance())r TypeErrorsuper__instancecheck__)r~obj __class__s rrz_AnyMeta.__instancecheck__s&s{ XYY7,S1 1rc2|turyt| S)Nztyping_extensions.Any)rrr)r~rs rrz_AnyMeta.__repr__ss{.7#% %r)rrrrr __classcell__rs@rrrs 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. cP|tur tdt| |g|i|S)NzAny cannot be instantiated)rrr__new__clsargskwargsrs rrz Any.__new__s/cz <==7?3888 8r)rrr__doc__rrrs@rrrs  9 9rr) metaclassceZdZdZy)_ExtensionsSpecialFormc d|jzSNztyping_extensions._namer}s rrz_ExtensionsSpecialForm.__repr__s#djj00rNrr|rrrrs1rr)_rootcB d|_|S#ttf$rY|SwxYw)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 rr/r/s5, AK   *      c,tj|Sr)rr )names rr7r7 s >>$ r)rurcg}|D]?}t|tr|j|j/|j |At |S)zJAn internal helper for Literal creation: flatten Literals among parameters)r_LiteralGenericAliasextend__args__appendtuple) parametersparamsps r_flatten_literal_paramsrsDA!12 ajj) a  V}rc#8K|D]}|t|fywr)type)rrs r_value_and_type_iterrsAT!W* sceZdZdZdZy)rct|tstStt |j }tt |j }||k(Sr)rrNotImplementedsetrr)r~otherthese_args_dedupedother_args_dedupeds r__eq__z_LiteralGenericAlias.__eq__!sIe%9:%%!$%9$--%H!I !$%9%..%I!J %);; ;rcPttt|jSr)hash frozensetrrr}s r__hash__z_LiteralGenericAlias.__hash__(s "6t}}"EFG GrN)rrrrrr|rrrr s  < HrrceZdZdefdZdZy) _LiteralFormdocc.d|_|x|_|_y)Nr:)r_docr)r~rs r__init__z_LiteralForm.__init__,s"DJ'* *DI rcrt|ts|f}t|}tt |} t |}t |t |krHg}|D],}||vs|j|d|j|.|rJ|t|} t||S#t$rYwxYwNr) rrrlistrrlenrremoverr)r~rval_type_pairs deduped_pairsnew_parameterspairs r __getitem__z_LiteralForm.__getitem__0sj%0(] 0 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 rr<r<esg< D*d +  q|| ,Q^^ < ))     s7A AAct|d|}|jtvrgSt|j}|j|vrgSt ||jj S)z6Return all defined overloads for *func* as a sequence.r)rrrrrvalues)rrmod_dicts rr.r.s` D*d + <<1 1I%all3 >> )IHQ^^,33566rc,tjy)z$Clear all overloads in the registry.N)rclearr|rrr)r)s  "r)rrrrYcJ|jdxr|jdS)N__) startswithendswith)attrs r _is_dunderrst$<t)<_instrr r r) rrraddrobject __setattr__setattrr)r~rval allowed_attrss rrz _SpecialGenericAlias.__setattr__sTGM*f.B.BB!!,/$4=#8""4s3s3rc t|ts|f}dtfd|D}|jrpt||jkrXt|t|jz|jk\r*g||jt||jz d}t|}||jk7r|jr&d|jt|jz }nt |j}|jst |dt d||jkDrdndd|d |d ||j|S) Nz*Parameters to generic types must be types.c3JK|]}tj|ywrr _type_check.0rmsgs r z3_SpecialGenericAlias.__getitem__..sFv!6--a5v # at least  is not a generic classToo manyfew arguments for ; actual , expected )rrr rr rr copy_with)r~r actual_lenexpectedrs @rrz _SpecialGenericAlias.__getitem__s9fe, >CFvFFFK$--/K#dnn"55FQ6QDNN3v;3N3O$PQVJT]]*>>!*4==3t~~;N+N*OPH"4==1H}}#tf,C$DEEZ$--%?6UK%dV,)l+hZA >>&) )r) rrrrrr _tp_cacherrrs@rrrs.48tb & 4    *  *rru)rr)rrr) rSrr^r_rr[rmrUrTrjrAbstractContextManagerAbstractAsyncContextManagerr)zcollections.abc contextlibtyping_extensions>r__match_args____protocol_attrs____non_callable_proto_members__ct}|jddD]`}|jdvrt|di}g|j|D].}|j dr|t vs|j|0b|S)N>rZr>__annotations___abc_)r__mro__rr__dict__r_EXCLUDED_ATTRSr)rattrsbase annotationsrs r_get_protocol_attrsr<sz EE CR  ==3 3 d$5r: 2dmm2k2DOOG,_1L $3 ! Lrc tj|jjddS#tt f$rYywxYw)Nr__main__)sys _getframe f_globalsgetr ValueErrordepths r_callerrFs@}}U#--11*jII J 's.1AArurvct|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)rFrDs r_allow_reckless_class_checksrK)s u~!;;;rcDt|jr tdy)Nz Protocols cannot be instantiated)r _is_protocolrr~rrs r_no_initrO0s : " ">? ? #rc:t|ts tdy)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_1rS4s#t$@A A%rc6eZdZdZdZdZdZdZdefdZ y) _ProtocolMetac |dk(rt|dkrnttjht|zrz|D]u}|ttj ttjhvr0|j tj|jgvr]t|ritd|tjj||||fi|S)Nr>r*z5Protocols can only inherit from other protocols, got )rr>rrrrZr_PROTO_ALLOWLISTrBrr8rrIABCMetar)mclsrbases namespacerr:s rrz_ProtocolMeta.__new__Nsz!c%j1nFOO,s5z9!D6?? SS==,<,@,@RT,UU&t,'##'(, ";;&&tT5)NvN Nrctjj|g|i|t|ddrt ||_yy)NrMF)rIrXrrr<r0rrrs rrz_ProtocolMeta.__init__^s< KK  6t 6v 6sNE2)r__subclasscheck__rrKrSrr1r7rB _proto_hooksortedrrIrX)rrnon_method_attrss rrcz_ProtocolMeta.__subclasscheck__csh--c599^U346s$:EB07#7 66 (();< K07'-c.P.P'Q$#0034D0Ea0K/LAO;;00e< rrrrIrXrKrr0inspectgetattr_staticrr1)rinstancerrs rrz_ProtocolMeta.__instancecheck__}sh--c8<<36{{44S(CCC!7?02!@AA{{,,S(;..!004@C;4s/Q/Q#Q/ &sC  CCctjj||dury|tuxr|tjuS)NT)rIrXrr>rrrs rrz_ProtocolMeta.__eq__s8{{!!#u-5(??u'? ?rreturnc,tj|Sr)rrrs rrz_ProtocolMeta.__hash__s==% %rN) rrrrrrcrrintrr|rrrUrUGs+ O  B  =4 @ @ &S &rrUct|jjddstS|jD]}|jD]o}||jvr|j| tccS;t |di}t |tjjs^||vsct|sotcSy)NrMFr4T) r7rBrr0r6rr collectionsrIrbr8)rrrr:r;s rrdrds||6! !**D 4==(}}T*2--&d,=rB {KOO,C,CD +#E*& &%#+$rcVeZdZejj ZdZdZdZfdZ xZ S)r>r|TFc:t||i||jjdds!t d|j D|_d|jvr t|_|j r)|jtjur t|_ yyy)NrMFc3,K|] }|tuywr)r>rbs rrz-Protocol.__init_subclass__..s&LmqH}msra) r__init_subclass__r7rBany __bases__rMrdrarr>rOrs rrxzProtocol.__init_subclass__s G %t 6v 6<<##NE:#&&Lcmm&L#L "5'2$CLLH4E4E$E' %Fr) rrrrr>r __slots__rMr_rxrrs@rr>r>s,//))  $ ( (rr>ct|tjr t|ddst d|d|_t |tstjdk\rUt|_ |jD]7} tt||d}|r|jj|9|S#t$r}t d|d|d}~wwxYw) 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! rMFz@@runtime_checkable can be only applied to protocol classes, got T)ru r*Nz,Failed to determine whether protocol member z is a method member) issubclassrrZrrr_rrUr? version_inforr1r0callabler Exception)rr is_callablees rrArAs&#v~~.gc>SX6Y$$'7,- -#'  c= )S-=-=-K 25C ... E"*73d+C"DK'::>>tD/ !#FthO--s?B77 CCCrur}c>eZdZdZdZej defdZy)r$z(An ABC with one abstract method __int__.r|rmcyrr|r}s r__int__zSupportsInt.__int__$ rN) rrrrr{rIabstractmethodrprr|rrr$r$s)6   S   rr$c>eZdZdZdZej defdZy)r"z*An ABC with one abstract method __float__.r|rmcyrr|r}s r __float__zSupportsFloat.__float__-rrN) rrrrr{rIrfloatrr|rrr"r"()8   u   rr"c>eZdZdZdZej defdZy)r!z,An ABC with one abstract method __complex__.r|rmcyrr|r}s r __complex__zSupportsComplex.__complex__6rrN) rrrrr{rIrcomplexrr|rrr!r!1s):      rr!c>eZdZdZdZej defdZy)r z*An ABC with one abstract method __bytes__.r|rmcyrr|r}s r __bytes__zSupportsBytes.__bytes__?rrN) rrrrr{rIrbytesrr|rrr r :rrr c:eZdZdZej defdZy)r#r|rmcyrr|r}s r __index__zSupportsIndex.__index__GrrN)rrrr{rIrrprr|rrr#r#Cs&   s   rr#c>eZdZdZdZej defdZy)rz_ An ABC with one abstract method __abs__ that is covariant in its return type. r|rmcyrr|r}s r__abs__zSupportsAbs.__abs__RrrN) rrrrr{rIrrrr|rrrrKs-    T   rrcDeZdZdZdZej ddedefdZ y)r%za An ABC with one abstract method __round__ that is covariant in its return type. r|ndigitsrmcyrr|)r~rs r __round__zSupportsRound.__round__]rrNr) rrrrr{rIrrprrr|rrr%r%Vs4    S    rr%cfd}|S)Nctjjdk(r\tjdkrIt |t d}t |j d|}tj||S|_ |S)Npypyr)__call____mro_entries__r|) r?implementationrr staticmethodrrrJupdate_wrapperr)rcls_dictr mro_entriess rinnerz#_ensure_subclassable..innercsq    " "f ,1A1AF1J(.#/ #<HT]]B1A++AC6 6#.D Krr|)rrs` r_ensure_subclassablerbs  LrrNrOceZdZdZy) SingletonMetac8td|d|j)Nz cannot set z attribute of immutable type rr)rrvalues rrzSingletonMeta.__setattr__ws%dX%B3<.s@%Q:a0%s$&r|r>__orig_bases__r4 __annotate__rz?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typer__required_keys____optional_keys____readonly_keys____mutable_keys__ru__extra_items__z5Special key __extra_items__ does not support Requiredz8Special key __extra_items__ does not support NotRequired)'rrrrZrrOryrdictrrhasattrr _TAKES_MODULEitemsrrrr7updaterBr?rpoprrLrMrrKdiscardr4rrrrr __total__ __closed__r)rrrZnsrrrr: generic_basetp_dictr;own_annotationsrntp required_keys optional_keys readonly_keys mutable_keysextra_items_type base_dictr qualifiersannotation_keys rrz_TypedDictMeta.__new__s:^3FNN8R#%EFF!k&E"8 BR STT@%@@ &0 ! ll>:?T?Tt?TVXYG#G ##z1'+$7$45).&K B&"$%6"72%"4"^"4Q"7"$SC"1!6!6!8#!82v))"c':L:LMM!8 #"1!6!6!8#!82v))"c22!8 # EMEMEM5L*  MM ""9==1BB#GH$$Y]]3F%KL$$Y]]3F%KL$$Y]]3F%KL##IMM2Db$IJ3++g5,?"1"5"56G"H !:?!KL z)##*,#&$3    /3B3H3H3J/ !:?!KL z)!%%n5 J.!%%n5!%%n5!%%n5z) ((8!%%n5 $$^4!)).9!4K$'2G #(1-(@G %(1-(@G %(1-(@G %'0'>G $ %G !'G &6G #NM# #s -O5!O;ctd)Nz4TypedDict does not support instance and class checksrrls rrcz _TypedDictMeta.__subclasscheck__LsRS Sr) rrrrOrrrrcrr|rrrrs&37 ,o b T.rrrr|ctfSr) _TypedDictrZs rrTs rrc |tus|d|turd}nd}d|d|d}|d|zdz}tj|td |d ur |d ur |||d <d}|tur ||d<t}|}n |r t d|r:t jdk\r t 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. rbr* stacklevelFTrrz@TypedDict takes either a dict or keyword arguments, but not bothrGz$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.r4rr|r) _markerwarningswarnDeprecationWarningrOrr?rrrFrrr) typenamefieldsrrrrdeprecated_thingexampledeprecation_msgrrtds rrrTsKr W  #W #M (= HEG#$%OO  O MM/+=! LU"vT'9f>P#)x ,.(3}%* F ,- - 7* FGG MM;#   f .  %B|  Hb"E&(35&L rchttdr|tjuryt|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 rr9r9s, 6; 'B&2B2B,B".//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|)rtyps rr(r(s  rrKcft|trt|jSt |dr5|jt t tfvrt|jdSt|tjr>td|jD}||jk(r|S|j|St tdrgt|tjrMtd|jD}||jk(r|Stj|j|St tdrkt|tjrQtd|jD}||jk(r|St!j"t$j&|S|S)z=Strips Annotated, Required and NotRequired from a given type.rrc32K|]}t|ywr _strip_extrasras rrz _strip_extras..!GJq-"2Jrc32K|]}t|ywrrrs rrz _strip_extras..rrrc32K|]}t|ywrrrs rrz _strip_extras..rr)r_AnnotatedAliasrrrrLrMrKrrrrr&rrrrJreduceoperatoror_)r stripped_argss rrrs> a ) . . 1l # ;PX8Y(Y A/ / a-- .!!GAJJ!GGM *;;}- - 6> *z!V=P=P/Q!!GAJJ!GGM *&&q||]C C 6; 'Jq&:J:J,K!!GAJJ!GGM *##HLL-@ @rcttdrtj|||d}ntj|||}tjdkrt ||||tjdkrH|j Dcic]-\}}|t|tk7r|nt|j/}}}|r|S|j Dcic]\}}|t|c}}Scc}}wcc}}w)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)rrrr) rrr6r?r_clean_optionalrr3rprr)rrrrhintkrs rr6r6s@ 6; '((hD((xQD   g % Cx 9   f $!JJL )DAq!!}-qzz*+)  K04 = 1=## ==>s 2C0C6cTt|tury|jdturyy)z detects Union[..., None] patternFr3T)r3rpr _NoneTypers r_could_be_inserted_optionalr%9s) a= % ::b> *rc|rt|trytj|}|sy|j}|j D]\}}t |r ||vs||||}|t}t|tr|`t|tjr |j}n4|} t| dr| j} t| drt| di}||}n||}tj dkr t#|}n&t#|t|tj }tj$|||} tj dkr$t'| t(urt(| j*} | |k7sJttdsIt| tj,set|tj,r| ||<y)N __wrapped__ __globals__r) is_argumentr)rrr _get_defaultsr4rr%r$rr ModuleTyper7rr'rr?rrW _eval_typer3rprr) rhintsrrroriginal_hintsrroriginal_valuensobjoriginal_evaluateds rr r Ds 3- '', ,, ;;=KD%/6x'D>-+D1N%!*.#.#!#v'8'89#&<< #%e];$)$5$5E&e];#*5-#D"*_&G##f,%/%?N%/&(238I8I(J$J&N"(!2!2>8W!U &(Z8J-Ku-T%*+=+F+F%G""U* ,163C3CD"5&*:*:;0d [)rr&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|||||_yr)rr __metadata__rrr)r~r metadatars rrz_AnnotatedAlias.__init__s?&/2!..9** G VV , (D rcXt|dk(sJ|d}t||jSNrr)rrr4)r~rnew_types rr&z_AnnotatedAlias.copy_withs0v;!# ##ayH"8T->->? ?rcdtj|jddjd|jDdS)Nztyping_extensions.Annotated[, c32K|]}t|ywr)reprrs rrz+_AnnotatedAlias.__repr__..s D2CQa2Cr])r _type_reprrjoinr4r}s rrz_AnnotatedAlias.__repr__sE263D3DT__3U2VVXyy D$2C2C DDEQH Ircbtjt|jg|jffSr)rgetitemr&rr4r}s rrz_AnnotatedAlias.__reduce__s1##DOO@d.?.?@& rct|tstS|j|jk7ry|j|jk(S)NF)rrrrr4r~rs rrz_AnnotatedAlias.__eq__s>e_5%%%"2"22$$(:(:: :rcDt|j|jfSr)rrr4r}s rrz_AnnotatedAlias.__hash__s$*;*;<= =r) rrrrrr&rrrrrrs@rrrs(  ) @  I   ; >rrcDeZdZdZdZdZejdZdZ y)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()] r|ctd)Nz&Type Annotated cannot be instantiated.rr]s rrzAnnotated.__new__DE Erct|trt|dkr tdtt 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) rrrrrrr3rrr)rrallowed_special_formsr rr5s r__class_getitem__zAnnotated.__class_getitem__sfe,F a!/00&.u$5 !&)$(==<++F1Is;VABZ(H"684 4rc4td|jd)NCannot subclass z .Annotated)rrr]s rrxzAnnotated.__init_subclass__s "3>>"2*= rN) rrrrr{rrr)rJrxr|rrr&r&s4 @  F    5  5 r)_BaseGenericAlias)rct|trtSt|tjt t ttfr |jS|tjurtjSy)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_GenericAliasrMr r rrZr s rr3r3sY b/ *  b6//1EGX(/; <==  >> !rcVt|tr|jg|jSt|tj t fr_t|ddry|j}t|tjjur|dturt|dd|df}|Sy)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) rFr|rNr3)rrrr4rrrOrrr3rrrIrSEllipsisr)rress rr2r2s b/ *MM4BOO4 4 b6//1EF Gr:u-++C"~!9!99c!fH>TCH~s2w/JrrCct|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 subscriptablerr~rs rrCrC-s4& 5677ra%Special marker indicating that an assignment should be recognized as a proper type alias definition by type checkers. For example:: Predicate: TypeAlias = Callable[..., bool] It's invalid when used anywhere except as in the example above.c(fd|_|_y)NctuSr)rNdefaultsrrz_set_default..Ls WI%=r) has_default __default__) type_paramrYs `r _set_defaultr]Ks=J$Jrc6td}|dk7r||_yy)NrurDr.)rFr) typevarlikedef_mods r _set_moduleraPs"AG%%!( &rceZdZdZdZeZy) _DefaultMixinzMixin for TypeVarLike defaults.r|N)rrrrr{r]rr|rrrcrcWs)IHrrcceZdZdedefdZy)_TypeVarLikeMeta_TypeVarLikeMeta__instancermc.t||jSr)r_backported_typevarlike)rrfs rrz"_TypeVarLikeMeta.__instancecheck__`s*c&A&ABBrN)rrrrboolrr|rrrere_sC3C4Crre)r cDeZdZdZej ZdddedddZddZ y)r zType variable.NF)boundrrrYinfer_variancec ttdrtj|g|||||d n3tj|g||||d |r|s|r td| _t |t  fd}| _ S)NrDrkrrrlrkrrz1Variance cannot be specified with infer_variance.cjr7|jjt|k(r|jfz }|Sr)rZ__parameters__indexrr[)aliasrtypevars r_tvar_prepare_substz,TypeVar.__new__.._tvar_prepare_substsD''),,227;s4yHW0022D r)rrr rC__infer_variance__r]ra__typing_prepare_subst__) rrrkrrrYrl constraintsrurts @rrzTypeVar.__new__msv/ ..H H53._paramspec_prepare_substs--LL+D >i&;&;&=9T99#8#89DD >#& , G ,  "  2JI . rc(tdtd)Nrzz*.ParamSpec' is not an acceptable base typerros rrxzParamSpec.__init_subclass__sfXJ.XYZ Zrr{) rrrrrrrhrNrrxr|rrrrs*&"("2"2(,#5#()# J [rczeZdZdZej ZedZedZ dddde ddZ dZ d Z d Zd Zd Zy) 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. ct|Sr)r r}s rrzParamSpec.args7s  & &rct|Sr)r r}s rrzParamSpec.kwargs;s "4( (rNFrcDtj||g||_t||_t||_t||_|rtj|d|_ nd|_ tj||t}|dk7r||_ yy)NzBound must be a type.r.) rrrri __covariant____contravariant__rvrr __bound__rcrFr)r~rrkrrrlrYr`s rrzParamSpec.__init__?s MM$ ' DM!%iD %)-%8D "&*>&:D #!'!3!3E;R!S!%  " "4 1iG--").rc~|jrd}n |jrd}n|jrd}nd}||jzS)N+-~)rvrrr)r~prefixs rrzParamSpec.__repr__Qs@&&##''DMM) )rc,tj|Srrrr}s rrzParamSpec.__hash__\??4( (rc ||uSrr|rCs rrzParamSpec.__eq___ 5= rc|jSrrr}s rrzParamSpec.__reduce__b == rcyrr|rNs rrzParamSpec.__call__f r)rrrrrr rpropertyrrrNrrrrrrr|rrrrse, ^NN  '  '  )  )+/%u$)9 *$ * ) ! ! rr _type_convert)allow_special_formsc| tdSt|trLtjdkr t |Stjdkr t ||St |||S|S)z=For converting None to type(None), and strings to ForwardRef.N)rur)rurr)ris_class)rrrr?rrW)rRrrs rrrpsc{Dz!#s###y0%c?*##y0%c&99!#f?RSSJrcheZdZejZdZfdZdZdZ dZ e dZ dZ dZxZS) _ConcatenateGenericAliasFc@t||||_||_yr)rrrr)r~r rrs rrz!_ConcatenateGenericAlias.__init__s G T "$DO DMrctj|jddjfd|jDdS)N[r:c3.K|] }|ywrr|)rrRr>s rrz4_ConcatenateGenericAlias.__repr__..s!K]c*S/]sr=)rr>rr?r)r~r>s @rrz!_ConcatenateGenericAlias.__repr__sF**J!$//23 !KT]]!KKLAO PrcDt|j|jfSr)rrrr}s rrz!_ConcatenateGenericAlias.__hash__s$--89 9rcyrr|rNs rrz!_ConcatenateGenericAlias.__call__rrc:td|jDS)Nc3bK|]'}t|tjtfs$|)ywr)rrr r)rrs rrz:_ConcatenateGenericAlias.__parameters__..s&*rjfnni=X.Y]s%//)rrr}s rrqz'_ConcatenateGenericAlias.__parameters__s !]] rc&t|dtrg|dd|dj}nKt|dttfr g|dd|dS|ddust|dt s t d|j|j|SNr3.MThe last parameter to Concatenate should be a ParamSpec variable or ellipsis.) rrrrrrrrrr~rs rr&z"_ConcatenateGenericAlias.copy_withs&*&>?=6#2;=)<)<=F2Ju 622vbz22bzS(Jvbz9,M!:;;>>$//6: :rc 4 |jttfvrtd||jst|dt |t s|f}td|D}|j}|D]}t|dd}| |||}t |ts-|j|}|t|k(r't|dtturg||j}|t|k\rtd|t|dk(rt|ds |dk(sJ|f}t ||tst ||t rg|d|t ||||dzd}t|}t|}||k7rtd ||kDrd nd d |d |d|t#t%|j| g}|j&D]&} t | t(r|j+| &t | t,ro | } t | t.j0r t3| s7t5t6drt | t6j8rt| ddrt| dt | t5t6dst.j0nt.j0t6j8fr'| j} | rt fd| D} | | } |j+| )|j;t |S)Nz%Cannot subscript already-subscripted rc32K|]}t|ywr)rrrs rrz7_ConcatenateGenericAlias.__getitem__..s!ADq-"2Drrwr[rrrr r!r"r#r$r%r __unpacked__F is not valid as type argumentc3(K|] }| ywrr|)rxsubsts rrz7_ConcatenateGenericAlias.__getitem__..s'D)Qa)s)rrZr>rrqrr _unpack_argsrrrrrrNr[rrrrziprrrr rr _is_unpackrrrr&) r~rrparamprepareralenplennew_argsrR subparamssubargsrs @rrz$_ConcatenateGenericAlias.__getitem__s7H"55"Gv NOO&&4&(? @AAdE*w!AD!ABD((F!%)CTJ&"4.Dy1 U+ASY#E=)DIU99u'8'89CI~'*@(GHH6{a'tAw0G Av v $w"47D1!+474L MIbqI5a>IDQLI1 4t9Dv;Dt|TD[6e:c?#FN; *30C0C D '^U C(3%/M(NOO"6>:(())6+>+>? !$ 2 2I "''D)'D"D!'l$3%4>>%/2 2r)rrrrrrrrrrrrrqr&rrrs@rrr~sK((  !  P  :      ;J 3rrc,eZdZdZfdZfdZxZS)rrc>t|dttfr g|dd|dSt|dtjrg|dd|dj }n%|ddust|dt s tdttj|'|Sr) rrrrrrrrrr&)r~rrs rr&z"_ConcatenateGenericAlias.copy_withsfRj4-86VCR[66":66fRj&*I*IJAvcr{AVBZ-@-@AF *+z&*i/P#%>??V<. s3Q5aJqM5rc3 K|]}|ywrr|)rrs rrz7_ConcatenateGenericAlias.__getitem__..s/A5a5s )rrrrryr)r~rrrs rrz$_ConcatenateGenericAlias.__getitem__ sD+D1eU+3Q53Q0Q /A5/A!BCC r)rrrr&rrrs@rrrs!J V  rc eZdZy)_EllipsisDummyN)rrrr|rrrrsrrc|ddur!tjdkrg|ddt}tjdk\rt||tt fd}n t||}|dtur|St d|jD|_tjdkr|St d |jD|_|S) Nr3.)rurr*rurruT)_typevar_types_paramspec_tvarsc34K|]}|tur|ndyw).Nrrs rrz,_create_concatenate_alias..$s%!C-A'(~&=3!F-Asrc30K|]}|tur|ywrrrs rrz,_create_concatenate_alias..)s!'D2LQ+,N+B()2Ls) r?rrrr rrrrq)r r concatenates r_create_concatenate_aliasrs"~!1!1I!=7z#277  :%.vz8?7K9=? /vzB "~^+ !C-8-A-A!CCK '!!&'D+2L2L'D"DK rc|dk(r tdt|ts|f}|ddust|dts tddgfd|ddD|d}t ||S)Nr|z&Cannot take a Concatenate of no types.r3.rz/Concatenate[arg, ...]: each arg must be a type.c3JK|]}tj|ywrrrs rrz'_concatenate_getitem..9sH1F&&q#.r)rrrrr)r~rrs @r_concatenate_getitemr/sR@AA j% ( ] rNc !Z 2 %J:; ; ;C$H 3BH$rN$J $T: 66rct||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. rrUs rrrCs$D*55rceZdZdZy)_ConcatenateFormct||SrrrUs rrz_ConcatenateForm.__getitem__Ss'j9 9rNrrrrr|rrrrRs :rrrrFcbtj||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.rrrr~ritems rrFrFhs4X!!*6R.ST##D4'22rceZdZdZy)_TypeGuardFormcvtj||jd}tj||fSNz accepts only a single typerrrrrs rrz_TypeGuardForm.__getitem__9%%j)- 4O&PRD''tg6 6rNrr|rrrr 7rrrrGcbtj||d}tj||fS)wSpecial 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 rrGrGs4L!!*6R.ST##D4'22rceZdZdZy) _TypeIsFormcvtj||jd}tj||fSrrrs rrz_TypeIsForm.__getitem__rrNrr|rrrrrrrrrEceZdZdZy) _TypeFormFormc|Srr|r~rs rrz_TypeFormForm.__call__/ JrN)rrrrr|rrrr, s rrcbtj||d}tj||fS)A 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 rrErE2 s3&!!*6R.ST##D4'22rceZdZdZdZy)rcvtj||jd}tj||fSrrrs rrz_TypeFormForm.__getitem__J rrc|Srr|rs rrz_TypeFormForm.__call__O r rN)rrrrrr|rrrrI s  7  rr cpeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z ejd Zy ) _SpecialForm)rr_getitemcV||_|j|_|j|_yr)rrrr)r~rAs rrz_SpecialForm.__init__k s! %%  rc8|dvr |jSt|)N>rr)rr)r~rs r __getattr__z_SpecialForm.__getattr__p s / /:: T""rctd|)NrLr)r~rZs rrz_SpecialForm.__mro_entries__v s*4(344rc d|jSrrr}s rrz_SpecialForm.__repr__y s#DJJ<00rc|jSrrr}s rrz_SpecialForm.__reduce__| s zzrctd|)NzCannot instantiate rr~rkwdss rrz_SpecialForm.__call__ s-dX677rc,tj||fSrrrprCs r__or__z_SpecialForm.__or__ s||D%K((rc,tj||fSrrrCs r__ror__z_SpecialForm.__ror__ s||E4K((rct|d)Nz! cannot be used with isinstance()rrs rrz_SpecialForm.__instancecheck__ 4& ABCCrct|d)Nz! cannot be used with issubclass()r)r~rs rrcz_SpecialForm.__subclasscheck__ r!rc&|j||Sr)rrUs rrz_SpecialForm.__getitem__ s}}T:..rN)rrrr{rrrrrrrrrrcrr)rr|rrrrh sU0I' # 518))DD //rrrct|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. rTrrs rrr s"4& 5677rr ct|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 rTrrs rr r s4& 5677rrIct|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 rTrrs rrIrI s04& 5677rrLcvtj||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 rrLrL s7"!!* None: m["year"] = 1992 # allowed m["title"] = "The Matrix" # typechecker error There is no runtime checking for this property. rrrs rrKrK1 s7 !!* 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)r3rrs rrr s#&((rceZdZfdZxZS)_UnpackSpecialFormc:t||t|_yr)rr _UNPACK_DOCr)r~rArs rrz_UnpackSpecialForm.__init__ s G W %&DLr)rrrrrrs@rr7r7 s  ' 'rr7cteZdZejdkr ej ZedZ edZ fdZ xZ S) _UnpackAliasrc"|jtusJt|jdk(sJ|j\}t |t j tjfr)|jtur td|jSyNrz*Unpack[...] must be used with a tuple type) rrrrrrrrrrrr~rRs r__typing_unpacked_tuple_args__z+_UnpackAlias.__typing_unpacked_tuple_args__ sv??f, ,,t}}%* **==DC# 4 4f6I6IJK>>.#$PQQ||#rc|jtusJt|jdk(sJt |jdt Sr7rrrrrrr}s r#__typing_is_unpacked_typevartuple__z0_UnpackAlias.__typing_is_unpacked_typevartuple__ A??f, ,,t}}%* **dmmA. = =rc>|jr|St| |SrrBrrr~rrs rrz_UnpackAlias.__getitem__ !77 7&t, ,r) rrrr?rrr rrr?rBrrrs@rr;r; sJ   g %I      >  >  - -rr;cbtj||jd}t||fSr.rrrr;rs rrr s/!!* s rr?z+_UnpackAlias.__typing_unpacked_tuple_args__ sk??f, ,,t}}%* **==DC#v334>>.#$PQQ||#rc|jtusJt|jdk(sJt |jdt Sr7rAr}s rrBz0_UnpackAlias.__typing_is_unpacked_typevartuple__ rCrc>|jr|St| |SrrErFs rrz_UnpackAlias.__getitem__ rGr) rrrrr rrr?rBrrrs@rr;r; s<NN      >  >  - -rceZdZdZy) _UnpackFormcbtj||jd}t||fSr.rIrs rrz_UnpackForm.__getitem__ s3%%j)- 4P&QSDtg. .rNrr|rrrRrR s /rrRrc"t|tSrrKr5s rrr rLrcg}|D]=}t|dd}||r|ddus|j|-|j|?|S)Nr?r3.)rrr)rnewargsrRrs rrr sRG#?F  WR[C5G NN7 # NN3   Nr)rrc:eZdZdZej ZeddZdZ y)rzType variable tuple.rXcxtj|t|tfd}|_S)Nc |j}|j}||dzdD] }t|tst d|t |}t |}|}||z dz }d} d} t |D]Q\} } t| trt| dd} | s't | dk(s6| ddus>| t d| } | d} S| t|| }t||| z dz }n||z|kDrt d |d |d |dz |||z k(r&jrtj}n||||z }g|d|| g||z z|| g||z |z |z dz z|||z dS) Nrz(More than one TypeVarTuple parameter in r?r*r3.z6More than one unpacked arbitrary-length tuple argumentrrr$z, expected at least ) rqrrrrrr enumeraterrminrZrr[)rsrrtypevartuple_indexrrrleftrightvar_tuple_indexfillargr"rRr replacementtvts r_typevartuple_prepare_substz9TypeVarTuple.__new__.._typevartuple_prepare_subst s--%+\\#%6"#$6$:$; 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|jywr)rr}s r__iter__zTypeVarTuple.__iter__Z s## #srXc||_tj||t}|dk7r||_t ||_y)Nr.)rrcrrFrrr)r~rrYr`s rrzTypeVarTuple.__init__] s> DM  " "4 1iG--") &t D rc|jSrrr}s rrzTypeVarTuple.__repr__h rrc,tj|Srrr}s rrzTypeVarTuple.__hash__k rrc ||uSrr|rCs rrzTypeVarTuple.__eq__n rrc|jSrrr}s rrzTypeVarTuple.__reduce__q rrc"d|vr tdy)Nrrerrs rrxzTypeVarTuple.__init_subclass__t sd" HII#rN)rrrrrr rrhrNrrrrrrxr|rrrr+ s<) XNN  $-6 - ! ) ! ! Jrr?rrmchtdt|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?stderrr5s rr?r?| s*  c!3!3 67cjjI r_ASSERT_NEVER_REPR_MAX_LENGTHdr'rRcpt|}t|tkDr |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<rrsAssertionError)rRrs rr'r' s@(S  u:5 5889EAEI%QRRr) eq_default order_defaultkw_only_defaultfrozen_defaultfield_specifiersrwrxryrzr{.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)rwrxryrzr{r)__dataclass_transform__) cls_or_fnrwr{rzryrrxs r decoratorz&dataclass_transform..decorator s'(!.#2"0$4 1I - rr|)rwrxryrzr{rrs`````` rr*r* sR  rr=_F)rkcB d|_|S#ttf$rY|SwxYw)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__rrrQs rr=r= s64 #C    *    rr+_Tc teZdZdZedddedejeje de ddfd Z d e de fd Z y) 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. rcategoryrmessagerrrmNct|ts!tdt|j||_||_||_y)Nz2Expected an object of type str for 'message', not )rrrrrrrr)r~rrrs rrzdeprecated.__init__e sJgs+HG}--02#DL$DM(DOrrRc |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}|j$j'rAt(j*dk\r|j,|}n|j$j.|_ x_|_|St1d) Nr) MethodTypec|urtjdztjur |g|i|S|jtjur|s|rt |j d|S)Nrrz() takes no arguments)rrrrrrr)rrrrRrr original_newrs rrz$deprecated.__call__..__new__ svcz cHVWX#6>>9+CA$A&AA8df'3<<.8M(NOO+C00rcJtjdz|i|SNrrrrrrrroriginal_init_subclassrs rrxz.deprecated.__call__..__init_subclass__ ( cHVWX5tFvFFrcJtjdz|i|Srrrs rrxz.deprecated.__call__..__init_subclass__ rrcJtjdz|i|Srr)rrrRrrrs rwrapperz$deprecated.__call__..wrapper s(MM#ZRS^T///rrzY@deprecated decorator with non-None category must be applied to a class or callable, not )rrr__deprecated__rrrJtypesrrwrapsrrxr classmethodrasyncio.coroutinesrh coroutinesiscoroutinefunctionr?rmarkcoroutinefunction _is_coroutiner)r~rRrJrrrxasynciorhrrrrrrs ` @@@@@rrzdeprecated.__call__v s,,C}}HJ%(" C& ,"{{  . 1/ 1+73 ),)>)>&4jA-C-L-L*$Y__%;<G=G-88I,JC)%Y__%;<G=G->C)>AA"W%;36!0 #)  %0&0%%99#>''72"?'"?"?"H070B0B0P0P->AA"W%;003w8r)rrrrrrrrhr Warningrprrrr|rrr+r+; sd( \?Q  ) ) oofkk'&:;  )   ) )"L L "L rcN|duxs t|ttttfSN.)rrrrrrQs rrr s)cz Z %y*BC  rcl|duxs/t|ttttt jfSr)rrrrrrrQs rrr s7cz  Z (//    rc Ltj|r`t|tjrFt |j dk(r.t|j dtr|rt|dsy|st|d|tur;t|dr |j st|dt |j }t |}||k7r|}t|dr|j Dcgc]}t|r|}}td|D}|dkDr |||z k\ry||kr7t||dt t urytd|D}||z}d |}t"j$d k\rd nd }td ||kDrdndd|d|d|d| ycc}w)Check correct count for parameters of a generic cls (internal helper). This gives a nice error message in case of count mismatch. rrNrrqc3<K|]}t|tywr)rrrs rrz!_check_generic.. s#TAJq,$?r[c3JK|]}t|dttuywr[NrrNrs rrz!_check_generic.. *)OCMa*1M9)M09*:CM!#rr argumentsrr r!r" z for r$r%)rhisclassr~rrZrrqrrrrrrrsumrrNr?r) rrelenr expect_valr num_tv_tuplesnum_default_tvthingss r_check_genericr s OOC ZV^^%DC&&'1,3--a0)<":a=1 se#:;< < 7?3 019K9K3%'> ?@@s))*D: 4<Js,-),););Q);A:a=a); Q ##T#T T !A%DD=4H,H$; 4 0-K()%()OCM)O&ONN*D#,TF!3J$'$4$4$?[\FdTD[6e"DAfX#C5 ${:,PQ Q7 Rs 5F!F!c h|st|dt|}||k7r|}t|dra|jDcgc]}t |r|}}||kr7t ||dt t urytd|D}||z}d|}td||kDrdnd d |d |d |ycc}w) rrrqr[Nc3JK|]}t|dttuywrrrs rrz!_check_generic... rrrr r!r"r#r$r%)rrrrqrrrNr)rrrrrrrs rrr s se#:;< <: 4<Js,-),););Q);A:a=a); Q$; 4 0-K()%()OCM)O&ONN*D#,TF!3JdTD[6e"DE$$'5 ${:,PQ Q/ Rs B/B/c, tjd}|jjddk7ry|jjd}|t j uxs|tuxs|t juS#ttf$rYywxYw)Nr*rrFr ) r?r@rArBf_localsrrZr>rrC)framer s r"_has_generic_or_protocol_as_originr< s[ a  ??  z *h 6##H-'Z6X+=Z6??AZZ J 'sBBBct|turyt|}t|xr$t |dk(xrt |dt vS)NFrr)r3rr2rirr_TYPEVARTUPLE_TYPES)rrs r_is_unpacked_typevartuplerR sL!}F" A;D T  1 IN 1 aM0 0r_collect_type_varsc\|tj}g}t}d}d}|D]}t|rd}nmt ||rat |t sQ||vrM|r:t |dttu}|r|r tdd}n|rtd|d|j|t|r/|j|jDcgc] }||vs| c}t |ts|D])}t|gD]} | |vs|j| +t|Scc}w)zCollect all type variable contained in types in order of first appearance (lexicographic order). For example:: _collect_type_vars((T, List[S, T])) == (T, S) FTr[2Type parameter with a default follows TypeVarTupleType parameter 8 without a default follows type parameter with a default)rr rrrr;rrNrrrrrqrr) r typevar_typestvarsenforce_default_orderingdefault_encounteredtype_var_tuple_encounteredrrZr collecteds rrr_ sJ  "NNM$F#G #&+"A(+-1*1m,Z<5PUN+")!]I"Fi"WK"5"+-D#EE.2+,'/!?Q)QRR Q.q1 )9)9L)9AQe^a)9LMAu%A%7%< $E1!LL3&=18U|Ms  D) D) cg}t}d}d}|D]}t|trt|tr/|D])}t |gD]}||vs|j |+St |drU||vsd|r./J&/#A}i@ Q$6+"+-D#EE'26/0"+oaUCU-U#VV%%a(,Q/15. $4b9A *"))!,:AHZ  rc 6|Dcgc]\}}| }}}|Dcic] \}}|tj|d|d"}}}tj||||}|x|_|j _t jdkr||_|Scc}}wcc}}w)Nzfield z annotation must be a typerrr) rrrr namedtupler4rr?r _field_types) rrrrrrrr;nm_tpls r _make_nmtupler s %&1!&#(*#(41a&,,Q&;U0VWW#( *''f19&JBMM!?   f $"-F  '*s B%B>rrr4ceZdZdZy)_NamedTupleMetac t|vsJ|D](}|tus |tjustdt d|D}d|vr|d}nd|vr |dd}ni}g}|D]M}||vr|j ||std|dt |dkDrdnd d d j|t||j|Dcgc]}|| c}|d  } || _ tj|vrcttdrttj| _n4tjjj} t| | _|jD]c\} } | t vrt#d| z| t$vs%| | j&vrt)| | ||  t+| j,} | | | | etj|vr| j;| Scc}w#t.$rT}dt+| j0d| d|}t2j4dk\r|j7|t9||d}~wwxYw#t"$rYwxYw)Nz3can only inherit from a NamedTuple type and Genericc3<K|]}|turtn|ywr) _NamedTupler)rr:s rrz*_NamedTupleMeta.__new__.. sSUT4;#6%D@Urr4rrzNon-default namedtuple field z cannot follow default fieldsrrr:rr_generic_class_getitemz&Cannot overwrite NamedTuple attribute zError calling __set_name__ on z instance z in r)rrrZrrrrr?rrrzrrrrJr_prohibited_namedtuple_fieldsr_special_namedtuple_fields_fieldsrr __set_name__ BaseExceptionrr?radd_note RuntimeErrorrx)rrrZrr:r default_names field_namerr class_getitemkeyrset_namerrs rrz_NamedTupleMeta.__new__ s%' ''{*t6>>/I#MOOSUSSE B&,-2%*>*1-M# #!((4"#&CJ<PB.1-.@1.Ds"&MQ'+yy'?&@%BCC $#%++-)67A"Q%7,'F %F ~~&6#;? *s1 H ;I& H I#AII#& I21I2N)rrrrr|rrrr sC rrrc$t|vsJtfSr)rrrs r_namedtuple_mro_entriesr,sU"""~rc ~|tur|rd}d}nDd}d|d|d}d|zdz}n0|!|r td d }d|d|d}d|zdz}n |r td |tus|=tjj d t d|j }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. rbz\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) rrrrformatrrrrFrr)rrrrrrnts rrr0s%* W #X H $X hZ~h\H0 # " #" ^F $N hZ~h\H0 # " #" GH H W  MM&&,'M rceZdZdZy)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)rrrrr|rrrrvs rr4c |jjd|jS#t$r#t dt |j dwxYw)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)r7rBrzrrrrros rr4r4sW* <<##$4cmmD D 4T#Y5G5G4JK  s %(,AcZeZdZdZdZdZdZdZdZe jdk\rdZ d Z y y ) 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|Srr|rs rrzNewType.__call__r rc||_d|vr|jdd}||_||_t }|dk7r||_yy)Nrbr3r.)r rpartitionr __supertype__rFr)r~rrr`s rrzNewType.__init__sO $D d{s+B/ DM!#D iG--").rc:|jGfdd}|fS)NceZdZfdZy)&NewType.__mro_entries__..Dummyc F|j}td|d|dd)NzGCannot subclass an instance of NewType. Perhaps you were looking for: `z = NewType(r:z)`)rr)r subcls_name supercls_names rrxz8NewType.__mro_entries__..Dummy.__init_subclass__s8"%,,K#'= K?"]OSUWrN)rrrrx)rsrDummyrsrrr)r~rZrrs @rrzNewType.__mro_entries__s!!MMM  8Orc8|jd|jS)Nrb)rrr}s rrzNewType.__repr__soo&a(9(9':; ;rc|jSr)rr}s rrzNewType.__reduce__s$$ $rrc,tj||fSrrrCs rrzNewType.__or__s||D%K00rc,tj||fSrrrCs rrzNewType.__ror__s||E4K00rN) rrrrrrrrrr?rrrr|rrr;r;s?   *   < %   w & 1 1 'rr;rcv|duxs4t|ttjtjt fS)z:Corresponds to is_unionable() in unionobject.c in CPython.N)rrrrrrDr5s r _is_unionablers9d{ j         /   r> rrrzrrrrr __reduce_ex__rqrr?cJeZdZdZej dkr fdZxZSxZS)_TypeAliasGenericAliascj|tvrtj||St|j|Sr) _ATTRIBUTE_DELEGATION_EXCLUSIONSrrrr)r~rs rrz"_TypeAliasGenericAlias.__getattr__s/;;!--dD99t55rrcFt||}t||_|Sr)rrrr)r~rresultrs rrz"_TypeAliasGenericAlias.__getitem__s#"W06F'+DzF$!Mr)rrrrr?rrrrs@rrrs' 6 &("")rrceZdZdZdddefdZdededdffd Zdedefd Z dedefd Z defd Z e jd krddZdZdZdZdZdZe jdk\r dZdZxZSxZS)rDaCreate 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_paramsrc&t|ts tdt|ts td||_||_d}g}|D]}t|t ttfr t|rtd|t|dttu}|r|std|d|rd}t|tr|j||j|t||_t}|d k7r||_||_y) Nz#TypeAliasType name must be a stringztype_params must be a tupleFzExpected a type param, got r[znon-default type parameter 'z ' follows default type parameterTr.)rrrr __value____type_params__r rrrrrNrrrqrFrr) r~rrr default_value_encounteredrr\rZr`s rrzTypeAliasType.__init__:sdC( EFFk51 =>>"DN#.D (- %J) ":y/QR"*-#&A*$PQQJ yAR-[#&B:.QF%FGG04-j,7%%j1%%j1'*(#( "3D iG--") DMrrrmNc`t|dr|j|t| ||y)Nr)r_raise_attribute_errorrr)r~rrrs rrzTypeAliasType.__setattr___s*tZ(++D1 G e ,rc&|j|yr)rr~rs r __delattr__zTypeAliasType.__delattr__ds  ' ' -rcf|dk(r td|dvrtd|dtd|d)Nrzreadonly attribute>r rrqr z attribute 'z3' of 'typing.TypeAliasType' objects is not writablez0'typing.TypeAliasType' object has no attribute '')rrs rrz$TypeAliasType._raise_attribute_errorgsXz!$%9::YY$!$(&& %FtfANrc|jSrrr}s rrzTypeAliasType.__repr__urrrc|dury|yt|tr(|dk(r#|Dcgc]}|j||dzc}Stj|d|j dScc}w)N.rr Subscripting  requires a type.)rr_check_single_paramrrr)r~r recursionrRs rrz!TypeAliasType._check_single_paramysC<=eT*yA~',.',!44S)A+F',..))t}}o=NO.sA%cztjdkrtfd|DStfd|DS)Nrc3@K|]}j|ywr)rrrr~s rrz2TypeAliasType._check_parameters..s$ *,,T2 *sc3fK|](}tj|djd*yw)rrN)rrrrs rrz2TypeAliasType._check_parameters..s;!+ ++ dmm_>> from typing_extensions import Protocol, is_protocol >>> class P(Protocol): ... def a(self) -> str: ... ... b: int >>> is_protocol(P) True >>> is_protocol(int) False rMF)rrrr>rr s rr8r8sD r4  *NE2 *(" *&//)  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 Protocolr0)r8rrrr0r<r s rr5r5sK2rf$678 8 2+ ,R223 3,R011rr,cHeZdZdZdeddfdZdefdZdefdZde de fd Z y) 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: ... documentationrmNc||_yrr+)r~r+s rrz Doc.__init__s !.D rc"d|jdS)NzDoc()r-r}s rrz Doc.__repr__s$,,/q1 1rc,t|jSr)rr+r}s rrz Doc.__hash__s**+ +rrc`t|tstS|j|jk(Sr)rr,rr+rCs rrz Doc.__eq__ s)eS)%%%%)<)<< r'rJpartialrr(reval)rrr8r9robj_dictann obj_globals module_namer obj_localsunwraprrr r return_values rr1r15sJ fll2WX X c4 sJ5HGHe4ll#4d;c6#>#>?CK!#|T:Kd;")&*d"CKd3iJF V.. /#0$7C,,KJF c]#0$7C!#}d;KJF S+ ,%%C04 4K 4*vsg%JKL L ;I#t$w&QRS SI&'*iik&1 U*UC"8f>O>OPU>VV&19   6=1#//Ffi&7&78#[[Fv}-$00 ?!G >%2F "#'8"= =; =9DEenne+ENF"iik,) U#E3/ET%&5QR) ,A6F,s:2K6K#*Kr-ownerrr8r c |jr |jSt|dd' |jj}d|_||_|S| t|dd}|Bt|dd5tt jj|jddd}| t|dd}|t|tr?t|dd}|rpt jj|d}|rNt|dd}n@t|tjrt|dd}nt|r t|dd}|i}|,i}t|tr|jt!||| t|dd}|Wt#|}t#|}|D]<}|j$} t&r |j(r| |vs&||| <|j+| d>|j,} | j/rTt1j2| s?| |vr|| }nN| |vr|| }nDt5t6| rtt6| St9| |j:} t=| ||}d|_||_|S#t $rY4wxYw) N__cell__T __owner____forward_module__r7r(rr )__forward_evaluated____forward_value__rrJ cell_contentsrCr?r<rBrLrrrr+rrr=rr_FORWARD_REF_HAS_CLASSrxr__forward_arg__ isidentifierkeyword iskeywordrbuiltins NameError__forward_code__r?) forward_refrHrr8r rrCrr param_namerRcodes r_eval_with_ownerr[s  , ,00 0 ; D 1 = #,,::59 105 - =Kd;E O %94@L  > >EzSWG ?k=$?G ?%&%e\4@  [[__[$?F")&*d"CE6#4#45!%T:%!%= ?G >F%& d5k*  5#4"%):DAK  "7mG&\F$"^^ *;3S3Sw.*/GJ'JJz40 %))    g&7&7&<f}s  3'x--n$//Dw/E,0 )(- % ]  sI55 JJrrcttdrtjdk\sdtjddcxkrdkrnntj|||}ntdtj j vrtj|| }n@tj|}n*| tdSt|tr t |S|}ttf}|s|tfz }|r |tfz }t|tjrt||vrt!|d d|t"t$t&t(t*t,fvr|S|r|ttfvr|St|t.tj.fs|ttfvrt!d |d dt|t0urt!|d |d d|S)zG A lax Python 3.11+ like version of typing._type_check rr)rurrNrurr\rLrrzPlain z Got z.100rb)rrr?rrrWr{rrrrZr>rrrr3rrrrJrIr rCrr)rrr)rrtype_invalid_generic_formss r_lax_type_checkr`s 6? +  J. 0 0! 4>w>,,!(; &):):)D)DD,,U6B,,U3}Dz!%%!%((E!(( 3" !h[ 0 !%%1% uf22 35!%::ug%CDE4 O S-5$ J JL 5Xu,=#=L u|V-@-@A B(++fUG+IJKQU U ;% se5a89 9 r)rHrr8r r_recursive_guardc |tjk(r |jS|j|vr|S t|||||}d}t s|j } n |j} t|||j| } t| tr!t| ddd}t| ||||||Stjdkr6|r4|r t!|ni}|D] } | j"|vs| || j"<"tjd krt%j&| ||Stjdkr't%j&| ||||jhz Stjd kr(t%j&| |||||jhz St%j&| |||||jhz|| S#t$r|tj k(r|cYSwxYw) 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. rGz*Forward references must evaluate to types.)r)rrLTN)rr8r rHrar)rur}r)recursive_guardr)rdrrH)r0r7rQr[rVr6rP__forward_is_argument__rxr`rrWrr-r?rrrrr,) rXrHrr8r rrarrrr^tvars rr-r-Bs@ V]] ".. .  & &*: :  $' E;%&1&I&I"I "-"B"B   #;; 3   eZ (u2D9E'(!1&     j ([%+T&\F#==.,0F4==)$   f $$$    j ($$ 0K4O4O3P P     g %$$ 0K4O4O3P P       , 0K0K/LL  q ***""  sF??G!G!)r*)ru)NNF)NNr)r|)T(rIrUrrcollections.abcr-enumrJrhrSrr?rrrr__all__PEP_560r GenericMetar_PEP_696_IMPLEMENTEDrWr{rPrzrrrJr rrrrrrrrrrrr/r7r:rrrrrrrr<r.r) defaultdictr>rrr rrrrrrrrrrBrHrrrrYrrrrr$r+rhrir,rWrEXCLUDED_ATTRIBUTESr8r<rFr>rKrOrSrUrrdrZrAr@r$r"r!r r#rr%r_NEEDS_SINGLETONMETArrNrrOr_PEP_728_IMPLEMENTEDrrr9 signaturerrrrrrr r(r6rr%r r&rr3r2rM ImportErrorrrOrCr]rarcrer r r}rrrrrrr)rrrrFrrGrrEr_Finalrr rIrLrMr,rKr2r9rrr7r;rRrrr?rsr'r*rorprSr=rr+rrrrrrrrrr _prohibitedrrrrrrABCregister memoryview bytearrayrr4r;rDrrrr8r5rXrr, _CapsuleType_socket_CAPIr2rr1__kwdefaults___PEP_649_OR_749_IMPLEMENTEDIntEnumr0r5r-r[r`rPrQrRrTrUrVr[r\r]r^r_r`rarbrcrdrerfrgrirjrkrlrmrnrqrrrsrtr|rrrs    ~ B  ''+==063D3D3N3NN  +w  JF ??FNN3V^^DV^^Dv~~f- 6>>*D 9w &4 & 9 9 ??1V001  w LLE @ z!nnG Hv334 H:-T:< 1 2G(( 6?#H((M,,O100 +1148&P 7# {{       $$ $$      .. ?? {{$$ ))UU=#*&(<(<#0*:$0*dT I$!!1 9/EI*&&YLN*)) //$') N /.. "//$') ,-JK" F667; wH<@B&b&V__-b&H0(6>>](,w001j w$$K((M,,O((M((M$$K((Mh(htn   $$KGFN,K(K 6;  I - I 6>"&&L "] "$%L   I**N&&L 1 1 1&2D2D E P PPM*y.y.vnk2rBJ56e  e7eNv'("11>B*,0" 6=!$$K   6:**N03>jT I71t 6;  I,,O%>&..d%>N88zBQ7"""JH1,4?00 6;  IbqV# 8 8'  I% )CtC #Y,#YN 6?#((M,,O7 7.7*70  V[!+[.+[bbD-bLv}% 6? + 5 ,, v34v3t &>> '! v'F'Fd ,0 7 7w$$KbqV# 6 6:1:#   K 6;  IbqV#,3,3^7/t7 ) + I\ 68 ]]FbqV#&3&3R7,D7 # % FP 6:HbqV#.d 33,.d  H,(/6==(/V 6?#((M88& 66 ;;D88" 67 LLE884 6:H$$KbqV#33&33"7.d7   H"    K  6:HbqV#33&7.d7   H$' Tw ]]F) bqV#'34' -v++4-6++--v++4-2/,D/ { 3F-# V^$;F!1;F|KJ}KJ\ 6=!$$K!( 623$*$H$H!$'! 6>"&&LS%SuS4w 44 # %$ SSS S  S !,, LLVZZ0&//#vzz/2RR S   S**S !a Sl 6:H FOOCO$D EB!b!!H 8\"$$J  BGGRg  (v~&-43Qn QD*F[D[&$WV^T%JKD 6'(.`!3F6!p %8"w""J %+$6$6!!*+X!YD$DL,, b"EK12$+?3?D ;??H% __ # #F  * OOJ OOI OOE 6'(22>wnnG9191xw((M  '!,5 6 , ( "V%9%9 "^0^0B 6=!$$K!66  D *22V-=-=c-B2* 65 **C==@v}d3 '.  ;LK NN=! G&';..d:;G++:::T\\ --O(,TE%||{| 6)*!66#D4Vr!%104%1l||"n j   ?? ??        {{       .. ?? YY    ?? ?? ?? {{ ..   &&((    ?? ..    ?? jj         {{$$  88S_ 1"001 4%334~P    sEAI AI8AJI AI5I4AI5I8AJ J AJ JAJJAJ