grthtrhthjhtyjytjytkergtrhtrjytjerhrfh4:24 29/09/2026o ®û|j�iã@sÌdZddlmZmZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z mZmZmZgd¢Zdêddœdd „Zdëddœd d „Zd d„Zdd„Zdêdd„Zdd„Zdd„Zdd„Zdd„Zdd„ZgZdêddœdd„Zeƒfd d!„ZGd"d#„d#ƒZ Gd$d%„d%ƒZ!Gd&d'„d'e d d(�Z"Gd)d*„d*e"d d(�Z#e"d+d,„ƒZ$e"d-d.„ƒZ%e"d/d0„ƒZ&e"d1d2„ƒZ'e"d3d4„ƒZ(e"d5d6„ƒZ)e#ed d�d7d8„ƒƒZ*e"d9d:„ƒZ+e"d;d<„ƒZ,e"d=d>„ƒZ-Gd?d@„d@e d d(�Z.GdAdB„dBƒZ/GdCdD„dDe e!e/d d(�Z0GdEdF„dFe e!d d(�Z1GdGdH„dHe e!d d(�Z2GdIdJ„dJe e!e/d d(�Z3dKdL„Z4GdMdN„dNe d d(�Z5GdOdP„dPe5d d(�Z6GdQdR„dRe5d d(�Z7GdSdT„dTe6d d(�Z8GdUdV„dVe7d d(�Z9GdWdX„dXe7d d(�Z:GdYdZ„dZe6d d(�Z;d[d\„ZGdadb„dbƒZ?Gdcdd„ddƒZ@Gdedf„dfƒZAgdg¢ZBgdh¢ZCeBeCdigZDdjdk„ZEdldm„ZFdndo„ZGdìdrds„ZHdídudv„ZIgdw¢dxdygdzœZJGd{d|„d|eƒZKGd}d~„d~e?eKd�ZLGd€d�„d�e6d d(�ZMGd‚dƒ„dƒƒZNd„d…„ZOd†d‡„ZPdˆd‰„ZQe jRe jSe jTe jUe eefZVdîdŠd‹„ZWdŒd�„ZXdŽd�„ZYd�d‘„ZZd’d“„Z[d”d•„Z\d–d—„Z]d˜d™„Z^dšd›„Z_dœd�„Z`e0džƒZae0dŸƒZbe0d ƒZce0d¡d d¢�Zde0d£d d¢�Zee0d¤d d¢�Zfe0d¥d d¦�Zge0d§d ehd¨�Zie0d©ejekƒZle7ZmemejjndƒZnemejjodpƒZoemejjpdtƒZpemejjqdpƒZqemejjrdpƒZremejjsdpƒZsemejjtdpƒZtemejjudpƒZuemejjvdƒZvemejjwdpƒZwemejjxdpƒZxe9ejjydªƒZyd«ey_emejjzdpd¬d­�Z{emejj|dpƒZ|emejj}dªƒZ}emejj~dªƒZ~emejjdpƒZemejj€dpƒZ€emejj�dƒZ�e:e‚d®dd¯d°�Zƒd±eƒ_eme„dpdd²d°�Z…emej†dpd³d­�Z‡emeˆdpdd´d°�Zzemedpddµd°�Z‰emejjŠdpƒZŠemejj‹dpƒZ‹emejjŒdªƒZŒemejj�dpƒZ�emejŽdpd¶d­�Z�emej�dpd·d­�Z‘eme’dªdd¸d°�Z“emej”dªd¹d­�Z•emej–dªƒZ–emej—dpƒZ—emej˜dªƒZ˜emejj™dtƒZ™emejjšdªƒZšemehdpddºd°�Z›d»e›_eOGd¼d½„d½eLƒƒZœeOGd¾d¿„d¿eLƒƒZ�eOGdÀdÁ„dÁeLƒƒZžeOGdÂdÄdÃeLƒƒZŸeOGdÄdÅ„dÅeLƒƒZ eOGdÆdÇ„dÇeLedƒƒZ¡eOGdÈdÉ„dÉeLedƒƒZ¢dïdËdÌ„Z£ehdÍ£ƒZ¤ehdΣƒZ¥GdÏdЄdÐehƒZ¦dêdÑdÒ„Z§eh ¨e¦dÒdÊi¡Z©dÓdÔ„Zªeªe§_«GdÕdÖ„dÖehƒZ¬dêd dלdØdÙ„Z­eh ¨e¬dÙdÊi¡Z®dÚdÛ„e­_«GdÜdÝ„d݃Z¯ekZ°dZ±GdÞdß„dße?elƒZ²Gdàdá„dáe²ejƒZ³Gdâdã„dãe²ekƒZ´Gdädå„dåƒZµe¶dæeµ_¶eµe j·eµj¶<eme j¸dpƒZ¸eme j¹dpƒZ¹Gdçdè„dèƒZ e¶dée _¶e e j·e j¶<dS)ðaU The typing module: Support for gradual typing as defined by PEP 484. At large scale, the structure of the module is following: * Imports and exports, all public names should be explicitly added to __all__. * Internal helper functions: these should never be used in code outside this module. * _SpecialForm and its instances (special forms): Any, NoReturn, ClassVar, Union, Optional, Concatenate * Classes whose instances can be type arguments in addition to types: ForwardRef, TypeVar and ParamSpec * The core of internal generics API: _GenericAlias and _VariadicGenericAlias, the latter is currently only used by Tuple and Callable. All subscripted types like X[int], Union[int, str], etc., are instances of either of these classes. * The public counterpart of the generics API consists of two classes: Generic and Protocol. * Public helper functions: get_type_hints, overload, cast, no_type_check, no_type_check_decorator. * Generic aliases for collections.abc ABCs and few additional protocols. * Special types: NewType, NamedTuple, TypedDict. * Wrapper submodules for re and io related types. é)ÚabstractmethodÚABCMetaN)ÚWrapperDescriptorTypeÚMethodWrapperTypeÚMethodDescriptorTypeÚ GenericAlias)TÚ AnnotatedÚAnyÚCallableÚClassVarÚ ConcatenateÚFinalÚ ForwardRefÚGenericÚLiteralÚOptionalÚ ParamSpecÚProtocolÚTupleÚTypeÚTypeVarÚUnionÚ AbstractSetÚ ByteStringÚ ContainerÚContextManagerÚHashableÚ ItemsViewÚIterableÚIteratorÚKeysViewÚMappingÚ MappingViewÚMutableMappingÚMutableSequenceÚ MutableSetÚSequenceÚSizedÚ ValuesViewÚ AwaitableÚ AsyncIteratorÚ AsyncIterableÚ CoroutineÚ CollectionÚAsyncGeneratorÚAsyncContextManagerÚ ReversibleÚ SupportsAbsÚ SupportsBytesÚSupportsComplexÚ SupportsFloatÚ SupportsIndexÚ SupportsIntÚ SupportsRoundÚChainMapÚCounterÚDequeÚDictÚ DefaultDictÚListÚ OrderedDictÚSetÚ FrozenSetÚ NamedTupleÚ TypedDictÚ GeneratorÚBinaryIOÚIOÚMatchÚPatternÚTextIOÚAnyStrÚcastÚfinalÚget_argsÚ get_originÚget_type_hintsÚ is_typeddictÚNewTypeÚ no_type_checkÚno_type_check_decoratorÚNoReturnÚoverloadÚ ParamSpecArgsÚParamSpecKwargsÚruntime_checkableÚTextÚ TYPE_CHECKINGÚ TypeAliasÚ TypeGuardF©Úallow_special_formscCs,|durtdƒSt|tƒrt|||d�S|S)z=For converting None to type(None), and strings to ForwardRef.N)ÚmoduleÚis_class)ÚtypeÚ isinstanceÚstrr)Úargr^r]©rdú-/opt/alt/python310/lib64/python3.10/typing.pyÚ _type_convert‰s  rfTc CsÎttf}|s|tf7}|r|tf7}t|||d�}t|tƒr*|j|vr*t|›d�ƒ‚|t t tt fvr4|St|t ƒs?|ttfvrGtd|›d�ƒ‚t|t tttjtttfƒrV|St|ƒset|›d|d›d�ƒ‚|S)aóCheck that the argument is a type, and return it (internal helper). As a special case, accept None and return type(None) instead. Also wrap strings into ForwardRef instances. Consider several corner cases, for example plain special forms like Union are not valid, while Union[int, str] is OK, etc. The msg argument is a human-readable error message, e.g:: "Union[arg, ...]: arg should be a type." We append the repr() of the actual value (truncated to 100 chars). )r^r]z is not valid as type argumentzPlain z Got z.100Ú.)rrr r rfraÚ _GenericAliasÚ __origin__Ú TypeErrorr rSrZÚ _SpecialFormr`rrÚtypesÚ UnionTyperrUrVÚcallable)rcÚmsgÚ is_argumentr^r]Zinvalid_generic_formsrdrdreÚ _type_check’s(     ÿrqcCs|dup t|ttttfƒS)N.)raÚtupleÚlistrÚ_ConcatenateGenericAlias)rcrdrdreÚ_is_param_expr´s  ÿrucCsft|tjƒr t|ƒSt|tƒr |jdkr|jS|j›d|j›�S|dur&dSt|tjƒr/|jSt|ƒS)a;Return the repr() of an object, special-casing types (internal helper). If obj is a type, we return a shorter version than the default type.__repr__, based on the module and qualified name, which is typically enough to uniquely identify a type. For everything else, we fall back on repr(obj). Úbuiltinsrg.z...) rarlrÚreprr`Ú __module__Ú __qualname__Ú FunctionTypeÚ__name__)ÚobjrdrdreÚ _type_repr¹s    r}csj|durt}g‰|D]&}t||ƒr|ˆvrˆ |¡t|tttjfƒr0ˆ ‡fdd„|jDƒ¡q t ˆƒS)z®Collect all type variable contained in types in order of first appearance (lexicographic order). For example:: _collect_type_vars((T, List[S, T])) == (T, S) Ncsg|]}|ˆvr|‘qSrdrd©Ú.0Út©ÚtvarsrdreÚ Ûóz&_collect_type_vars..) rraÚappendrhrrlrmÚextendÚ__parameters__rr)Ztypes_Ú typevar_typesr€rdr�reÚ_collect_type_varsÎs €r‰c CsR|s t|›d�ƒ‚t|ƒ}||kr'td||krdnd›d|›d|›d|›�ƒ‚dS) zŠCheck correct count for parameters of a generic cls (internal helper). This gives a nice error message in case of count mismatch. z is not a generic classzToo ÚmanyÚfewz arguments for z ; actual z , expected N)rjÚlen)ÚclsÚ parametersZelenZalenrdrdreÚ_check_genericßsÿÿÿr�cCs~t|jƒdkr|rt|dƒs|fSt||t|jƒƒg}t||jƒD]\}}t|tƒr5t|tƒr5t|ƒ}|  |¡q#t|ƒS)z`Prepares the parameters for a Generic containing ParamSpec variables (internal helper). ér) rŒr‡rur�Úziprarrsrrr…)r�ÚparamsZ_paramsÚpZtvarrdrdreÚ_prepare_paramspec_paramsêsÿ ÿ r”cCsJt|ƒ}t|ƒt|ƒkr#g}|D]}||vr | |¡| |¡q|}|S©N)ÚsetrŒr…Úremove)r’Z all_paramsZ new_paramsr€rdrdreÚ _deduplicateýs  €r˜cCsxg}|D]1}t|ttjfƒr| |j¡qt|tƒr0t|ƒdkr0|dtur0| |dd…¡q|  |¡qtt |ƒƒS)zyAn internal helper for Union creation and substitution: flatten Unions among parameters, then remove duplicates. rr�N) raÚ_UnionGenericAliasrlrmr†Ú__args__rrrŒrr…r˜©rŽr’r“rdrdreÚ_remove_dups_flatten s"  rœcCs8g}|D]}t|tƒr| |j¡q| |¡qt|ƒS)zJAn internal helper for Literal creation: flatten Literals among parameters)raÚ_LiteralGenericAliasr†ršr…rrr›rdrdreÚ_flatten_literal_paramss   rž©Útypedcs ‡fdd„}|dur||ƒS|S)zInternal wrapper caching __getitem__ of generic types with a fallback to original function for non-hashable arguments. cs8tjˆd�ˆƒ‰t ˆj¡t ˆ¡‡‡fdd„ƒ}|S)NrŸcs2zˆ|i|¤ŽWStyYnwˆ|i|¤ŽSr•©rj©ÚargsÚkwds©ÚcachedÚfuncrdreÚinner2s  ÿz+_tp_cache..decorator..inner)Ú functoolsÚ lru_cacheÚ _cleanupsr…Ú cache_clearÚwraps)r§r¨rŸr¥reÚ decorator.s  z_tp_cache..decoratorNrd)r§r r®rdrŸreÚ _tp_cache*s  r¯cs’t|tƒr | ˆˆˆ¡St|tttjfƒrGt‡‡‡fdd„|jDƒƒ}||jkr*|St|tƒr5t|j |ƒSt|tjƒrBt   t j |¡S| |¡S|S)zàEvaluate all forward references in the given type t. For use of globalns and localns see the docstring for get_type_hints(). recursive_guard is used to prevent infinite recursion with a recursive ForwardRef. c3s�|] }t|ˆˆˆƒVqdSr•)Ú _eval_type©rÚa©ÚglobalnsÚlocalnsÚrecursive_guardrdreÚ Ió€z_eval_type..)rarÚ _evaluaterhrrlrmrrršrir©ÚreduceÚoperatorÚor_Ú copy_with)r€r´rµr¶Zev_argsrdr³rer°@s      r°c@seZdZdZdZdd„ZdS)Ú_FinalzMixin to prohibit subclassing)Ú __weakref__cOsd|vrtdƒ‚dS)NÚ_rootz&Cannot subclass special typing classesr¡©Úselfr£r¤rdrdreÚ__init_subclass__Zsÿz_Final.__init_subclass__N)r{rxryÚ__doc__Ú __slots__rÃrdrdrdrer¾Us r¾c@s$eZdZdZdZdd„Zdd„ZdS)Ú _Immutablez3Mixin to indicate that object should not be copied.rdcCó|Sr•rd©rÂrdrdreÚ__copy__bóz_Immutable.__copy__cCrÇr•rd)rÂZmemordrdreÚ __deepcopy__erÊz_Immutable.__deepcopy__N)r{rxryrÄrÅrÉrËrdrdrdrerÆ^s  rÆc@sleZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dd„Z dd„Z dd„Z dd„Z edd„ƒZdS)rk)Ú_namerÄÚ_getitemcCs||_|j|_|j|_dSr•)rÍr{rÌrÄ)rÂÚgetitemrdrdreÚ__init__ns z_SpecialForm.__init__cCs|dvr|jSt|ƒ‚)N>ryr{)rÌÚAttributeError)rÂÚitemrdrdreÚ __getattr__ssz_SpecialForm.__getattr__cCótd|›�ƒ‚)NúCannot subclass r¡)rÂÚbasesrdrdreÚ__mro_entries__yóz_SpecialForm.__mro_entries__cCó d|jS©Nútyping.©rÌrÈrdrdreÚ__repr__|ó z_SpecialForm.__repr__cCó|jSr•rÛrÈrdrdreÚ __reduce__óz_SpecialForm.__reduce__cOrÓ)NzCannot instantiate r¡rÁrdrdreÚ__call__‚r×z_SpecialForm.__call__cCó t||fSr•©r©rÂÚotherrdrdreÚ__or__…ó z_SpecialForm.__or__cCó t||fSr•rãrärdrdreÚ__ror__ˆrçz_SpecialForm.__ror__cCót|›d�ƒ‚)Nz! cannot be used with isinstance()r¡©rÂr|rdrdreÚ__instancecheck__‹r×z_SpecialForm.__instancecheck__cCrê)Nz! cannot be used with issubclass()r¡©rÂr�rdrdreÚ__subclasscheck__Žr×z_SpecialForm.__subclasscheck__cCs | ||¡Sr•)rÍ©rÂrŽrdrdreÚ __getitem__‘s z_SpecialForm.__getitem__N)r{rxryrÅrÏrÒrÖrÜrßrárærérìrîr¯rðrdrdrdrerkksrk)rÀc@óeZdZdd„ZdS)Ú_LiteralSpecialFormcCs"t|tƒs|f}|j|g|¢RŽSr•)rarrrÍrïrdrdrerð—s z_LiteralSpecialForm.__getitem__N)r{rxryrðrdrdrdrerò–s ròcCrê)a`Special 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 or class checks. ú is not subscriptabler¡rïrdrdrer �ó r cCrê)aSpecial type indicating functions that never return. Example:: from typing import NoReturn def stop() -> NoReturn: raise Exception('no way') This type is invalid in other positions, e.g., ``List[NoReturn]`` will fail in static type checkers. rór¡rïrdrdrerS«s rScCót||›d�ƒ}t||fƒS)a3Special type construct to mark class variables. An annotation wrapped in ClassVar indicates that a given attribute is intended to be used as a class variable and should not be set on instances of that class. Usage:: class Starship: stats: ClassVar[Dict[str, int]] = {} # class variable damage: int = 10 # instance variable ClassVar accepts only types and cannot be further subscribed. Note that ClassVar is not a class itself, and should not be used with isinstance() or issubclass(). ú accepts only single type.©rqrh©rÂrŽrÑrdrdrer ºs r cCrõ)aÄSpecial typing construct to indicate final names to type checkers. A final name cannot be re-assigned or overridden in a subclass. For example: MAX_SIZE: Final = 9000 MAX_SIZE += 1 # Error reported by type checker class Connection: TIMEOUT: Final[int] = 10 class FastConnector(Connection): TIMEOUT = 1 # Error reported by type checker There is no runtime checking of these properties. rör÷rørdrdrer Îs r cs†|dkrtdƒ‚t|tƒs|f}d‰t‡fdd„|Dƒƒ}t|ƒ}t|ƒdkr+|dSt|ƒdkr>td ƒ|vr>t||d d �St||ƒS) a'Union type; Union[X, Y] means either X or Y. To define a union, use e.g. Union[int, str]. Details: - The arguments must be types and there must be at least one. - None as an argument is a special case and is replaced by type(None). - Unions of unions are flattened, e.g.:: Union[Union[int, str], float] == Union[int, str, float] - Unions of a single argument vanish, e.g.:: Union[int] == int # The constructor actually returns int - Redundant arguments are skipped, e.g.:: Union[int, str, int] == Union[int, str] - When comparing unions, the argument order is ignored, e.g.:: Union[int, str] == Union[str, int] - You cannot subclass or instantiate a union. - You can use Optional[X] as a shorthand for Union[X, None]. rdz Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.c3ó�|]}t|ˆƒVqdSr•©rq©rr“©rordrer·ó€zUnion..r�réNr©Úname)rjrarrrœrŒr`r™rïrdrürerãs   rcCs t||›d�ƒ}t|tdƒfS)zEOptional type. Optional[X] is equivalent to Union[X, None]. z requires a single type.N)rqrr`)rÂrŽrcrdrdrer srcGsHt|ƒ}ztdd„ttt|ƒƒƒDƒƒ}Wn tyYnwt||ƒS)aùSpecial typing form to define literal types (a.k.a. value types). This form can be used to indicate to type checkers that the corresponding variable or function parameter has a value equivalent to the provided literal (or one of several literals): def validate_simple(data: Any) -> Literal[True]: # always returns True ... MODE = Literal['r', 'rb', 'w', 'wb'] def open_helper(file: str, mode: MODE) -> str: ... open_helper('/some/path', 'r') # Passes type check open_helper('/other/path', 'typo') # Error in type checker Literal[...] cannot be subclassed. At runtime, an arbitrary value is allowed as type argument to Literal[...], but type checkers may impose restrictions. css�|]\}}|VqdSr•rd)rr“Ú_rdrdrer·0ó€zLiteral..)ržrrr˜rsÚ_value_and_type_iterrjr�rïrdrdrers" ÿ rcCrê)aSpecial 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. rór¡rïrdrdrerZ7rôrZcsv|dkrtdƒ‚t|tƒs|f}t|dtƒstdƒ‚d‰g‡fdd„|dd…Dƒ¢|d‘R}t||ttfd d �S) aUsed 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. rdz&Cannot take a Concatenate of no types.éÿÿÿÿúAThe last parameter to Concatenate should be a ParamSpec variable.z/Concatenate[arg, ...]: each arg must be a type.c3rùr•rúrûrürdrer·ZrýzConcatenate..NT©Ú_typevar_typesÚ_paramspec_tvars)rjrarrrrtrrïrdrürer Fs  (þr cCrõ)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). rör÷rørdrdrer[`s, r[c@sDeZdZdZdZdddœdd„Zd d „Zd d „Zd d„Zdd„Z dS)rz-Internal wrapper to hold a forward reference.)Ú__forward_arg__Ú__forward_code__Ú__forward_evaluated__Ú__forward_value__Ú__forward_is_argument__Ú__forward_is_class__Ú__forward_module__TNF)r_cCstt|tƒs td|›�ƒ‚zt|ddƒ}Wnty"td|›�ƒ‚w||_||_d|_d|_||_ ||_ ||_ dS)Nz*Forward reference must be a string -- got zÚevalz/Forward reference must be an expression -- got F) rarbrjÚcompileÚ SyntaxErrorr r r r r rr)rÂrcrpr^r_ÚcoderdrdrerϘs  ÿ zForwardRef.__init__cCs´|j|vr|S|jr||urW|dur|duri}}n |dur"|}n|dur(|}|jdur9ttj |jd¡d|ƒ}tt|j ||ƒd|j |j d�}t |||||jhBƒ|_ d|_|j S)NÚ__dict__z*Forward references must evaluate to types.)rpr]T)r r rÚgetattrÚsysÚmodulesÚgetrqrr r rr°r )rÂr´rµr¶Ztype_rdrdrer¹§s0   ÿ üÿzForwardRef._evaluatecCsJt|tƒstS|jr|jr|j|jko|j|jkS|j|jko$|j|jkSr•)rarÚNotImplementedr r r rrärdrdreÚ__eq__Ás    ÿ  ÿzForwardRef.__eq__cCót|j|jfƒSr•)Úhashr rrÈrdrdreÚ__hash__ÊózForwardRef.__hash__cCsd|j›d�S)Nz ForwardRef(ú))r rÈrdrdrerÜÍr×zForwardRef.__repr__©TN) r{rxryrÄrÅrÏr¹rrrÜrdrdrdrer�s rc@s8eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd S) Ú _TypeVarLikez5Mixin for TypeVar-like types (TypeVar and ParamSpec).cCsB|r|rtdƒ‚t|ƒ|_t|ƒ|_|rt|dƒ|_dSd|_dS)zfUsed to setup TypeVars and ParamSpec's bound, covariant and contravariant attributes. z"Bivariant types are not supported.zBound must be a type.N)Ú ValueErrorÚboolÚ __covariant__Ú__contravariant__rqÚ __bound__)rÂÚboundÚ covariantÚ contravariantrdrdrerÏÒs   z_TypeVarLike.__init__cCrâr•rã©rÂÚrightrdrdreræßrçz_TypeVarLike.__or__cCrèr•rã©rÂÚleftrdrdreréârçz_TypeVarLike.__ror__cCs&|jrd}n|jr d}nd}||jS)Nú+ú-ú~)r$r%r{)rÂÚprefixrdrdrerÜås  z_TypeVarLike.__repr__cCrÞr•)r{rÈrdrdrerßîràz_TypeVarLike.__reduce__N) r{rxryrÄrÏrærérÜrßrdrdrdrer!Ðs  r!cs.eZdZdZdZddddœ‡fdd„ Z‡ZS)raâType variable. Usage:: T = TypeVar('T') # Can be anything A = TypeVar('A', str, bytes) # Must be str or bytes Type variables exist primarily for the benefit of static type checkers. They serve as the parameters for generic types as well as for generic function definitions. See class Generic for more information on generic types. Generic functions work as follows: def repeat(x: T, n: int) -> List[T]: '''Return a list containing n references to x.''' return [x]*n def longest(x: A, y: A) -> A: '''Return the longest of two strings.''' return x if len(x) >= len(y) else y The latter example's signature is essentially the overloading of (str, str) -> str and (bytes, bytes) -> bytes. Also note that if the arguments are instances of some subclass of str, the return type is still plain str. At runtime, isinstance(x, T) and issubclass(C, T) will raise TypeError. Type variables defined with covariant=True or contravariant=True can be used to declare covariant or contravariant generic types. See PEP 484 for more details. By default generic types are invariant in all type variables. Type variables can be introspected. e.g.: T.__name__ == 'T' T.__constraints__ == () T.__covariant__ == False T.__contravariant__ = False A.__constraints__ == (str, bytes) Note that only type variables defined in global scope can be pickled. )r{r&Ú__constraints__r$r%rNF©r'r(r)c s¨||_tƒ |||¡|r|durtdƒ‚|r!t|ƒdkr!tdƒ‚d‰t‡fdd„|Dƒƒ|_z t d¡j   dd¡}Wn t t fyHd}Ynw|d krR||_ dSdS) Nz-Constraints cannot be combined with bound=...r�z"A single constraint is not allowedz:TypeVar(name, constraint, ...): constraints must be types.c3rùr•rúr~rürdrer·*rýz#TypeVar.__init__..r{Ú__main__Útyping)r{ÚsuperrÏrjrŒrrr2rÚ _getframeÚ f_globalsrrÐr"rx)rÂrr'r(r)Z constraintsÚdef_mod©Ú __class__rürerÏ!s  ÿ ÿzTypeVar.__init__)r{rxryrÄrÅrÏÚ __classcell__rdrdr:reròs +ÿrc@ó(eZdZdZdd„Zdd„Zdd„ZdS) rUa<The args for a ParamSpec object. Given a ParamSpec object P, P.args is an instance of ParamSpecArgs. ParamSpecArgs objects have a reference back to their ParamSpec: P.args.__origin__ is P This type is meant for runtime introspection and has no special meaning to static type checkers. cCó ||_dSr•©ri©rÂÚoriginrdrdrerÏ?rÝzParamSpecArgs.__init__cCó|jj›d�S)Nz.args©rir{rÈrdrdrerÜBr×zParamSpecArgs.__repr__cCót|tƒstS|j|jkSr•)rarUrrirärdrdrerEó  zParamSpecArgs.__eq__N©r{rxryrÄrÏrÜrrdrdrdrerU3ó   rUc@r=) rVaFThe kwargs for a ParamSpec object. Given a ParamSpec object P, P.kwargs is an instance of ParamSpecKwargs. ParamSpecKwargs objects have a reference back to their ParamSpec: P.kwargs.__origin__ is P This type is meant for runtime introspection and has no special meaning to static type checkers. cCr>r•r?r@rdrdrerÏWrÝzParamSpecKwargs.__init__cCrB)Nz.kwargsrCrÈrdrdrerÜZr×zParamSpecKwargs.__repr__cCrDr•)rarVrrirärdrdrer]rEzParamSpecKwargs.__eq__NrFrdrdrdrerVKrGrVcsFeZdZdZdZedd„ƒZedd„ƒZdddd œ‡fd d „ Z‡Z S) raqParameter 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 as the first argument to ``Callable``, or as parameters for user-defined Generics. 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__ == 'P' P.__bound__ == None P.__covariant__ == False P.__contravariant__ == False Note that only parameter specification variables defined in global scope can be pickled. )r{r&r$r%rcCót|ƒSr•)rUrÈrdrdrer£”ózParamSpec.argscCrHr•)rVrÈrdrdreÚkwargs˜rIzParamSpec.kwargsNFr3c s`||_tƒ |||¡z t d¡j dd¡}Wn ttfy$d}Ynw|dkr.||_ dSdS)Nr�r{r4r5) r{r6rÏrr7r8rrÐr"rx)rÂrr'r(r)r9r:rdrerÏœsÿ ÿzParamSpec.__init__) r{rxryrÄrÅÚpropertyr£rJrÏr<rdrdr:rercs-  rcCs| d¡o | d¡S)NÚ__)Ú startswithÚendswith)ÚattrrdrdreÚ _is_dunder§srPcsdeZdZdZdddœdd„Zdd„Zd d „Zd d „Z‡fd d„Zdd„Z dd„Z ‡fdd„Z ‡Z S)Ú_BaseGenericAliasa°The central part of internal API. This represents a generic version of type 'origin' with type arguments 'params'. There are two kind of these aliases: user defined and special. The special ones are wrappers around builtin collections and ABCs in collections.abc. These must have 'name' always set. If 'inst' is False, then the alias can't be instantiated, this is used by e.g. typing.List and typing.Dict. TN©ÚinstrcCs||_||_||_d|_dSr•)Ú_instrÌrirÅ)rÂrArSrrdrdrerϳs z_BaseGenericAlias.__init__cOsT|jstd|j›d|jj›d�ƒ‚|j|i|¤Ž}z||_W|Sty)Y|Sw)NzType z cannot be instantiated; use z () instead)rTrjrÌrir{Ú__orig_class__rÐ)rÂr£rJÚresultrdrdrerá¹s  ÿ þþz_BaseGenericAlias.__call__cCsjg}|j|vr | |j¡| |¡}||dd…D]}t|tƒs&t|tƒr+t|ƒSq| t¡t|ƒS)Nr�)rir…ÚindexrarQÚ issubclassrrr)rÂrÕÚresÚiÚbrdrdrerÖÄs   ü z!_BaseGenericAlias.__mro_entries__cCs<|dvr |jp |jjSd|jvrt|ƒst|j|ƒSt|ƒ‚)N>ryr{ri)rÌrir{rrPrrЩrÂrOrdrdrerÒÐs  z_BaseGenericAlias.__getattr__cs4t|ƒs|dvrtƒ ||¡dSt|j||ƒdS)N>rÌÚ_nparamsrrTr)rPr6Ú __setattr__Úsetattrri)rÂrOÚvalr:rdrer^Úsz_BaseGenericAlias.__setattr__cCó| t|ƒ¡Sr•©rîr`rërdrdrerìár×z#_BaseGenericAlias.__instancecheck__cCótdƒ‚)NzBSubscripted generics cannot be used with class and instance checksr¡rírdrdrerîäóz#_BaseGenericAlias.__subclasscheck__cs&tttƒ ¡dd„t|jƒDƒƒƒS)NcSsg|]}t|ƒs|‘qSrd)rP©rrOrdrdrerƒêr„z-_BaseGenericAlias.__dir__..)rsr–r6Ú__dir__ÚdirrirÈr:rdrerfès ÿz_BaseGenericAlias.__dir__) r{rxryrÄrÏrárÖrÒr^rìrîrfr<rdrdr:rerQªs  rQcsxeZdZddeddœ‡fdd„ Zdd„Zd d „Zd d „Zd d„Ze dd„ƒZ dd„Z dd„Z dd„Z ‡fdd„Z‡ZS)rhTNF)rSrrrcsdtƒj|||d�t|tƒs|f}tdd„|Dƒƒ|_t||d�|_||_||_|s0|j |_ dSdS)NrRcss,�|]}|tur dn|turdn|VqdS).rdN)Ú_TypingEllipsisÚ _TypingEmptyr±rdrdrer·þs€ þ  þz)_GenericAlias.__init__..)rˆ) r6rÏrarrršr‰r‡rrrx)rÂrAr’rSrrrr:rdrerÏøs  þ ÿz_GenericAlias.__init__cCó&t|tƒstS|j|jko|j|jkSr•)rarhrriršrärdrdreró   ÿz_GenericAlias.__eq__cCrr•)rriršrÈrdrdrer rz_GenericAlias.__hash__cCrâr•rãr*rdrdrerærçz_GenericAlias.__or__cCrèr•rãr,rdrdrerérçz_GenericAlias.__ror__csL|jttfvrtd|›�ƒ‚t|tƒs|f}tdd„|Dƒƒ}|jr2tdd„|jDƒƒr2t ||ƒ}n t ||t |jƒƒt t |j|ƒƒ‰g}|jD]V}t||jƒrjt|tƒreˆ|}t|ƒsdtd|›�ƒ‚n"ˆ|}nt|tttjfƒr‡|j}|r‡t‡fdd„|Dƒƒ}||}|jtjjkr™t|tƒr™| |¡qH| |¡qH| t|ƒ¡S)Nz%Cannot subscript already-subscripted csó�|]}t|ƒVqdSr•©rfrûrdrdrer·rz,_GenericAlias.__getitem__..csó�|]}t|tƒVqdSr•©rarr~rdrdrer·rýzFExpected a list of types, an ellipsis, ParamSpec, or Concatenate. Got c3s�|]}ˆ|VqdSr•rd)rÚx©Úsubstrdrer·2r)rirrrjrarrrÚanyr‡r”r�rŒÚdictr‘ršrrrurhrrlrmÚ collectionsÚabcr r†r…r½)rÂr’Únew_argsrcÚ subparamsÚsubargsrdrqrerðs> ÿ    ÿÿ   z_GenericAlias.__getitem__cCs |j|j||j|j|j|jd�S)N©rrSrr)r;rirÌrTrr©rÂr’rdrdrer½;sþz_GenericAlias.copy_withcCsB|jr d|j}nt|jƒ}d dd„|jDƒ¡}|›d|›d�S)NrÚú, cSóg|]}t|ƒ‘qSrd©r}r±rdrdrerƒEóz*_GenericAlias.__repr__..ú[ú])rÌr}riÚjoinrš)rÂrr£rdrdrerÜ@s   z_GenericAlias.__repr__cCsb|jr tƒ|j}n|j}t|jƒ}t|ƒdkr*t|dtƒr'|tur*|ds*|\}tj ||ffS)Nr�r) rÌÚglobalsrirrršrŒrarr»rÎ)rÂrAr£rdrdrerßHs z_GenericAlias.__reduce__cs‚t|jtƒr td|›�ƒ‚|jrtƒ |¡S|jtur=t|vr!dS|  |¡}||dd…D]}t|t ƒr<||ur<dSq.|jfS)NrÔrdr�) rarirkrjrÌr6rÖrrrWrQ)rÂrÕrZr[r:rdrerÖSs    €z_GenericAlias.__mro_entries__)r{rxryrrÏrrrærér¯rðr½rÜrßrÖr<rdrdr:rerh÷sþ $ rhcsdeZdZdddœ‡fdd„ Zedd„ƒZdd „Zd d „Z‡fd d „Zdd„Z dd„Z dd„Z ‡Z S)Ú_SpecialGenericAliasTNrRcs`|dur|j}tƒj|||d�||_|jdkr"d|j›d�|_dSd|j›d|j›d�|_dS)NrRrvzA generic version of rg)r{r6rÏr]rxryrÄ)rÂrAZnparamsrSrr:rdrerÏhs z_SpecialGenericAlias.__init__csBt|tƒs|f}d‰t‡fdd„|Dƒƒ}t|||jƒ| |¡S)Nz*Parameters to generic types must be types.c3rùr•rúrûrürdrer·wrýz3_SpecialGenericAlias.__getitem__..)rarrr�r]r½r{rdrürerðrs  z _SpecialGenericAlias.__getitem__cCst|j||j|jd�S)N)rrS)rhrirÌrTr{rdrdrer½{sÿz_SpecialGenericAlias.copy_withcCrØrÙrÛrÈrdrdrerÜrÝz_SpecialGenericAlias.__repr__cs:t|tƒr t|j|jƒSt|tƒst||jƒStƒ |¡Sr•)rar„rXrirhr6rîrír:rdrerî‚s    z&_SpecialGenericAlias.__subclasscheck__cCrÞr•rÛrÈrdrdrer߉ràz_SpecialGenericAlias.__reduce__cCrâr•rãr*rdrdreræŒrçz_SpecialGenericAlias.__or__cCrèr•rãr,rdrdreré�rçz_SpecialGenericAlias.__ror__) r{rxryrÏr¯rðr½rÜrîrßrærér<rdrdr:rer„gs  r„cs$eZdZ‡fdd„Zdd„Z‡ZS)Ú_CallableGenericAliascsZ|j}t|ƒdkrt|dƒrtƒ ¡Sdd dd„|dd…Dƒ¡›dt|dƒ›d �S) Nrþrztyping.Callable[[r|cSr}rdr~r±rdrdrerƒ™rz2_CallableGenericAlias.__repr__..rz], r�)ršrŒrur6rÜr‚r}©rÂr£r:rdrerÜ“s ÿ þz_CallableGenericAlias.__repr__cCsD|j}t|ƒdkrt|dƒst|dd…ƒ|df}tjt|ffS)Nrþrr)ršrŒrursr»rÎr r†rdrdrerßœsz _CallableGenericAlias.__reduce__)r{rxryrÜrßr<rdrdr:rer…’s  r…c@s(eZdZdd„Zdd„Zedd„ƒZdS)Ú _CallableTypecCst|j||j|jttfdd�S)NTrz)r…rirÌrTrrr{rdrdrer½¤s ýz_CallableType.copy_withcCsPt|tƒr t|ƒdkrtdƒ‚|\}}t|tƒrt|ƒ|f}n||f}| |¡S)Nrþz6Callable must be used as Callable[[arg, ...], result].)rarrrŒrjrsÚ__getitem_inner__)rÂr’r£rVrdrdrerðªs  z_CallableType.__getitem__cCsb|\}}d}t||ƒ}|tur| t|f¡St|tƒs|f}tdd„|Dƒƒ}||f}| |¡S)Nz.Callable[args, result]: result must be a type.csrlr•rm)rrcrdrdrer·Árz2_CallableType.__getitem_inner__..)rqÚEllipsisr½rhrarr)rÂr’r£rVrordrdrerˆ¸s    z_CallableType.__getitem_inner__N)r{rxryr½rðr¯rˆrdrdrdrer‡£s r‡c@seZdZedd„ƒZdS)Ú _TupleTypecs€|dkr | tf¡St|tƒs|f}t|ƒdkr.|ddur.d‰t|dˆƒ}| |tf¡Sd‰t‡fdd „|Dƒƒ}| |¡S) Nrdrþr�.z Tuple[t, ...]: t must be a type.rz*Tuple[t0, t1, ...]: each t must be a type.c3rùr•rúrûrürdrer·Òrýz)_TupleType.__getitem__..)r½rirarrrŒrqrh)rÂr’r“rdrürerðÇs   z_TupleType.__getitem__N)r{rxryr¯rðrdrdrdrerŠÆsrŠcsPeZdZdd„Zdd„Zdd„Z‡fdd„Zd d „Zd d „Z‡fd d„Z ‡Z S)r™cCst|Sr•rãr{rdrdrer½×rdz_UnionGenericAlias.copy_withcCs(t|ttjfƒs tSt|jƒt|jƒkSr•)rar™rlrmrr–ršrärdrdrerÚsz_UnionGenericAlias.__eq__cCstt|jƒƒSr•)rÚ frozensetršrÈrdrdrerßr×z_UnionGenericAlias.__hash__csd|j}t|ƒdkr-|dtdƒurdt|dƒ›d�S|dtdƒur-dt|dƒ›d�Stƒ ¡S)Nrþrztyping.Optional[r�r�)ršrŒr`r}r6rÜr†r:rdrerÜâs  z_UnionGenericAlias.__repr__cCrar•rbrërdrdrerìër×z$_UnionGenericAlias.__instancecheck__cCs |jD] }t||ƒr dSqdS)NT)ršrX)rÂr�rcrdrdrerîîs  ÿÿz$_UnionGenericAlias.__subclasscheck__cstƒ ¡\}\}}|t|ffSr•)r6rßr)rÂr§rAr£r:rdrerßós z_UnionGenericAlias.__reduce__) r{rxryr½rrrÜrìrîrßr<rdrdr:rer™Ös  r™cCsdd„|DƒS)Ncss�|] }|t|ƒfVqdSr•)r`rûrdrdrer·ùs€z'_value_and_type_iter..rd)rŽrdrdrerør×rc@seZdZdd„Zdd„ZdS)r�cCs*t|tƒstStt|jƒƒtt|jƒƒkSr•)rar�rr–rršrärdrdrerþs z_LiteralGenericAlias.__eq__cCsttt|jƒƒƒSr•)rr‹rršrÈrdrdreróz_LiteralGenericAlias.__hash__N)r{rxryrrrdrdrdrer�üs r�cóeZdZ‡fdd„Z‡ZS)rtcszt|dttfƒrg|dd…¢|d¢RSt|dtƒr,g|dd…¢|dj¢R}n t|dtƒs7tdƒ‚tƒ |¡S)Nrr) rarsrrrtršrrjr6r½r{r:rdrer½ s z"_ConcatenateGenericAlias.copy_with)r{rxryr½r<rdrdr:rertsrtcs4eZdZdZdZdZedd„ƒZ‡fdd„Z‡Z S)raCAbstract base class for generic types. A generic type is typically declared by inheriting from this class parameterized with one or more type variables. For example, a generic mapping type might be defined as:: class Mapping(Generic[KT, VT]): def __getitem__(self, key: KT) -> VT: ... # Etc. This class can then be used as follows:: def lookup_name(mapping: Mapping[KT, VT], key: KT, default: VT) -> VT: try: return mapping[key] except KeyError: return default rdFcCsÞt|tƒs|f}|s|turtd|j›d�ƒ‚tdd„|Dƒƒ}|ttfvrLtdd„|Dƒƒs8td|j›d�ƒ‚t t |ƒƒt |ƒkrKtd|j›d�ƒ‚nt d d„|j Dƒƒr\t ||ƒ}n t||t |j ƒƒt||ttfd d �S) NzParameter list to z[...] cannot be emptycsrlr•rmrûrdrdrer·2rz,Generic.__class_getitem__..css�|] }t|ttfƒVqdSr•)rarrrûrdrdrer·5r¸zParameters to zF[...] must all be type variables or parameter specification variables.z[...] must all be uniquecsrnr•ror~rdrdrer·>rýTr)rarrrrjryrrÚallr{rŒr–rsr‡r”r�rhrr)r�r’rdrdreÚ__class_getitem__+s0   ÿ  ÿ ÿÿ þzGeneric.__class_getitem__c stƒj|i|¤Žg}d|jvrt|jv}n t|jvo|jdk}|r&tdƒ‚d|jvrƒt|jt t fƒ}d}|jD]}t |t ƒrO|j turO|durLtdƒ‚|j}q8|durƒt|ƒ}t|ƒ‰|ˆks�d ‡fdd„|Dƒ¡}d dd„|Dƒ¡} td |›d | ›d �ƒ‚|}t|ƒ|_dS) NÚ__orig_bases__rz!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.r|c3s �|] }|ˆvrt|ƒVqdSr•©rbr~©Zgvarsetrdrer·bó€z,Generic.__init_subclass__..csrlr•r‘)rÚgrdrdrer·crzSome type variables (z) are not listed in Generic[r�)r6rÃrrr�Ú __bases__r{rjr‰rrrarhrir‡r–r‚rr) r�r£rJr‚ÚerrorZgvarsÚbaseZtvarsetZs_varsZs_argsr:r’rerÃFs<      ÿ€  ÿzGeneric.__init_subclass__) r{rxryrÄrÅÚ _is_protocolr¯r�rÃr<rdrdr:rers rc@óeZdZdZdS)riz´Internal placeholder for () or []. Used by TupleMeta and CallableMeta to allow empty list/tuple in specific places, without allowing them to sneak in where prohibited. N©r{rxryrÄrdrdrdrerijóric@r™)rhz(Internal placeholder for ... (ellipsis).Nršrdrdrdrerhqr›rh)r‡r�rUr˜Ú_is_runtime_protocol) Ú__abstractmethods__Ú__annotations__rrÄrÏrxÚ__new__rÅÚ__subclasshook__r¿r�Ú_MutableMapping__markercCsrtƒ}|jdd…D],}|jdvrq t|diƒ}t|j ¡ƒt| ¡ƒD]}| d¡s5|tvr5|  |¡q%q |S)zÓCollect protocol members from a protocol class objects. This includes names actually defined in the class dictionary, as well as names that appear in annotations. Special names (above) are skipped. Nr)rrržZ_abc_) r–Ú__mro__r{rrsrÚkeysrMÚEXCLUDED_ATTRIBUTESÚadd)r�Zattrsr—Ú annotationsrOrdrdreÚ_get_protocol_attrs€s   €þr§cst‡fdd„tˆƒDƒƒS)Nc3s �|] }ttˆ|dƒƒVqdSr•)rnrre©r�rdrer·“r“z,_is_callable_members_only..)rŽr§r¨rdr¨reÚ_is_callable_members_only‘sr©cOstt|ƒ}|jr tdƒ‚|jturdS|jD]}|j dt¡}|tur'||_nqtj|_|j|g|¢Ri|¤ŽdS)Nz Protocols cannot be instantiatedrÏ) r`r˜rjrÏÚ_no_init_or_replace_initr¢rrÚobject)rÂr£rJr�r—Zinitrdrdrerª–s  þrªr�r4c Cs4z t |d¡j d|¡WSttfyYdSw)Nr�r{)rr7r8rrÐr")ÚdepthÚdefaultrdrdreÚ_caller³s ÿr®éc Cs0z t |¡jddvWSttfyYdSw)zÚAllow 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. r{)rvr©T)rr7r8rÐr"©r¬rdrdreÚ_allow_reckless_class_checksºs ÿr±) r r)rrr+rr'rr-r0ÚAbstractContextManagerÚAbstractAsyncContextManager)zcollections.abcÚ contextlibcr�)Ú _ProtocolMetacs€tˆddƒrtˆddƒstdd�stdƒ‚tˆddƒrtˆƒr'tˆjˆƒr'dSˆjr:t‡‡fdd „tˆƒDƒƒr:dSt ƒ  ˆ¡S) Nr˜Frœrþr°úLInstance and class checks can only be used with @runtime_checkable protocolsTc3s:�|]}tˆ|ƒottˆ|dƒƒ ptˆ|ƒduVqdSr•)Úhasattrrnrre©r�Úinstancerdrer·âs€ ü  ýz2_ProtocolMeta.__instancecheck__..) rr±rjr©rXr;r˜rŽr§r6rìr¸r:r¸rerìÒs& ÿ þý ÿ þü z_ProtocolMeta.__instancecheck__)r{rxryrìr<rdrdr:rerµÏsrµcs,eZdZdZdZdZdZ‡fdd„Z‡ZS)raZBase class for protocol classes. Protocol classes are defined as:: class Proto(Protocol): def meth(self) -> int: ... Such classes are primarily used with static type checkers that recognize structural subtyping (static duck-typing), for example:: class C: def meth(self) -> int: return 0 def func(x: Proto) -> int: return x.meth() func(C()) # Passes static type check See PEP 544 for details. Protocol classes decorated with @typing.runtime_checkable act as simple-minded runtime protocols that check only the presence of given attributes, ignoring their type signatures. Protocol classes can be generic, they are defined as:: class GenProto(Protocol[T]): def meth(self) -> T: ... rdTFcs´tƒj|i|¤Žˆj dd¡stdd„ˆjDƒƒˆ_‡fdd„}dˆjvr)|ˆ_ˆjs.dSˆjD]#}|tt fvsT|j t vrF|j t |j vsTt |t ƒrN|jsTtd|ƒ‚q1tˆ_dS) Nr˜Fcss�|]}|tuVqdSr•)r)rr[rdrdrer·rz-Protocol.__init_subclass__..csàˆj dd¡s tStˆddƒstƒrtStdƒ‚tˆƒs%tƒr!tStdƒ‚t|tƒs.tdƒ‚t ˆƒD];}|j D]1}||jvrM|j|durKtSn t|diƒ}t|t j j ƒrh||vrht|tƒrh|jrhnq7tSq2dS) Nr˜Frœr¶z._proto_hookr z7Protocols can only inherit from other protocols, got %r)r6rÃrrrsr•r˜r r«rrxÚ_PROTO_ALLOWLISTr{rXrjrªrÏ)r�r£rJrºr—r:r¨rerà s*  &   ÿÿÿ€ zProtocol.__init_subclass__) r{rxryrÄrÅr˜rœrÃr<rdrdr:rerës r)Ú metaclasscsTeZdZdZ‡fdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z ‡fdd„Z ‡Z S)Ú_AnnotatedAliasa7Runtime 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. cs2t|tƒr |j|}|j}tƒ ||¡||_dSr•)rar½Ú __metadata__rir6rÏ)rÂrAÚmetadatar:rdrerÏUs   z_AnnotatedAlias.__init__cCs|d}t||jƒS)Nr)r½r¾)rÂr’Znew_typerdrdrer½\s z_AnnotatedAlias.copy_withcCs$d t|jƒd dd„|jDƒ¡¡S)Nztyping.Annotated[{}, {}]r|csrlr•)rwr±rdrdrer·drz+_AnnotatedAlias.__repr__..)Úformatr}rir‚r¾rÈrdrdrerÜasþz_AnnotatedAlias.__repr__cCstjt|jf|jffSr•)r»rÎrrir¾rÈrdrdrerßgsÿz_AnnotatedAlias.__reduce__cCrjr•)rar½rrir¾rärdrdrerlrkz_AnnotatedAlias.__eq__cCrr•)rrir¾rÈrdrdrerrrz_AnnotatedAlias.__hash__cs|dvrdStƒ |¡S)N>ryr{r)r6rÒr\r:rdrerÒus z_AnnotatedAlias.__getattr__) r{rxryrÄrÏr½rÜrßrrrÒr<rdrdr:rer½Ms r½c@s0eZdZdZdZdd„Zedd„ƒZdd„Zd S) raßAdd 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. 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()] rdcOrc)Nz&Type Annotated cannot be instantiated.r¡©r�r£rJrdrdrerŸœrdzAnnotated.__new__cCsNt|tƒr t|ƒdkrtdƒ‚d}t|d|dd�}t|dd…ƒ}t||ƒS)NrþzUAnnotated[...] should be used with at least two arguments (a type and an annotation).z$Annotated[t, ...]: t must be a type.rTr\r�)rarrrŒrjrqr½)r�r’rorAr¿rdrdrer�Ÿs  zAnnotated.__class_getitem__cOstd |j¡ƒ‚)NzCannot subclass {}.Annotated)rjrÀrxrÁrdrdrerês ÿzAnnotated.__init_subclass__N) r{rxryrÄrÅrŸr¯r�rÃrdrdrdrer{s  rcCs&t|tƒr|jstd|ƒ‚d|_|S)a9Mark 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! zB@runtime_checkable can be only applied to protocol classes, got %rT)rXrr˜rjrœr¨rdrdrerW°s ÿrWcCó|S)zÿCast a value to a type. This returns the value unchanged. To the type checker this signals that the return value has the designated type, but at runtime we intentionally don't check anything (we want this to be as fast as possible). rd)Útypr`rdrdrerJÉsrJc CsŽz|j}Wn tyiYSw|j}|j}|d|…}|jp!d}|j}|r+t|ƒni}|t|ƒ}t||d…|ƒD]\}} | ||<q<|S)z:Internal helper to extract the default arguments, by name.Nrd) Ú__code__rÐÚ co_argcountÚ co_varnamesÚ __defaults__Ú__kwdefaults__rtrŒr‘) r§rZ pos_countZ arg_namesÚdefaultsZ kwdefaultsrYZ pos_offsetrÚvaluerdrdreÚ _get_defaultsÔs  þ    rËc Cs@t|ddƒriSt|tƒr†i}t|jƒD]d}|dur'ttj |jd¡diƒ}n|}|j  di¡}t|t j ƒr8i}|durBt t |ƒƒn|}|durQ|durQ||}}| ¡D]"\} } | duratdƒ} t| tƒrmt| ddd�} t| ||ƒ} | || <qUq|r}|Sdd „| ¡DƒS|dur°t|t jƒr”|j }n|} t| d ƒr£| j} t| d ƒs›t| d iƒ}|dur¯|}n|dur¶|}t|ddƒ}|durÎt|tƒrÇiStd  |¡ƒ‚t|ƒ} t |ƒ}| ¡D]7\} } | durætdƒ} t| tƒr÷t| t|t jƒ dd�} t| ||ƒ} | | v�r | | du�r t| } | || <qÚ|�r|Sd d „| ¡DƒS)aHReturn type hints for an object. This is often the same as obj.__annotations__, but it handles forward references encoded as string literals, adds Optional[t] if a default value equal to None is set and recursively replaces all 'Annotated[T, ...]' with 'T' (unless 'include_extras=True'). The argument may be a module, class, method, or function. The annotations are returned as a dictionary. For classes, annotations include also inherited members. TypeError is raised if the argument is not of a type that can contain annotations, and an empty dictionary is returned if no annotations are present. BEWARE -- the behavior of globalns and localns is counterintuitive (unless you are familiar with how eval() and exec() work). The search order is locals first, then globals. - If no dict arguments are passed, an attempt is made to use the globals from obj (or the respective module's globals for classes), and these are also used as the locals. If the object does not appear to have globals, an empty dictionary is used. For classes, the search order is globals first then locals. - 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. Ú__no_type_check__NrržFT)rpr_cSói|] \}}|t|ƒ“qSrd©Ú_strip_annotations©rÚkr€rdrdreÚ +óz"get_type_hints..Ú __wrapped__Ú __globals__z1{!r} is not a module, class, method, or function.cSrÍrdrÎrÐrdrdrerÒSrÓ)rrar`Úreversedr¢rrrrxrrlÚGetSetDescriptorTypertÚvarsÚitemsrbrr°Ú ModuleTyper·rÔÚ_allowed_typesrjrÀrËr) r|r´rµZinclude_extrasZhintsr—Z base_globalsÚannZ base_localsrrÊZnsobjrÉrdrdrerNísv !      ú   ÿ €  ÿ  ý  rNcCsÂt|tƒr t|jƒSt|tƒr%tdd„|jDƒƒ}||jkr |S| |¡St|tƒrAtdd„|jDƒƒ}||jkr;|St|j|ƒSt|t j ƒr_tdd„|jDƒƒ}||jkrX|St   t j|¡S|S)z.Strips the annotations from a given type. csrlr•rÎr±rdrdrer·\rz%_strip_annotations..csrlr•rÎr±rdrdrer·arcsrlr•rÎr±rdrdrer·fr)rar½rÏrirhrrršr½rrlrmr©rºr»r¼)r€Z stripped_argsrdrdrerÏVs$          rÏcCsHt|tƒrtSt|ttttfƒr|jS|turtSt|t j ƒr"t j SdS)a Get 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) rar½rrQrrUrVrirrlrm©ÚtprdrdrerMns ÿ rMcCs„t|tƒr |jf|jSt|ttfƒr7|j}|jtjj ur5t |ƒdkr)t |dƒs5t |dd…ƒ|df}|St|t jƒr@|jSdS)a¦Get 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) rþrNrrd)rar½rir¾rhrršrurvr rŒrursrlrm)rÞrYrdrdrerL‰s  rLcCs t|tƒS)zéCheck 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 )raÚ_TypedDictMetarÝrdrdrerO¡s rOcCs–t|tƒr:|j ¡}|j ¡D]\}}||j|fvr | |¡q| ¡D]}t|tj ƒr0d|_ t|tƒr9t |ƒq%zd|_ W|St yJY|Sw)aIDecorator to indicate that annotations are not type hints. The argument must be a class or function; if it is a class, it applies recursively to all methods and classes defined in that class (but not to methods defined in its superclasses or subclasses). This mutates the function(s) or class(es) in place. T) rar`rÚcopyrÙr•ÚpopÚvaluesrlrzrÌrQrj)rcZ arg_attrsrOr`r|rdrdrerQ¯s&  €   € þþrQcst ˆ¡‡fdd„ƒ}|S)z©Decorator to give another decorator the @no_type_check effect. This wraps the decorator with something that wraps the decorated function in @no_type_check. csˆ|i|¤Ž}t|ƒ}|Sr•)rQ)r£r¤r§©r®rdreÚwrapped_decoratorÐsz2no_type_check_decorator..wrapped_decorator)r©r­)r®rärdrãrerRÉsrRcOrc)z*Helper for @overload to raise when called.z´You should not call an overloaded function. A series of @overload-decorated functions outside a stub module should always be followed by an implementation that is not @overload-ed.)ÚNotImplementedErrorr¢rdrdreÚ_overload_dummyÙsÿræcCstS)a Decorator for overloaded functions/methods. In a stub file, place two or more stub definitions for the same function in a row, each decorated with @overload. For example: @overload def utf8(value: None) -> None: ... @overload def utf8(value: bytes) -> bytes: ... @overload def utf8(value: str) -> bytes: ... In a non-stub file (i.e. a regular .py file), do the same but follow it with an implementation. The implementation should *not* be decorated with @overload. For example: @overload def utf8(value: None) -> None: ... @overload def utf8(value: bytes) -> bytes: ... @overload def utf8(value: str) -> bytes: ... def utf8(value): # implementation goes here )ræ)r§rdrdrerTâsrTcCrÇ)aVA decorator to indicate final methods and final classes. Use this decorator 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. rd)ÚfrdrdrerKÿsrKÚTÚKTÚVTÚT_co)r(ÚV_coÚVT_coÚT_contra)r)ÚCT_co)r(r'rIrþa�Callable type; Callable[[int], str] is a function of (int) -> str. The subscription syntax must always be used with exactly two values: the argument list and the return type. The argument list must be a list of types or ellipsis; the return type must be a single type. There is no syntax to indicate optional or keyword arguments, such function types are rarely used as callback types. rrÿrrrRa@Tuple type; Tuple[X, Y] is the cross-product type of X and Y. Example: Tuple[T1, T2] is a tuple of two elements corresponding to type variables T1 and T2. Tuple[int, float, str] is a tuple of an int, a float and a string. To specify a variable-length tuple of homogeneous type, use Tuple[T, ...]. r=r:r?r@rr/r;r<ra¾A special construct usable to annotate class objects. For example, suppose we have the following classes:: class User: ... # Abstract base for User classes class BasicUser(User): ... class ProUser(User): ... class TeamUser(User): ... And a function that takes a class argument that's a subclass of User and returns an instance of the corresponding class:: U = TypeVar('U', bound=User) def new_user(user_class: Type[U]) -> U: user = user_class() # (Here we could write the user object to a database) return user joe = new_user(BasicUser) At this point the type checker knows that joe has type BasicUser. c@ó&eZdZdZdZedefdd„ƒZdS)r6z(An ABC with one abstract method __int__.rdÚreturncCódSr•rdrÈrdrdreÚ__int__†ózSupportsInt.__int__N)r{rxryrÄrÅrÚintrórdrdrdrer6�ó r6c@rð)r4z*An ABC with one abstract method __float__.rdrñcCròr•rdrÈrdrdreÚ __float__�rôzSupportsFloat.__float__N)r{rxryrÄrÅrÚfloatr÷rdrdrdrer4‹rör4c@rð)r3z,An ABC with one abstract method __complex__.rdrñcCròr•rdrÈrdrdreÚ __complex__šrôzSupportsComplex.__complex__N)r{rxryrÄrÅrÚcomplexrùrdrdrdrer3•rör3c@rð)r2z*An ABC with one abstract method __bytes__.rdrñcCròr•rdrÈrdrdreÚ __bytes__¤rôzSupportsBytes.__bytes__N)r{rxryrÄrÅrÚbytesrûrdrdrdrer2Ÿrör2c@rð)r5z*An ABC with one abstract method __index__.rdrñcCròr•rdrÈrdrdreÚ __index__®rôzSupportsIndex.__index__N)r{rxryrÄrÅrrõrýrdrdrdrer5©rör5c@rð)r1zMAn ABC with one abstract method __abs__ that is covariant in its return type.rdrñcCròr•rdrÈrdrdreÚ__abs__¸rôzSupportsAbs.__abs__N)r{rxryrÄrÅrrërþrdrdrdrer1³rör1c@s,eZdZdZdZed dedefdd„ƒZdS) r7zOAn ABC with one abstract method __round__ that is covariant in its return type.rdrÚndigitsrñcCròr•rd)rÂrÿrdrdreÚ __round__ÂrôzSupportsRound.__round__N©r) r{rxryrÄrÅrrõrërrdrdrdrer7½s r7rdcCs@dd„|Dƒ}dd„|Dƒ}tj||||d�}||_|j_|S)NcSsg|]\}}|‘qSrdrd©rÚnr€rdrdrerƒÈrz!_make_nmtuple..cSs$i|]\}}|t|d|›d�ƒ“qS)zfield z annotation must be a typerúrrdrdrerÒÉsÿz!_make_nmtuple..©rÉr^)ruÚ namedtupleržrŸ)rrlr^rÉÚfieldsÚnm_tplrdrdreÚ _make_nmtupleÇsÿÿr> rÏÚ__getnewargs__rÅÚ_field_defaultsÚ_makeÚ_asdictÚ_fieldsZ_sourcerŸÚ_replace>ržrxr{c@rñ)ÚNamedTupleMetac s̈ di¡}g}|D]&}|ˆvr| |¡q |r0td|›dt|ƒdkr%dnd›dd |¡›�ƒ‚q t|| ¡‡fd d „|Dƒˆd d �}ˆD]}|tvrRtd |ƒ‚|t vrc||j vrct ||ˆ|ƒqF|S)NržzNon-default namedtuple field z cannot follow default fieldr�ÚsÚú r|csg|]}ˆ|‘qSrdrd)rr©Únsrdrerƒèrz*NamedTupleMeta.__new__..rxrz&Cannot overwrite NamedTuple attribute ) rr…rjrŒr‚rrÙÚ _prohibitedrÐÚ_specialr r_) r�ÚtypenamerÕrrlZ default_namesZ field_namerÚkeyrdrrerŸÛs.   þýÿ þ €zNamedTupleMeta.__new__N)r{rxryrŸrdrdrdrerÙs rc Ks`|dur | ¡}n|rtdƒ‚z t d¡j dd¡}Wn ttfy(d}Ynwt|||d�S)aµTyped version of namedtuple. Usage in Python versions >= 3.6:: 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.) Alternative equivalent keyword syntax is also accepted:: Employee = NamedTuple('Employee', name=str, id=int) In Python versions <= 3.5 use:: Employee = NamedTuple('Employee', [('name', str), ('id', int)]) NzIEither list of fields or keywords can be provided to NamedTuple, not bothr�r{r4©r^) rÙrjrr7r8rrÐr"r)rrrJr^rdrdrerAós ÿrAcCst|ƒdkr tdƒ‚tfS)Nr�z5Multiple inheritance with NamedTuple is not supported)rŒrjÚ _NamedTuple©rÕrdrdreÚ_namedtuple_mro_entries s rc@s&eZdZddd„ZeZdd„ZeZdS)rßTc s |D] }t|ƒturtdƒ‚qt t|tf|¡‰i}| di¡}t| ¡ƒ}d‰‡‡fdd„| ¡Dƒ}tƒ} tƒ} |D] }|  |j  di¡¡|   |j  dd¡¡|   |j  dd¡¡q<|  |¡|rj|   |¡n|   |¡|ˆ_ t | ƒˆ_ t | ƒˆ_tˆd ƒs„|ˆ_ˆS) a5Create 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 classržz?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typecs"i|] \}}|t|ˆˆjd�“qS)r)rqrx)rrrÞ©roZtp_dictrdrerÒ4 sÿÿz*_TypedDictMeta.__new__..Ú__required_keys__rdÚ__optional_keys__Ú __total__)r`rßrjrŸrtrr–r£rÙÚupdaterržr‹rrr·r ) r�rrÕrÚtotalr—r¦Zown_annotationsZown_annotation_keysZ required_keysZ optional_keysrdrrerŸ" s8 ÿ   þ      z_TypedDictMeta.__new__cCrc)Nz4TypedDict does not support instance and class checksr¡)r�rårdrdrerîO rIz _TypedDictMeta.__subclasscheck__N)T)r{rxryrŸrtrárîrìrdrdrdrerß! s  +rß©r"c Ksj|dur|}n|r tdƒ‚dt|ƒi}zt d¡j dd¡|d<Wn ttfy,Ynwt|d||d �S) aSA simple typed namespace. At runtime it is equivalent to a plain dict. TypedDict creates a dictionary type that expects all of its 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 but is only enforced by type checkers. 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 two additional equivalent forms:: Point2D = TypedDict('Point2D', x=int, y=int, label=str) 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. Usage:: 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 class syntax is only supported in Python 3.6+, while two other syntax forms work for Python 2.7 and 3.2+ Nz@TypedDict takes either a dict or keyword arguments, but not bothržr�r{r4rxrdr#) rjrtrr7r8rrÐr"rß)rrr"rJrrdrdrerBV s* ÿrBcCstfSr•)Ú _TypedDictrrdrdreÚ� sr%c@s@eZdZdZdd„Zdd„Zdd„Zdd „Zd d „Zd d „Z dS)rPa%NewType 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 cCsD||_d|vr| d¡d}||_||_tƒ}|dkr ||_dSdS)Nrgrr5)ryÚ rpartitionr{Z __supertype__r®rx)rÂrrÞr9rdrdrerϦ s ÿzNewType.__init__cCs|j›d|j›�S)Nrg)rxryrÈrdrdrerܰ rŒzNewType.__repr__cCrÂr•rd)rÂrprdrdrerá³ rÊzNewType.__call__cCrÞr•)ryrÈrdrdrerß¶ ràzNewType.__reduce__cCrâr•rãrärdrdreræ¹ rçzNewType.__or__cCrèr•rãrärdrdreré¼ rçzNewType.__ror__N) r{rxryrÄrÏrÜrárßrærérdrdrdrerP“ s  rPc@sªeZdZdZdZeedefdd„ƒƒZeedefdd„ƒƒZ ed8d d „ƒZ eede fd d „ƒƒZ ede fd d„ƒZed8dd„ƒZede fdd„ƒZed9de defdd„ƒZede fdd„ƒZed9de defdd„ƒZed9de deefdd„ƒZed:d e d!e de fd"d#„ƒZede fd$d%„ƒZede fd&d'„ƒZed;d(e de fd)d*„ƒZede fd+d,„ƒZed-ede fd.d/„ƒZed0eeddfd1d2„ƒZedrdrdreÚ writelines rôz IO.writelinesú IO[AnyStr]cCròr•rdrÈrdrdreÚ __enter__" rôz IO.__enter__cCròr•rd)rÂr`rÊÚ tracebackrdrdreÚ__exit__& rôz IO.__exit__)rñN)rrr•)rñr@) r{rxryrÄrÅrKrrbr'rr)r#r*rõr+r,r-rIr.r/r1r=r3r6r7r8r:r;r=r?rArCrdrdrdrerEÈ s\    rEc@s@eZdZdZdZedeeefde fdd„ƒZ ed dd„ƒZ d S) rDz5Typed version of the return of open() in binary mode.rdrrñcCròr•rdr<rdrdrer=0 rôzBinaryIO.writecCròr•rdrÈrdrdrerA4 rôzBinaryIO.__enter__N)rñrD) r{rxryrÄrÅrrrüÚ bytearrayrõr=rArdrdrdrerD+ srDc@s”eZdZdZdZeedefdd„ƒƒZeede fdd„ƒƒZ eede e fdd „ƒƒZ eede fd d „ƒƒZeedefd d „ƒƒZeddd„ƒZdS)rHz3Typed version of the return of open() in text mode.rdrñcCròr•rdrÈrdrdreÚbuffer> r(z TextIO.buffercCròr•rdrÈrdrdreÚencodingC r(zTextIO.encodingcCròr•rdrÈrdrdreÚerrorsH r(z TextIO.errorscCròr•rdrÈrdrdreÚline_bufferingM r(zTextIO.line_bufferingcCròr•rdrÈrdrdreÚnewlinesR r(zTextIO.newlinescCròr•rdrÈrdrdrerAW rôzTextIO.__enter__N)rñrH)r{rxryrÄrÅrKrrDrErbrFrrGr#rHr rIrArdrdrdrerH9 s(rHc@s$eZdZdZgd¢ZeZeZeZdS)Úioz)Wrapper namespace for IO generic classes.)rErHrDN)r{rxryrÄÚ__all__rErHrDrdrdrdrerJ\ s rJz.ioc@s eZdZdZddgZeZeZdS)Úrez&Wrapper namespace for re type aliases.rGrFN)r{rxryrÄrKrGrFrdrdrdrerLk s rLz.rer•r )r�r4)r¯)NNF)rd)ºrÄrvrrruZcollections.abcr´r©r»rLZ stdlib_rerrlrrrrrKrfrqrur}r‰r�r”r˜rœržr«r¯r‹r°r¾rÆrkròr rSr r rrrrZr r[rr!rrUrVrrPrQrhr„r…r‡rŠr™rr�rtrrirhZ_TYPING_INTERNALSZ_SPECIAL_NAMESr¤r§r©rªr®r±r»rµrr½rrWrJrËrzÚBuiltinFunctionTypeÚ MethodTyperÚrÛrNrÏrMrLrOrQrRrærTrKrèrérêrërìrírîr`rïrürbrIZ_aliasrr)r,r+r*rrr0r'rr-r r?rr%r!r#r&r$rrrrrsr=Údequer:r–r@r"r rr(r²rr³r/rtr;Ú defaultdictr<r>r9r8rCr.rr6r4r3r2r5r1r7rrrrrArŸrrrÖrßrBr$rPrXrYrErDrHrJr{rrGrFrdrdrdreÚsˆg "     +     '  !   /@"ADMp+#"  V   û b.5 þ i      ÿ ÿ    ÿ        #59 .c#