K irddlZddlZddlZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddlZddlZe j dk\rddlZgdZdZeZe j dk\Zdej.j0vZGddZeZe j d k\rd Znd Zej:Zej<d Zej<d Z ej<dZ!ej<ddZ"ej<ddZ#e j dk\rddlm$Z$nGddeZ%Gdde%Z$ejLZ&GddejNdZ(GddejPdZ)ejTZ*e j dk\r ejVZ+ndZ+e,ed r ejZZ-nd!Z-d"Z.e j d#k\r ej^Z/n3d$Z0d%Z1Gd&d'ejddZ3Gd(d)e)dZ4e4d*+Z/ejjZ5e,ed,r%ejlZ6ejnZ7ejpZ8n6ejrejtejre;Zej~Z?ejZ@ejZAejZBejZCejZDejZEejZFejZGejZHe j dk\r dd0lmIZImJZJmKZKmLZLnd1ZMGd2d3ejdZNedZOeNejjd4eOeOf5ZLeNejjd6eOf5ZJeNejd6d7ejeRf8ZKeNejd6d9ejeRf8ZIgd:d;dZTeUejhd?zZWd@ZXd dAZYe j dBk\r ejZZnEd dCZ[dDZ\dEZ]GdFdGeejZ^e_dHZ`GdIdJeje^ZZe j dBk\r ejZbndKZbebZce j dLk\rUejZdejZeejZfejZgejZhejZiejZjnvebGdMdNeZZdebGdOdPeZZeebGdQdReZZfebGdSdTeZZgebGdUdVeZZhebGdWdXeZe"ZiebGdYdZeZe"Zje,ed[r"e,ed\rejZkejZln&ebGd]d[eZe"ZkebGd^d\eZe#Zle,ed_ xs e,ed` Zmemr GdadbeZne,ed_r ejZonGdcddenZpepZo[pe,ed`r ejZqnGdedfenZrerZq[remr[ndgZsesr%ejZtejZuejZvnsdhejejjvZzdiZ{GdjdkeZuejeudldmiZ}dnZ~Gdodpe(dZedqZtejeufZdrZve,edsrejZndtZe,edurejZndvZd dwZedZOdxZd dyZe j d k\rej ZejZndzZd{Ze,ed|rejZne)d}Zd~ZdZGddZGddeZerddlmZn GddeZe,edrejZejZn GddZGddeZGddeZerddlmZn"e,edr GddeZn GddeeZe,eds+e,eds d dgddZn ej$ZGddeZn4ej&Ze j dkrGddej&dZGddZdZej,dZe j dk\rej0Zne)dZe,edrej2Zne)dZe,edrej4Zne)dZe,edrej6ZnGdde)dZedZe,edrej:Zne(dZe,edrej<Zne(dZe,edrej>Zne(dZe,edrej@ZejBZne)dZe)dZe,edurejDZne)dZdZe j dLk\rejHZdZn/Gdde)dZGddejddZedZdZdZerddlmZn!e,edr GddeZn GddeZe,edrejTZndedefdZe,edrejVZndZe,ed«rejXZndedefdĄZe j dLk\rejZZnddgdgdgdmdŜdeRdeRdeRdeRdej\ej^ejzejHej`dejHffdfdejHdej`egeffd̈́Ze,edΫrejbZn6ej<dej`dejHfЫZdedefdфZe j dk\rejfZnej<dӫZGdԄdիZe j d krdքZndׄZe,edsefd؄ZndلZesee_deRfdڄZeeeddhZdeRfdۄZe,edܫr d d݄Zee_n dބZesee_e j dBk\rejzZnJdd߄Zej~ZeUhdZGddeZejeddmiZdZefdZee_e,ejd=rejjZnLGdd=ejZeƐjeɫeƐjeʫeƐje˫e,e dre jZndZe j dk\rejZn GddZe j dk\rejZnPe j dLk\rdZndZe j d kr!eUhdZGddejddZGddZe,edrejZejZndedeRfdZdedejefdZe,edrejZn GddZee ddZe׀ ddlZeeddZeف ee٫Z eׁeZejde j dk\r ddlmZmZn*GddejZdddgeݐjddZe,edrejZnddddddZdddddeUddZGddZe j dk\rejZndZgdZejeDcic]}e,e|s |ee|c}ejZaej.ZejZy#e$rY$wxYwcc}w(N)wAnyClassVar ConcatenateFinal LiteralString ParamSpec ParamSpecArgsParamSpecKwargsSelfTypeTypeVar TypeVarTupleUnpack Awaitable AsyncIterator AsyncIterable CoroutineAsyncGeneratorAsyncContextManagerBufferChainMapContextManagerCounterDeque DefaultDict NamedTuple OrderedDict TypedDict SupportsAbs SupportsBytesSupportsComplex SupportsFloat SupportsIndex SupportsInt SupportsRoundReaderWriter Annotated assert_never assert_typeclear_overloadsdataclass_transform deprecated disjoint_baseDocevaluate_forward_ref get_overloadsfinalFormatget_annotationsget_args get_originget_original_basesget_protocol_membersget_type_hintsIntVar is_protocol is_typeddictLiteralNewTypeoverloadoverrideProtocolSentinel reveal_typeruntimeruntime_checkableText TypeAlias TypeAliasTypeTypeForm TypeGuardTypeIs TYPE_CHECKING type_reprNeverNoReturnReadOnlyRequired NotRequired NoDefault NoExtraItems AbstractSetAnyStrBinaryIOCallable Collection ContainerDict ForwardRef FrozenSet GeneratorGenericHashableIO ItemsViewIterableIteratorKeysViewListMapping MappingViewMatchMutableMappingMutableSequence MutableSetOptionalPattern ReversibleSequenceSetSizedTextIOTupleUnion ValuesViewcast no_type_checkno_type_check_decoratorT)r rbeta__forward_is_class__ceZdZdZy) _Sentinelcy)Nz selfs W/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/typing_extensions.py__repr__z_Sentinel.__repr__sN__name__ __module__ __qualname__rrrrrrsrrr ctt|tjtjtj fSN) isinstancetyping _GenericAlias_types GenericAlias UnionTypets r_should_collect_from_parametersrs- $$f&9&96;K;KL  rcVt|tjtjfSr)rrrrrrs rrrs !f22F4G4GHIIrTKTVTT_co) covariantT_contra) contravariantr )rc(eZdZfdZfdZxZS)_AnyMetacH|tur tdt| |S)Nz6typing_extensions.Any cannot be used with isinstance())r TypeErrorsuper__instancecheck__)robj __class__s rrz_AnyMeta.__instancecheck__s&s{ XYY7,S1 1rc2|turyt| S)Nztyping_extensions.Any)rrr)rrs 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) metaclasscpeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z ejd Zy ) _SpecialForm)_namer_getitemcV||_|j|_|j|_yr)rrrr)rgetitems r__init__z_SpecialForm.__init__s! %%  rc8|dvr |jSt|)N>rr)rAttributeError)ritems r __getattr__z_SpecialForm.__getattr__s / /:: T""rctd|)NzCannot subclass rrbasess r__mro_entries__z_SpecialForm.__mro_entries__s*4(344rc d|jSNztyping_extensions.rrs rrz_SpecialForm.__repr__s#DJJ<00rc|jSrrrs r __reduce__z_SpecialForm.__reduce__ zzrctd|)NzCannot instantiate rrrkwdss r__call__z_SpecialForm.__call__s-dX677rc,tj||fSrrrxrothers r__or__z_SpecialForm.__or__s||D%K((rc,tj||fSrrrs r__ror__z_SpecialForm.__ror__s||E4K((rct|d)Nz! cannot be used with isinstance()rrrs rrz_SpecialForm.__instancecheck__ 4& ABCCrct|d)Nz! cannot be used with issubclass()r)rrs r__subclasscheck__z_SpecialForm.__subclasscheck__ rrc&|j||Sr)rr parameterss r __getitem__z_SpecialForm.__getitem__s}}T:..rN)rrr __slots__rrrrrrrrrrr _tp_cacherrrrrrsU0I' # 518))DD //rr)_rootceZdZdZy)_ExtensionsSpecialFormc d|jzSrrrs rrz_ExtensionsSpecialForm.__repr__s#djj00rNrrrrrrs1rrcB 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__rr)fs rr5r5%s5, AK   *      r1cd|_|S)a<This decorator marks a class as a disjoint base. Child classes of a disjoint base cannot inherit from other disjoint bases that are not parent classes of the disjoint base. For example: @disjoint_base class Disjoint1: pass @disjoint_base class Disjoint2: pass class Disjoint3(Disjoint1, Disjoint2): pass # Type checker error Type checkers can use knowledge of disjoint bases to detect unreachable code and determine when two types can overlap. See PEP 800.T)__disjoint_base__rs rr1r1Hs(!% rc,tj|Sr)rrnames rr=r=`s >>$ r)rrcg}|D]?}t|tr|j|j/|j |At |S)zJAn internal helper for Literal creation: flatten Literals among parameters)r_LiteralGenericAliasextend__args__appendtuple)rparamsps r_flatten_literal_paramsrisI !A!12 ajj) a  ! V}rc#8K|D]}|t|fywr)type)rrs r_value_and_type_iterrss# AT!W*  sceZdZdZdZy)rct|tstStt |j }tt |j }||k(Sr)rrNotImplementedsetrr)rrthese_args_dedupedother_args_dedupeds r__eq__z_LiteralGenericAlias.__eq__xsIe%9:%%!$%9$--%H!I !$%9%..%I!J %);; ;rcPttt|jSr)hash frozensetrrrs r__hash__z_LiteralGenericAlias.__hash__s "6t}}"EFG GrN)rrrrr rrrrrws  < HrrceZdZdefdZdZy) _LiteralFormdocc.d|_|x|_|_y)Nr@)r_docr)rr s rrz_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)rrval_type_pairs deduped_pairsnew_parameterspairs rrz_LiteralForm.__getitem__sj%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 rrBrBsg< D*d +  q|| ,Q^^ < ))     s7A AAct|d|}|jtvrgSt|j}|j|vrgSt ||jj S)z6Return all defined overloads for *func* as a sequence.r)rrrrrvalues)r rmod_dicts rr4r4s` D*d + <<1 1I%all3 >> )IHQ^^,33566rc,tjy)z$Clear all overloads in the registry.N)rclearrrrr.r.s  "r)rrrracJ|jdxr|jdS)N__) startswithendswith)attrs r _is_dunderr+ st$<t)<_instr_nparamsr1)r+object __setattr__setattr __origin__)rr*val allowed_attrss rr8z _SpecialGenericAlias.__setattr__s8GM$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__..sF!6--a5F # at least  is not a generic classToo manyfew arguments for ; actual , expected )rrr1rr6rr copy_with)rr actual_lenexpectedrCs @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) rrrrr8rrrrrs@rr-r-s.48tb & 4    *  *rr-r)r/r)rr/r) r[rrfrgrrcrur]r\rrrAbstractContextManagerAbstractAsyncContextManagerr)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>rbrD__annotations___abc_)r__mro__rr__dict__r(_EXCLUDED_ATTRSadd)rattrsbase annotationsr*s r_get_protocol_attrsrd[s EE CR   ==3 3 d$5r: 2dmm2k2 DOOG,_1L $   Lrc tj|dzxs|S#t$rYnwxYw tj|dzjj d|S#tt f$rYywxYw)Nrr)sys_getframemodulenamer _getframe f_globalsget ValueError)depthdefaults r_callerrngsx &&uqy1Nabc functools)rnrls r_allow_reckless_class_checksrtys u~!;;;rcDt|jr tdy)Nz Protocols cannot be instantiated)r _is_protocolrrrrs r_no_initrxs : " ">? ? #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_1r|s#t$@A A%rc6eZdZdZdZdZdZdZdefdZ y) _ProtocolMetac |dk(rt|dkrnttjht|zrz|D]u}|ttj ttjhvr0|j tj|jgvr]t|ritd|tjj||||fi|S)NrDrQz5Protocols can only inherit from other protocols, got )rrDrrr7rbr_PROTO_ALLOWLISTrjrr>rrqABCMetar)mclsrr namespacerrbs rrz_ProtocolMeta.__new__sz!c%j1nFOO,s5z9! D6?? SS==,<,@,@RT,UU&t,'##'(, ;;&&tT5)NvN Nrctjj|g|i|t|ddrt ||_yy)NrvF)rqrrrrdrWrrrs rrz_ProtocolMeta.__init__s< KK  6t 6v 6sNE2))rrr*rbrcs rrrs||6! !** &D  &4==(}}T*2--&d,=rB {KOO,C,CD +#E* & &%# &$rcVeZdZejj ZdZdZdZfdZ xZ S)rDrTFc:t||i||jjdds!t d|j D|_d|jvr t|_|j r)|jtjur t|_ yyy)NrvFc3,K|] }|tuywr)rDrBbs rrDz-Protocol.__init_subclass__..s&LqH}&Lsr) r__init_subclass__r^rjany __bases__rvrrrrDrxrs rrzProtocol.__init_subclass__s G %t 6v 6<<##NE:#&&Lcmm&L#L "5'2$CLLH4E4E$E' %Fr) rrrrrDrrrvrrrrs@rrDrDs,//))  $ ( (rrDct|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! rvFz@@runtime_checkable can be only applied to protocol classes, got T)r rQNz,Failed to determine whether protocol member z is a method member) issubclassrrbrrrrr~rf version_inforrXrWcallabler` Exception)rr* is_callablees rrHrH.s&#v~~.gc>SX6Y$$'7,- -#'  c= )S-=-=-K 25C ... E E"*73d+C"DK'::>>tD E !#FthO--s?B77 CCCrrc>eZdZdZdZej defdZy)r'z(An ABC with one abstract method __int__.rrcyrrrs r__int__zSupportsInt.__int__v rN) rrrrrrqabstractmethodrrrrrr'r'qs)6   S   rr'c>eZdZdZdZej defdZy)r%z*An ABC with one abstract method __float__.rrcyrrrs r __float__zSupportsFloat.__float__rrN) rrrrrrqrfloatrrrrr%r%z)8   u   rr%c>eZdZdZdZej defdZy)r$z,An ABC with one abstract method __complex__.rrcyrrrs r __complex__zSupportsComplex.__complex__rrN) rrrrrrqrcomplexrrrrr$r$s):      rr$c>eZdZdZdZej defdZy)r#z*An ABC with one abstract method __bytes__.rrcyrrrs r __bytes__zSupportsBytes.__bytes__rrN) rrrrrrqrbytesrrrrr#r#rrr#c:eZdZdZej defdZy)r&rrcyrrrs r __index__zSupportsIndex.__index__rrN)rrrrrqrrrrrrr&r&s&   s   rr&c>eZdZdZdZej defdZy)r"z_ An ABC with one abstract method __abs__ that is covariant in its return type. rrcyrrrs r__abs__zSupportsAbs.__abs__rrN) rrrrrrqrrrrrrr"r"s-    T   rr"cDeZdZdZdZej ddedefdZ y)r(za An ABC with one abstract method __round__ that is covariant in its return type. rndigitsrcyrr)rrs r __round__zSupportsRound.__round__rrNr) rrrrrrqrrrrrrrr(r(s4    S    rr(r)r*cDeZdZdZdZej ddedefdZ y)r)zeProtocol for simple I/O reader instances. This protocol only supports blocking I/O. rsizercy)zRead data from the input stream and return it. If *size* is specified, at most *size* items (bytes/characters) will be read. Nr)rrs rreadz Reader.readrN).) rrrrrrqrrrrrrrr)r)s4    S d   rcBeZdZdZdZej dedefdZ y)r*zeProtocol for simple I/O writer instances. This protocol only supports blocking I/O. rdatarcy)zIWrite *data* to the output stream and return the number of items written.Nr)rrs rwritez Writer.writerrN) rrrrrrqrrrrrrrr*r*s8    \h \c \  \rrVrWceZdZdZy) SingletonMetac8td|d|j)Nz cannot set z attribute of immutable type rr)rr*values rr8zSingletonMeta.__setattr__s%dX%B3<|vr t d|}| j9j/D]\}}t5t;|}t<|vr| jA|n?t>|vr|jA|n%|r| jA|n|jA|tB|vr#|jE||jA||jA||jE|tjd k\rfd}|_#n| _$tK| _&tK|_'tK|_(tK|_)|_*|_+|_,Scc} } wcc} } w)aICreate new typed dict class object. This method is called when TypedDict is subclassed, or when TypedDict is instantiated. This way TypedDict supports all three syntax forms described in its docstring. Subclasses and instances of TypedDict return actual dictionaries. zHcannot inherit from both a TypedDict type and a non-TypedDict base classNzCannot combine closed=z and extra_itemsc3PK|]}t|tj ywr)rrrbrs rrDz)_TypedDictMeta.__new__..Ms@Q:a0@s$&rr[rD__orig_bases__r!get_annotate_from_class_namespace __annotate__ownerz?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typer__required_keys____optional_keys____readonly_keys____mutable_keys____extra_items__z5Special key __extra_items__ does not support Requiredz8Special key __extra_items__ does not support NotRequiredc ^i}D]C}|tur |j}|tj|||}|j |E otj | }|t j k7r|jDcic](\}}|tj| j*}}}nY|t j k(rtj }n0|t jt jfvr }n t||j ||Scc}}w)Nrr)rbr annotationlibcall_annotate_functionupdater6STRINGitemsrr@rannotations_to_string FORWARDREFVALUENotImplementedError)formatannosrb base_annotate base_annosownntprrC own_annotateown_annotationsown_checked_annotationstp_dicts rrz,_TypedDictMeta.__new__..__annotate__s"E %17?$(,(9(9 (0$%2%I%I)6&?  Z01$/+BB(&A!V]]2.1YY[#$)Ar!"6#5#5b#gFXFX#Y Y#C# 6==0+AA/RF$5$5v||#DD51&99LL% L#s -D))-rrrrbrrWrpoprdictrrhasattrrrfrrrrjrr6r _TAKES_MODULErr@rrr^rrrTrUr`rSdiscardrr[rrrrr __total__ __closed__r)rrrnsrrrrb generic_basens_annotationsrcr r  required_keys optional_keys readonly_keys mutable_keysextra_items_type base_dictr qualifiersannotation_keyrrCrrrrs ` @@@@@rrz_TypedDictMeta.__new__=s F:^3FNN8R#%EFF F!k&E"8 BR STT@%@@ &0 ! VV$5t:?T?Tt?TVXYG#G ##z1'+$7$45).&KL)"0!!W,=*MN#0#R#RSU#VL$&66.#9L+&3&J&J$f&7&7w'O')O"$SC"1!6!6!8+2v))"c':L:LMM+'"1!6!6!8+2v))"c22+' EMEMEM5L*  K MM ##w.&&y}}5F'KL$$Y]]3F%KL$$Y]]3F%KL$$Y]]3F%KL##IMM2Db$IJ K3++g5,0GG"9"="=>O"P !:?!KL z)##*,#&$3   6 73J3P3P3R :/ !:?!KL z)!%%n5 J.!%%n5!%%n5!%%n5z) ((8!%%n5 $$^4!)).9! :&7*!!8(4$*5'(1-(@G %(1-(@G %(1-(@G %'0'>G $ %G !'G &6G #NO+ +s ?-R*!R0ctd)Nz4TypedDict does not support instance and class checksrrs rrz _TypedDictMeta.__subclasscheck__sRS Sr) rrrrWrrrrrrrrrr;s&37 ,\ | T.rrr!rc |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|rdnd} | | | d<t|d| |||} tf| _ | S)N2Failing to pass a value for the 'fields' parameter(Passing `None` as the 'fields' parameter`z = TypedDict(z, {})`z is deprecated and will be disallowed in Python 3.15. To create a TypedDict class with 0 fields using the functional syntax, pass an empty dictionary, e.g. rrQ stacklevelFTrrz@TypedDict takes either a dict or keyword arguments, but not bothroz$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[rsrrr) _markerwarningswarnDeprecationWarningrWrrfrrrnrr!r) typenamefieldstyping_is_inlinerrrrdeprecated_thingexampledeprecation_msgrrtds r_create_typeddictr7sY W  H!$N (= HEG#$%OO  O MM/+=! LU"vT'9f>P#)x ,.(3}%* F ,- - 7* FGG MM;#   f .$4q!<   &B|  Hb"E&(35&L rc&eZdZefddeddZdZy)_TypedDictSpecialFormTNrc &t||fd|||d|S)NFr2rrr)r7)rr0r1rrrrs rrz_TypedDictSpecialForm.__call__$s4%"''  rctfSr) _TypedDictrs rrz%_TypedDictSpecialForm.__mro_entries__9s = r)rrrr,rWrrrrrr9r9#s!  $ * !rr9cbt|ts tdtd|dddtS)aqA simple typed namespace. At runtime it is equivalent to a plain dict. TypedDict creates a dictionary type such that a type checker will expect all instances to have a certain set of keys, where each key is associated with a value of a consistent type. This expectation is not checked at runtime. Usage:: class Point2D(TypedDict): x: int y: int label: str a: Point2D = {'x': 1, 'y': 2, 'label': 'good'} # OK b: Point2D = {'z': 3, 'label': 'bad'} # Fails type check assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first') The type info can be accessed via the Point2D.__annotations__ dict, and the Point2D.__required_keys__ and Point2D.__optional_keys__ frozensets. TypedDict supports an additional equivalent form:: Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str}) By default, all keys must be present in a TypedDict. It is possible to override this by specifying totality:: class Point2D(TypedDict, total=False): x: int y: int This means that a Point2D TypedDict can have any of the keys omitted. A type checker is only expected to support a literal False or True as the value of the total argument. True is the default, and makes all items defined in the class body be required. The Required and NotRequired special forms can also be used to mark individual keys as being required or not required:: class Point2D(TypedDict): x: int # the "x" key must always be present (Required is the default) y: NotRequired[int] # the "y" key can be omitted See PEP 655 for more details on Required and NotRequired. z9TypedDict[...] should be used with a single dict argumentzTr;)rrrr7rW)rrs rr!r!<s@b$%K ! !$   rc"t|tS)aCheck if an annotation is a TypedDict class For example:: class Film(TypedDict): title: str year: int is_typeddict(Film) # => True is_typeddict(Union[list, str]) # => False )r_TYPEDDICT_TYPESr s rr?r?}s".//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)r;typs rr-r-s  rrSczt|tjrt|jSt |dr5|jt ttfvrt|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.r:rc32K|]}t|ywr _strip_extrasrBas rrDz _strip_extras..!Gq-"2!Grc32K|]}t|ywrrFrHs rrDz _strip_extras..rJrKrc32K|]}t|ywrrFrHs rrDz _strip_extras..rJrK)rr_AnnotatedAliasrGr:rrTrUrSrrrrNrrrrrreduceoperatoror_)r stripped_argss rrGrGsD a// 0 . . 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-@ @rctj|||d}tjdkrt |||||r|S|j Dcic]\}}|t |c}}Scc}}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. T)globalnslocalnsinclude_extrasr)rr<rfr_clean_optionalrrG)rrTrUrVhintkrs rr<r<sl@$$ (GD    g % Cx 9 K04 =1=##===sA,cft|tjsy|jdturyy)z detects Union[..., None] patternFrZT)rr_UnionGenericAliasr _NoneTypers r_could_be_inserted_optionalr]s+!V667 ::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||}t|t|tj }tj |||} | |k7sIttdst| tj"st|tj"r*| ||<1y)N __wrapped__ __globals__) is_argumentr)rrr _get_defaultsr[rr]r\rr ModuleTyper^rr_rr_ _eval_typer) rhintsrTrUr/original_hintsrroriginal_valuensobjoriginal_evaluateds rrWrWsf 3- '', ,, ;;=( 1KD%/6x'D>-+D1N%!*.#.#!#v'8'89#&<< #%e];$)$5$5E&e];#*5-#D"*_&G!+"$.sF4E4E$F F""(!2!2>8W!U "U* ,163C3CD"5&*:*:;0d Q( 1rct|tjrtSt|tjt j 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) rrrNr+_BaseGenericAliasrrr r r:rbrAs rr9r9-sa b&00 1  b633V5H5H(/; <==  >> !rcbt|tjr|jg|jSt|tj t jfrQ|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) rNrZr)rrrNr: __metadata__rrrrr9rrqr[Ellipsisr)r ress rr8r8Es b&00 1MM4BOO4 4 b6//1D1DE F++C"~!9!99c!fH>TCH~s2w/JrrJct|d)a&Special marker indicating that an assignment should be recognized as a proper type alias definition by type checkers. For example:: Predicate: TypeAlias = Callable[..., bool] It's invalid when used anywhere except as in the example above.  is not subscriptablerrs rrJrJ_s4& 5677rc(fd|_|_y)NctuSr)rVrmsrz_set_default..os WI%=r) has_default __default__) type_paramrms `r _set_defaultryns=J$Jrc6td}|dk7r||_yy)NrQrsrU)rnr) typevarlikedef_mods r _set_moduler}ss"AG%%!( &rceZdZdZdZeZy) _DefaultMixinzMixin for TypeVarLike defaults.rN)rrrrrryrrrrrrzs)IHrrceZdZdedefdZy)_TypeVarLikeMeta_TypeVarLikeMeta__instancerc.t||jSr)r_backported_typevarlike)rrs rrz"_TypeVarLikeMeta.__instancecheck__s*c&A&ABBrN)rrrrboolrrrrrrsC3C4Crr)rcDeZdZdZej ZdddedddZddZ y)rzType variable.NF)boundrrrminfer_variancec ttdrtj|g|||||d n3tj|g||||d |r|s|r td| _t |t  fd}| _ S)NrKrrrrrrrz1Variance cannot be specified with infer_variance.cjr7|jjt|k(r|jfz }|Sr)rv__parameters__indexrrw)aliasrtypevars r_tvar_prepare_substz,TypeVar.__new__.._tvar_prepare_substsD''),,227;s4yHW0022D r)rrrrk__infer_variance__ryr}__typing_prepare_subst__) rrrrrrmr constraintsrrs @rrzTypeVar.__new__sv/ ..H H53._paramspec_prepare_substs--LL+D >i&;&;&=9T99#8#89DD >#& , G ,  "  2JI . rc(tdtd)Nrz*.ParamSpec' is not an acceptable base typerrs rrzParamSpec.__init_subclass__!sfXJ.XYZ Zrr) rrrrrr rrVrrrrrr r s*&"("2"2(,#5#()# J [rczeZdZdZej ZedZedZ dddde ddZ dZ d Z d Zd Zd Zy) r a'Parameter specification variable. Usage:: P = ParamSpec('P') Parameter specification variables exist primarily for the benefit of static type checkers. They are used to forward the parameter types of one callable to another callable, a pattern commonly found in higher order functions and decorators. They are only valid when used in ``Concatenate``, or s the first argument to ``Callable``. In Python 3.10 and higher, they are also supported in user-defined Generics at runtime. See class Generic for more information on generic types. An example for annotating a decorator:: T = TypeVar('T') P = ParamSpec('P') def add_logging(f: Callable[P, T]) -> Callable[P, T]: '''A type-safe decorator to add logging to a function.''' def inner(*args: P.args, **kwargs: P.kwargs) -> T: logging.info(f'{f.__name__} was called') return f(*args, **kwargs) return inner @add_logging def add_two(x: float, y: float) -> float: '''Add two numbers together.''' return x + y Parameter specification variables defined with covariant=True or contravariant=True can be used to declare covariant or contravariant generic types. These keyword arguments are valid, but their actual semantics are yet to be decided. See PEP 612 for details. Parameter specification variables can be introspected. e.g.: P.__name__ == 'T' P.__bound__ == None P.__covariant__ == False P.__contravariant__ == False Note that only parameter specification variables defined in global scope can be pickled. ct|Sr)r rs rrzParamSpec.argsZs  & &rct|Sr)r rs rrzParamSpec.kwargs^s "4( (rNFrcDtj||g||_t||_t||_t||_|rtj|d|_ nd|_ tj||t}|dk7r||_ yy)NzBound must be a type.rU) rrrr __covariant____contravariant__rrr@ __bound__rrnr)rrrrrrrmr|s rrzParamSpec.__init__bs MM$ ' DM!%iD %)-%8D "&*>&:D #!'!3!3E;R!S!%  " "4 1iG--").rc~|jrd}n |jrd}n|jrd}nd}||jzS)N+-~)rrrr)rprefixs rrzParamSpec.__repr__ts@&&##''DMM) )rc,tj|Srr7r rs rr zParamSpec.__hash__??4( (rc ||uSrrrs rrzParamSpec.__eq__ 5= rc|jSrrrs rrzParamSpec.__reduce__ == rcyrrrws rrzParamSpec.__call__ r)rrrrrrrpropertyrrrVrrr rrrrrrr r (se, ^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)r )rrr)ris_class)rrrrfrr_)r{rrs rrrsc{Dz!#s###y0%c?*##y0%c&99!#f?RSSJrcdeZdZejZfdZdZdZdZ e dZ dZ dZ xZS)_ConcatenateGenericAliasc@t||||_||_yr)rrr:r)rr2rrs rrz!_ConcatenateGenericAlias.__init__s G T "$DO DMrctj|jddjfd|jDdS)N[, c3.K|] }|ywrr)rBr{ _type_reprs rrDz4_ConcatenateGenericAlias.__repr__..s!Kc*S/!Ks])rrr:joinr)rrs @rrz!_ConcatenateGenericAlias.__repr__sF**J!$//23 !KT]]!KKLAO PrcDt|j|jfSr)rr:rrs rr z!_ConcatenateGenericAlias.__hash__s$--89 9rcyrrrws rrz!_ConcatenateGenericAlias.__call__rrc:td|jDS)Nc3bK|]'}t|tjtfs$|)ywr)rrrr )rBr s rrDz:_ConcatenateGenericAlias.__parameters__..s'jfnni=X.Ys%//)rrrs rrz'_ConcatenateGenericAlias.__parameters__s !]] rc&t|dtrg|dd|dj}nKt|dttfr g|dd|dS|ddust|dt s t d|j|j|SNrZ.MThe last parameter to Concatenate should be a ParamSpec variable or ellipsis.) rrrrrr rrr:rrs rrNz"_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 rGc32K|]}t|ywr)rrBrs rrDz7_ConcatenateGenericAlias.__getitem__..s!Aq-"2!ArKrrwrrrrHrIrJrKrLrMr __unpacked__Fz is not valid as type argumentc3(K|] }| ywrr)rBxsubsts rrDz7_ConcatenateGenericAlias.__getitem__..s'DQa'Ds)r:rbrDrrrr _unpack_argsrr rrrVrwrrrrziprrrrrr _is_unpackrrrrN) rrrparamprepareralenplennew_argsr{ subparamssubargsrs @rrz$_ConcatenateGenericAlias.__getitem__s7H"55"Gv NOO&&4&(? @AAdE*w!AD!ABD((F J!%)CTJ&"4.Dy1 U+ASY#E=)DIU99u'8'89CI~'*@(GHH6{a'tAw0G Av v $w"47D1!+474L MIbqI5a>IDQLI1 J4t9Dv;Dt|TD[6e:c?#FN; *30C0C D '^U C(3%/M(NOO"6>:(())6+>+>? !$ 2 2I "''D)'D"D!'l$3 %4>>%/2 2r)rrrrrrrrr rrrrNrrrs@rrrsD((  !  P  :       ;J 3rrc,eZdZdZfdZfdZxZS)rrc>t|dttfr g|dd|dSt|dtjrg|dd|dj }n%|ddust|dt s tdttj|'|Sr) rrrrrrr rrrN)rrrs rrNz"_ConcatenateGenericAlias.copy_with sfRj4-86VCR[66":66fRj&*I*IJAvcr{AVBZ-@-@AF *+z&*i/P#%>??V<.,s3QaJqM3QrKc3 K|]}|ywrr)rBr s rrDz7_ConcatenateGenericAlias.__getitem__..-s/Aa/As )rrrrrr)rrrrs rrz$_ConcatenateGenericAlias.__getitem__*sD+D1eU+3Q53Q0Q /A5/A!BCC r)rrrrNrrrs@rrrs!J V  rc eZdZy)_EllipsisDummyN)rrrrrrrr2srrc|ddur!tjdkrg|ddt}tjdk\rt||tt fd}n t||}|dtur|St d|jD|_tjdkr|St d |jD|_|S) NrZ.)rrrQ)rrrT)_typevar_types_paramspec_tvarsc34K|]}|tur|ndyw).Nrrs rrDz,_create_concatenate_alias..Cs&!C()'(~&=3!F!Csrc30K|]}|tur|ywrrrs rrDz,_create_concatenate_alias..Hs!'DQ+,N+B()'Ds) rfrrrrr rrr)r2r concatenates r_create_concatenate_aliasr6s"~!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)Nrz&Cannot take a Concatenate of no types.rZ.rz/Concatenate[arg, ...]: each arg must be a type.c3JK|]}tj|ywrr?rAs rrDz'_concatenate_getitem..XsH1F&&q#.HrE)rrrr r)rrrCs @r_concatenate_getitemr NsR@AA j% ( ] rNc !Z 2 %J:; ; ;C$H 3BH$rN$J $T: 66rct||S)a&Used in conjunction with ``ParamSpec`` and ``Callable`` to represent a higher order function which adds, removes or transforms parameters of a callable. For example:: Callable[Concatenate[int, P], int] See PEP 612 for detailed information. )r rs rrrcs$D*55rrMcbtj||d}tj||fS)a Special typing form used to annotate the return type of a user-defined type guard function. ``TypeGuard`` only accepts a single type argument. At runtime, functions marked this way should return a boolean. ``TypeGuard`` aims to benefit *type narrowing* -- a technique used by static type checkers to determine a more precise type of an expression within a program's code flow. Usually type narrowing is done by analyzing conditional code flow and applying the narrowing to a block of code. The conditional expression here is sometimes referred to as a "type guard". Sometimes it would be convenient to use a user-defined boolean function as a type guard. Such a function should use ``TypeGuard[...]`` as its return type to alert static type checkers to this intention. Using ``-> TypeGuard`` tells the static type checker that for a given function: 1. The return value is a boolean. 2. If the return value is ``True``, the type of its argument is the type inside ``TypeGuard``. For example:: def is_str(val: Union[str, float]): # "isinstance" type guard if isinstance(val, str): # Type of ``val`` is narrowed to ``str`` ... else: # Else, type of ``val`` is narrowed to ``float``. ... Strict type narrowing is not enforced -- ``TypeB`` need not be a narrower form of ``TypeA`` (it can even be a wider form) and this may lead to type-unsafe results. The main reason is to allow for things like narrowing ``List[object]`` to ``List[str]`` even though the latter is not a subtype of the former, since ``List`` is invariant. The responsibility of writing type-safe type guards is left to the user. ``TypeGuard`` also works with type variables. For more information, see PEP 647 (User-Defined Type Guards).  accepts only a single type.rr@rrrrs rrMrMws4X!!*6R.ST##D4'22rrNcbtj||d}tj||fS)awSpecial typing form used to annotate the return type of a user-defined type narrower function. ``TypeIs`` only accepts a single type argument. At runtime, functions marked this way should return a boolean. ``TypeIs`` aims to benefit *type narrowing* -- a technique used by static type checkers to determine a more precise type of an expression within a program's code flow. Usually type narrowing is done by analyzing conditional code flow and applying the narrowing to a block of code. The conditional expression here is sometimes referred to as a "type guard". Sometimes it would be convenient to use a user-defined boolean function as a type guard. Such a function should use ``TypeIs[...]`` as its return type to alert static type checkers to this intention. Using ``-> TypeIs`` tells the static type checker that for a given function: 1. The return value is a boolean. 2. If the return value is ``True``, the type of its argument is the intersection of the type inside ``TypeIs`` and the argument's previously known type. For example:: def is_awaitable(val: object) -> TypeIs[Awaitable[Any]]: return hasattr(val, '__await__') def f(val: Union[int, Awaitable[int]]) -> int: if is_awaitable(val): assert_type(val, Awaitable[int]) else: assert_type(val, int) ``TypeIs`` also works with type variables. For more information, see PEP 742 (Narrowing types with TypeIs). r rrs rrNrNs4L!!*6R.ST##D4'22rrLceZdZdZy) _TypeFormFormc|Srrrs rrz_TypeFormForm.__call__JrN)rrrrrrrrrs rrcbtj||d}tj||fS)aA special form representing the value that results from the evaluation of a type expression. This value encodes the information supplied in the type expression, and it represents the type described by that type expression. When used in a type expression, TypeForm describes a set of type form objects. It accepts a single type argument, which must be a valid type expression. ``TypeForm[T]`` describes the set of all type form objects that represent the type T or types that are assignable to T. Usage: def cast[T](typ: TypeForm[T], value: Any) -> T: ... reveal_type(cast(int, "x")) # int See PEP 747 for more information. r rrs rrLrLs3&!!*6R.ST##D4'22rr ct|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. rqrrs rr r s"4& 5677rrct|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 rqrrs rrr s4& 5677rrQct|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 rqrrs rrQrQ) s04& 5677rrTcvtj||jd}tj||fS)aA special typing construct to mark a key of a total=False TypedDict as required. For example: class Movie(TypedDict, total=False): title: Required[str] year: int m = Movie( title='The Matrix', # typechecker error if key is omitted year=1999, ) There is no runtime checking that a required key is actually provided when instantiating a related TypedDict. r rr@rrrs rrTrTH s7"!!* None: m["year"] = 1992 # allowed m["title"] = "The Matrix" # typechecker error There is no runtime checking for this property. r rrs rrSrSq s7 !!* >.#$PQQ||#rc|jtusJt|jdk(sJt |jdt S)Nrr)r:rrrrrrs r#__typing_is_unpacked_typevartuple__z0_UnpackAlias.__typing_is_unpacked_typevartuple__ sA??f, ,,t}}%* **dmmA. = =rc>|jr|St| |Sr)r(rr)rrrs rrz_UnpackAlias.__getitem__ s!77 7&t, ,r) rrrrfrrrrrr&r(rrrs@rr$r$ sJ   g %I      >  >  - -rr$cbtj||jd}t||fS)Nr )rr@rr$rs rrr s/!!* | 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&rQrZ.z6More than one unpacked arbitrary-length tuple argumentrrrLz, expected at least ) rrrrrr enumeraterrminrvrrw)rrrtypevartuple_indexrrrleftrightvar_tuple_indexfillargrYr{r replacementtvts r_typevartuple_prepare_substz9TypeVarTuple.__new__.._typevartuple_prepare_subst s--%+\\#%6"#$6$:$;<E!%6'FugN 4y6{)11A5"&'o 1FAs%c40")#/OQU"V"s7|q'8WR[C=O.:&/%F'"!"/0O&-ajG 1#.t_5Dto'='ABEE\D(#& 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)rrs r__iter__zTypeVarTuple.__iter___ s## #srtc||_tj||t}|dk7r||_t ||_y)NrU)rrrrnrrr)rrrmr|s rrzTypeVarTuple.__init__b s> DM  " "4 1iG--") &t D rc|jSrrrs rrzTypeVarTuple.__repr__m rrc,tj|Srrrs rr zTypeVarTuple.__hash__p rrc ||uSrrrs rrzTypeVarTuple.__eq__s rrc|jSrrrs rrzTypeVarTuple.__reduce__v rrc"d|vr tdy)Nrr<rrs rrzTypeVarTuple.__init_subclass__y sd" HII#rN)rrrrrrrr?rVrrr rrrrrrrr0 s<) XNN  $-6 - ! ) ! ! JrrFrrchtdt|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)printrrrfstderrrs rrFrF s*  c!3!3 67cjjI r_ASSERT_NEVER_REPR_MAX_LENGTHdr,r{cpt|}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. N...z*Expected code to be unreachable, but got: )reprrrJAssertionError)r{rs rr,r, s@(S  u:5 5889EAEI%QRRr) eq_default order_defaultkw_only_defaultfrozen_defaultfield_specifiersrPrQrRrSrT.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)rPrQrRrSrTr)__dataclass_transform__) cls_or_fnrPrTrSrRrrQs r decoratorz&dataclass_transform..decorator s'(!.#2"0$4 1I - rr)rPrQrRrSrTrrYs`````` rr/r/ sR  rrC_F)rcB 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__rrrzs rrCrC s64 #C    *    r)rr}r_Tc teZdZdZedddedejeje de ddfd Z d e de fd Z y) r0aIndicate that a class, function or overload is deprecated. When this decorator is applied to an object, the type checker will generate a diagnostic on usage of the deprecated object. Usage: @deprecated("Use B instead") class A: pass @deprecated("Use g instead") def f(): pass @overload @deprecated("int support is deprecated") def g(x: int) -> int: ... @overload def g(x: str) -> int: ... The warning specified by *category* will be emitted at runtime on use of deprecated objects. For functions, that happens on calls; for classes, on instantiation and on creation of subclasses. If the *category* is ``None``, no warning is emitted at runtime. The *stacklevel* determines where the warning is emitted. If it is ``1`` (the default), the warning is emitted at the direct caller of the deprecated object; if it is higher, it is emitted further up the stack. Static type checker behavior is not affected by the *category* and *stacklevel* arguments. The deprecation message passed to the decorator is saved in the ``__deprecated__`` attribute on the decorated object. If applied to an overload, the decorator must be after the ``@overload`` decorator for the attribute to exist on the overload as returned by ``get_overloads()``. See PEP 702 for details. rcategoryr*messager`r*rNct|ts!tdt|j||_||_||_y)Nz2Expected an object of type str for 'message', not )rrrrrrar`r*)rrar`r*s rrzdeprecated.__init__m sJgs+HG}--02#DL$DM(DOrr{c |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)Nrr_z() takes no arguments)r-r.r7rrrr)rrrr{r`rC original_newr*s rrz$deprecated.__call__..__new__ svcz cHVWX#6>>9+CA$A&AA8df'3<<.8M(NOO+C00rcJtjdz|i|SNrr_r-r.rrr`rCoriginal_init_subclassr*s rrz.deprecated.__call__..__init_subclass__ ( cHVWX5tFvFFrcJtjdz|i|Srhrirjs rrz.deprecated.__call__..__init_subclass__ rlrcJtjdz|i|Srhri)rrr{r`rCr*s rwrapperz$deprecated.__call__..wrapper s(MM#ZRS^T///rrzY@deprecated decorator with non-None category must be applied to a class or callable, not )rar`r*__deprecated__rrrrtypesrdrwraps staticmethodrr classmethodrasyncio.coroutinesr coroutinesiscoroutinefunctionrfrmarkcoroutinefunction _is_coroutiner)rr{rrrdrrasynciorror`rCrkrfr*s ` @@@@@rrzdeprecated.__call__~ 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)rrrrr/rrrprWarningrrr]rrrrr0r0C sd( \?Q  ) ) oofkk'&:;  )   ) )"M M "M rr0cN|duxs t|ttttfSN.)rrrr rrzs rrr s)cz Z %y*BC  rcl|duxs/t|ttttt jfSr})rrrr rrrzs 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. rrNrGrc3<K|]}t|tywr)rrrs rrDz!_check_generic.. s#TAJq,$?#Trwc3JK|]}t|dttuywrwNrrVrs rrDz!_check_generic.. +)O>?*1M9)M09*:)O!#rFr argumentsrrHrIrJ z for rLrM)risclassrrrbrrrr rrr,rrsumrrVrfr) 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,-),););QA:a=aQ Q ##T#T T !A%DD=4H,H$; 4 0-K()%()OCM)O&ONN*D#,TF!3J%($4$4$?[\FdTD[6e"DAfX#C5 ${:,PQ Q9 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) rrGrrwNc3JK|]}t|dttuywrrrs rrDz!_check_generic..9 rrrFrHrIrJrKrLrM)rrrrrrrVr)rrrrrrrs rrr! s se#:;< <: 4<Js,-),););QA:a=aQ 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)NrQrrFr2) rfrhrirjf_localsrrbrDrrk)framer2s r"_has_generic_or_protocol_as_originrG s[ a  ??  z *h 6##H-'Z6X+=Z6??AZZ J 'sBBBct|turyt|}t|xr$t |dk(xrt |dt vS)NFrr)r9rr8rrr_TYPEVARTUPLE_TYPES)rrs r_is_unpacked_typevartupler] 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) FTrw2Type parameter with a default follows TypeVarTupleType parameter 8 without a default follows type parameter with a default)rrrrrr$rrVrrrrrrr) rq typevar_typestvarsenforce_default_orderingdefault_encounteredtype_var_tuple_encounteredrrvr collecteds rrrj sS  "NNM$F#G #&+" 4A(+-1*1m,Z<5PUN+")!]I"Fi"WK"5"+-D#EE.2+,'/!?Q)QRR Q.q1 )9)9LAQe^aLMAu%4A%7%<4 $E1!LL3441 48U|Ms  D) D) cg}t}d}d}|D]}t|trt|tr/|D])}t |gD]}||vs|j |+St |drU||vsd|rrrr[ceZdZdZy)_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)rBrbs rrDz*_NamedTupleMeta.__new__.. sST4;#6%D@Srr[rrzNon-default namedtuple field z cannot follow default fieldsrrrrr_generic_class_getitemz&Cannot overwrite NamedTuple attribute zError calling __set_name__ on z instance z in r)rrrbrrrrrrrrrrtr__class_getitem__r_prohibited_namedtuple_fieldsr_special_namedtuple_fields_fieldsr9r __set_name__ BaseExceptionrrfradd_note RuntimeErrorr)rr0rrrbrq default_names field_namer r class_getitemkeyr;set_namerrCs rrz_NamedTupleMeta.__new__ s%' '' O{*t6>>/I#MOO OSUSSE B&,-2%*>*1-M# C #!((4"#&CJ<PB.1-.@1.Ds"&MQ'+yy'?&@%BCC  C#%++-)67A"Q%7,'F %F ~~&6#;? *s1 H ;I& H I#AII#& I21I2N)rrrrrrrrr sD rrrc$t|vsJtfSr)rr)rs r_namedtuple_mro_entriesr5 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.r&r(z = NamedTuple(z, [])`z{name} is deprecated and will be disallowed in Python {remove}. To create a NamedTuple class with 0 fields using the functional syntax, pass an empty list, e.g. rz\Cannot pass `None` as the 'fields' parameter and also specify fields using keyword argumentsr'zIEither list of fields or keywords can be provided to NamedTuple, not bothz3.15)rrrQr)r) r,rr-r.rr/rrrnrr)r0r1rr3r5r4nts rrr9 s%( 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)rrrrrrrrr s rr:c |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)r^rjrrrrrrs rr:r: sW* <<##$4cmmD D 4T#Y5G5G4JK  s %(,AcZeZdZdZdZdZdZdZdZe jdk\rdZ d Z y y ) rAaLNewType creates simple unique types with almost zero runtime overhead. NewType(name, tp) is considered a subtype of tp by static type checkers. At runtime, NewType(name, tp) returns a dummy callable that simply returns its argument. Usage:: UserId = NewType('UserId', int) def name_by_id(user_id: UserId) -> str: ... UserId('user') # Fails type check name_by_id(42) # Fails type check name_by_id(UserId(42)) # OK num = UserId(5) + 1 # type: int c|Srrrs rrzNewType.__call__ rrc||_d|vr|jdd}||_||_t }|dk7r||_yy)NrrZrU)r rpartitionr __supertype__rnr)rrr r|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(rz)`)rr)r subcls_name supercls_names rrz8NewType.__mro_entries__..Dummy.__init_subclass__ s8"%,,K#'= K?"]OSUWrN)rrrr)rsrDummyr srrr)rrrrs @rrzNewType.__mro_entries__ s!!MMM  8Orc8|jd|jS)Nr)rrrs rrzNewType.__repr__ soo&a(9(9':; ;rc|jSr)rrs rrzNewType.__reduce__ s$$ $rrc,tj||fSrrrs rrzNewType.__or__ s||D%K00rc,tj||fSrrrs rrzNewType.__ror__ s||E4K00rN) rrrrrrrrrrfrrrrrrrArA s?   *   < %   w & 1 1 'rrAc|duxsCt|ttjtjt j t fSz:Corresponds to is_unionable() in unionobject.c in CPython.N)rrrrrrrKrs r _is_unionablersB$;*S##  $$ 3# rcv|duxs4t|ttjtjt fSr)rrrrrrKrs rrrs9$;*S##   3# r> rrrrr:rrr __reduce_ex__rrr&ceZdZdZy)_TypeAliasGenericAliascj|tvrtj||St|j|Sr) _ATTRIBUTE_DELEGATION_EXCLUSIONSr7rrr:)rr*s rrz"_TypeAliasGenericAlias.__getattr__.s/;;!--dD99t55rN)rrrrrrrrr-s 6rrceZdZdZdddefdZdededdffd Zdedefd Z dedefd Z defd Z e jd krddZdZdZdZdZdZe jdk\r dZdZxZSxZS)rKaCreate 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 rwznon-default type parameter 'z ' follows default type parameterTrU)rrrr __value____type_params__rrr rrrVrrrrnrr) rrrrdefault_value_encounteredrrxrvr|s rrzTypeAliasType.__init__Ps!dC( EFFk51 =>>"DN#.D (- %J) 2 ":y/QR"*-#&A*$PQQJ yAR-[#&B:.QF%FGG04-j,7%%j1%%j1' 2(#( "3D iG--") DMrrrNc`t|dr|j|t| ||y)Nr)r_raise_attribute_errorrr8)rrrrs rr8zTypeAliasType.__setattr__us*tZ(++D1 G e ,rc&|j|yr)rrrs r __delattr__zTypeAliasType.__delattr__zs  ' ' -rcf|dk(r td|dvrtd|dtd|d)Nrzreadonly attribute>rrrrz attribute 'z3' of 'typing.TypeAliasType' objects is not writablez0'typing.TypeAliasType' object has no attribute '')rrs rrz$TypeAliasType._raise_attribute_error}sXz!$%9::YY$!$(&& %FtfANrc|jSrrrs rrzTypeAliasType.__repr__rrrc|dury|yt|tr(|dk(r#|Dcgc]}|j||dzc}Stj|d|j dScc}w)N.rr Subscripting  requires a type.)rr_check_single_paramrr@r)rr recursionr{s rrz!TypeAliasType._check_single_params{C<=eT*yA~',. #!44S)A+F..))t}}o=NO.sA%cztjdkrtfd|DStfd|DS)Nrc3@K|]}j|ywr)rrBrrs rrDz2TypeAliasType._check_parameters..s$,,T2sc3fK|](}tj|djd*yw)rrN)rr@rrs rrDz2TypeAliasType._check_parameters..s9 ++ dmm_r c|t|txr+t|ddxr|tuxr|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 rvF)rrrrDrrAs rr>r>sD 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 ProtocolrW)r>rrrrWrdrAs rr;r;sK2rf$678 8 2+ ,R223 3,R011rr2cHeZdZdZdeddfdZdefdZdefdZde de fd Z y) r2afDefine the documentation of a type annotation using ``Annotated``, to be used in class attributes, function and method parameters, return values, and variables. The value should be a positional-only string literal to allow static tools like editors and documentation generators to use it. This complements docstrings. The string value passed is available in the attribute ``documentation``. Example:: >>> from typing_extensions import Annotated, Doc >>> def hi(to: Annotated[str, Doc("Who to say hi to")]) -> None: ... documentationrNc||_yrr)rrs rrz Doc.__init__s !.D rc"d|jdS)NzDoc()rrs rrz Doc.__repr__s$,,/q1 1rc,t|jSr)rrrs rr z Doc.__hash__s**+ +rrc`t|tstS|j|jk(Sr)rr2rrrs rrz Doc.__eq__!s)eS)%%%%)<)<< #>?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"U*UC"8f>O>OPU>VV9   6=1#//Ffi&7&78#[[Fv}-$00 ?!G >%2F "#'8"= =; =9DEenne+ENF"iik,U#E3/ET%&5QR, ,A6F,s2K/K5*K:r3rrrrc|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}|!t#|}|D]}|||j$<|j&} | j)rTt+j,| s?| |vr|| }nN| |vr|| }nDt/t0| rtt0| St3| |j4} t7| ||}d|_||_|S#t $rYwxYw) N__cell__T __owner____forward_module__r^r`rr)__forward_evaluated____forward_value__rr  cell_contentsrkrfrrjr"rrrrcrrrrr__forward_arg__ isidentifierkeyword iskeywordrbuiltins NameError__forward_code__r) forward_refrrrrrrrrr{codes r_eval_with_ownerr/sW  , ,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$ 0*/' 0))    g&7&7&<f}s  3'x--n$//Dw/E,0 )(- % I  sH?? I  I )rrrrr_recursive_guardc |tjk(r |jS|j|vr|S t|||||}t |tr t|}t |tr!t|ddd}t|||||||Stjdkr6|r4|r t|ni}|D] }|j|vs|||j<"tjdkr'tj |||||jhzStj ||||||jhzS#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. rr"TN)rrrrr0r)rr)recursive_guard)r6rr&r/r+rrrr_rr3rfrrrrrd) r-rrrrrr0rtvars rr3r3s@ V]] ".. .  & &*: :  $' E eS !u%E eZ (u2D9E'(!1&     j ([%+T&\F# 1==.,0F4==) 1   j ($$ 0K4O4O3P P  $$ 0K4O4O3P P  E ***""  sD88EEceZdZdZ d dedej efdZdZe jdkrdZ e jd k\rd Z d Z d Zy)rEzCreate a unique sentinel object. *name* should be the name of the variable to which the return value shall be assigned. *repr*, if supplied, will be used for the repr of the sentinel object. If not provided, "" will be used. NrrNc<||_|||_yd|d|_y)N<>)r_repr)rrrNs rrzSentinel.__init__{s%  !-T QtfA; rc|jSr)r9rs rrzSentinel.__repr__rrrcDtt|jd)Nz object is not callablerrrrws rrzSentinel.__call__s tDz2255LMN Nrrc,tj||fSrrrs rrzSentinel.__or__s<<e , ,rc,tj||fSrrrs rrzSentinel.__ror__s<<t , ,rcFtdt|jd)NzCannot pickle z objectr<rs r __getstate__zSentinel.__getstate__s!.d)<)<(?wGHHrr)rrrrrrrprrrfrrrrr@rrrrErErsg&*??ooc"? '! O 7" - -IrrE)rrrr~ct|ttjtjfr6|j dk(r |j S|j d|j S|duryt|S)a"Convert a Python value to a format suitable for use with the STRING format. This is intended as a helper for tools that support the STRING format but do not have access to the code that originally produced the annotations. It uses repr() for most objects. r*r.rM)rrr FunctionTypeBuiltinFunctionTyperrrN)rs rrPrPsn edF$7$79S9ST U:-)))&&'q););(<= = C<E{r)#rXrYrZr[r\r]r^r`rcrdrerfrgrhrirjrkrlrmrnrorprqrrrsrtrurvrwrxryrzr{r|rN)r__main__)rQ)NNF)NNr)r)rqr*rcollections.abcrTenumrrrior(rPrfrqrrr-rr__all__PEP_560r GenericMeta_PEP_696_IMPLEMENTEDr_r_FORWARD_REF_HAS_CLASSrr,rrRrrrrrrrrr_Finalrrr r5rr1r=r@rrrrr rrBr4r. defaultdictrrrrrrrrrrr rrrIrOrrrrar+r-r\rRrprrSrrEXCLUDED_ATTRIBUTESr_rdrnrDrtrxr|r~rtrrbrHrGr'r%r$r#r&r"r(r)r*_NEEDS_SINGLETONMETArrVrrWr_PEP_728_IMPLEMENTEDr!rr? signaturer@rrrrr=r7r9r@r-r<rGr]rWr9r8rJryr}rrr r rr rrrrrrr rrMrNrLrr rrQrTrUrSr"rrr r$rrrFrJr,r/rwrxr[rCrZr0r]rrrrrrrrrr _prohibitedrrrrrrrABCregister memoryview bytearrayrr:rArKrrrr>r;r`rr2 _CapsuleType_socket_CAPI ImportErrorr rr6r7IntEnumrr3r/rErP _typing_namesrrr+rs0rr^s     wC L  ''+==063D3D3N3NN  +w J ??FNN3V^^DV^^Dv~~f- 6>>*D 9w &4 & 9 9 ?? (/6==(/\1V001  w LLE @ 6?#((M0 z!nnG Hv334 H:-T:< 1 2G(( 6?#H((M,,O100 +1148&P 7# {{       $$ $$      .. ?? {{$$ ))UU=&*v::$&*PT 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 2xWR2 YYF YYF$  \(# \ \  $$KGFN,K(K 6;  I - I 6>"&&L "] "$%L   I**N&&L 1 1 1&2D2D E P PPM*f.f.Pnk2rBJ<|! D!2< < |--~> 0 6=!$$K   6:**N0(>TT I21nw""JH0, 6;  I 8 8% )CtC #Y,#YN 6?#((M,,O7 7.7*70  V[!+[.+[bbD-bLv}% 6? + 5 ,, r34r3l &>> '! v'F'Fd ,0 7 7 w$$K 6 6 6;  I,3,3` 68 ]]F&3&3T 6:H.d 330 6?#((M88& 66 ;;D88" 67 LLE884 6:H$$K33&33" 6:H33&' Xw ]]F)'34' -v++4-6++-# V^$;F!1;F|KJ}KJ\ 6=!$$K!( 623$*$H$H!$'! 6>"&&LS%SuS8w 44 # %$ SSS S  S !,, LLVZZ0&//#vzz/2RR S   S**S !a Sl 6:H FOOCO$D EB!b!!Lz!$$J  BHHVg  (v~&-44Qp QD*F[D[&$WV^T%JKD 6'(.`!3F6!p %8"w""J%+$6$6!!*+X!YE$EN,, b"EK%,?B"9J ;??H% __ # #F  * OOJ OOI OOE 6'(22@wnnG:1:1|w((M 7"   '!,5 6 , ( 6V%9%9 6_0_0D 6=!$$K!66  D *22V-=-=c-B2* 65 **C==@v}d3 '.  ;LK NN=!w55)-TE%||D 6)*!66#D4Lb"Vr#I#IL))''I(& N -:TTgfd>ST764  T ..       c    V Us#}}$ }$}! }!