a 4dgb$@sdZddlmZmZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl m Z mZmZmZgdZddZdd d Zd d Zd dZddZddZddZddZgZdddddZefddZGdddZGdd d ZGd!d"d"edd#Z Gd$d%d%e dd#Z!e d&d'Z"e d(d)Z#e d*d+Z$e d,d-Z%e d.d/Z&e d0d1Z'e!d2d3Z(Gd4d5d5edd#Z)Gd6d7d7eedd#Z*d8d9Z+Gd:d;d;edd#Z,Gdd?d?e,dd#Z.Gd@dAdAe-dd#Z/GdBdCdCe.dd#Z0GdDdEdEe.dd#Z1GdFdGdGe-dd#Z2dHdIZ3GdJdKdKe-dd#Z4GdLdMdMZ5GdNdOdOZ6GdPdQdQZ7gdRZ8gdSZ9e8e9dTgZ:dUdVZ;dWdXZgd]d^d_gd`Z?GdadbdbeZ@Gdcdddde5e@deZAGdfdgdge-dd#ZBGdhdidiZCdjdkZDdldmZEdndoZFe jGe jHe jIe jJe eefZKddpdqZLdrdsZMdtduZNdvdwZOdxdyZPdzd{ZQd|d}ZRd~dZSddZTe*dZUe*dZVe*dZWe*dddZXe*dddZYe*dddZZe*dddZ[e*dde\dZ]e*de^e_Z`e.ZaeaejjbdZbeaejjcdZceaejjddZdeaejjedZeeaejjfdZfeaejjgdZgeaejjhdZheaejjidZieaejjjdZjeaejjkdZkeaejjldZle0ejjmdZmdem_eaejjndddZoeaejjpdZpeaejjqdZqeaejjrdZreaejjsdZseaejjtdZteaejjudZue1evddddZwdew_eaexddddZyeaejzdddZ{eae|ddddZneaeddddZ}eaejj~dZ~eaejjdZeaejjdZeaejjdZeaejdddZeaejdddZeaeddddZeaejdddZeaejdZeaejdZeaejdZeaejjdZeaejjdZeae\ddddZde_eDGdddeAZeDGdddeAZeDGdddeAZeDGdddeAZeDGdddeAZeDGdddeAeXZeDGdddeAeXZdddZehdZehdZGddde\ZdddZe\eddiZddZee_Gddde\ZdddddZe\eddiZdde_ddÄZe_ZdZGddńde5e`ZGddDŽdee^ZGddɄdee_ZGdd˄d˃Zede_ee jej<eae jdZeae jdZGdd΄d΃Z ede _e e je j<dS)a= 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 * Two classes whose instances can be type arguments in addition to types: ForwardRef and TypeVar * 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. )abstractmethodABCMetaN)WrapperDescriptorTypeMethodWrapperTypeMethodDescriptorType GenericAlias)M AnnotatedAnyCallableClassVarFinal ForwardRefGenericLiteralOptionalProtocolTupleTypeTypeVarUnion AbstractSet ByteString ContainerContextManagerHashable ItemsViewIterableIteratorKeysViewMapping MappingViewMutableMappingMutableSequence MutableSetSequenceSized ValuesView Awaitable AsyncIterator AsyncIterable Coroutine CollectionAsyncGeneratorAsyncContextManager Reversible SupportsAbs SupportsBytesSupportsComplex SupportsFloat SupportsIndex SupportsInt SupportsRoundChainMapCounterDequeDict DefaultDictList OrderedDictSet FrozenSet NamedTuple TypedDict GeneratorBinaryIOIOMatchPatternTextIOAnyStrcastfinalget_args get_originget_type_hintsNewType no_type_checkno_type_check_decoratorNoReturnoverloadruntime_checkableText TYPE_CHECKINGcCs&|durtdSt|tr"t|S|S)z=For converting None to type(None), and strings to ForwardRef.N)type isinstancestrr )argrY"/usr/local/lib/python3.9/typing.py _type_converts  r[TcCsttf}|r|ttf}t|}t|trB|j|vrBt|d|t t fvrR|St|t sh|ttfvrxtd|dt|t t tfr|St|st|d|dd|S)aCheck 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). z is not valid as type argumentzPlain z Got z.100.)rrr r r[rV _GenericAlias __origin__ TypeErrorr rP _SpecialFormrUrr callable)rXmsg is_argumentinvalid_generic_formsrYrYrZ _type_checks"    recCsft|tjrt|St|tr@|jdkr.|jS|jd|jS|durLdSt|tjr^|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). builtinsr\.z...) rVtypesrreprrU __module__ __qualname__ FunctionType__name__)objrYrYrZ _type_reprs    rncsZg|D]H}t|tr(|vr(|t|ttfrfdd|jDqtS)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) csg|]}|vr|qSrYrY.0ttvarsrYrZ z&_collect_type_vars..)rVrappendr]rextend__parameters__tuple)rgrqrYrrrZ_collect_type_varss rzc CsR|st|dt|}||krNtd||kr2dndd|d|d|dS) zCheck 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 manyfewz parameters for z ; actual z , expected N)r_len)cls parameterselenalenrYrYrZ_check_genericsrcCsVt|}t|t|krRg}|D] }||vr ||||q |}|rRJ||SN)setr}rvremove)params all_params new_paramsrqrYrYrZ _deduplicates   rcCsrg}|D]\}t|tr$||jqt|trZt|dkrZ|dturZ||ddq||qtt|S)zyAn internal helper for Union creation and substitution: flatten Unions among parameters, then remove duplicates. rN) rV_UnionGenericAliasrw__args__ryr}rrvrrrprYrYrZ_remove_dups_flattens " rcCs8g}|D]&}t|tr$||jq||qt|S)zJAn internal helper for Literal creation: flatten Literals among parameters)rV_LiteralGenericAliasrwrrvryrrYrYrZ_flatten_literal_paramss   rFtypedcs fdd}|dur||S|S)zInternal wrapper caching __getitem__ of generic types with a fallback to original function for non-hashable arguments. cs8tjdtjtfdd}|S)Nrcs2z|i|WSty"Yn0|i|Srr_argskwdscachedfuncrYrZinner s  z+_tp_cache..decorator..inner) functools lru_cache _cleanupsrv cache_clearwraps)rrrrrZ decorator s  z_tp_cache..decoratorNrY)rrrrYrrZ _tp_caches rcstt|tr|St|ttfrptfdd|jD}||jkrP|St|trft|j|S||S|S)zEvaluate 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 prevent infinite recursion with recursive ForwardRef. c3s|]}t|VqdSr) _eval_typerpaglobalnslocalnsrecursive_guardrYrZ $ruz_eval_type..) rVr _evaluater]rryrr^ copy_with)rqrrrev_argsrYrrZrs     rc@seZdZdZdZddZdS)_FinalzMixin to prohibit subclassing) __weakref__cOsd|vrtddS)N_rootz&Cannot subclass special typing classesrselfrrrYrYrZ__init_subclass__3sz_Final.__init_subclass__N)rlrirj__doc__ __slots__rrYrYrYrZr.src@s$eZdZdZdZddZddZdS) _Immutablez3Mixin to indicate that object should not be copied.rYcCs|SrrYrrYrYrZ__copy__;sz_Immutable.__copy__cCs|SrrY)rmemorYrYrZ __deepcopy__>sz_Immutable.__deepcopy__N)rlrirjrrrrrYrYrYrZr7src@sTeZdZdZddZddZddZdd Zd d Zd d Z ddZ e ddZ dS)r`)_namer_getitemcCs||_|j|_|j|_dSr)rrlrr)rgetitemrYrYrZ__init__Gsz_SpecialForm.__init__cCstd|dS)NzCannot subclass r)rbasesrYrYrZ__mro_entries__Lsz_SpecialForm.__mro_entries__cCs d|jSNtyping.rrrYrYrZ__repr__Osz_SpecialForm.__repr__cCs|jSrrrrYrYrZ __reduce__Rsz_SpecialForm.__reduce__cOstd|dS)NzCannot instantiate rrrYrYrZ__call__Usz_SpecialForm.__call__cCst|ddS)Nz! cannot be used with isinstance()rrrmrYrYrZ__instancecheck__Xsz_SpecialForm.__instancecheck__cCst|ddS)Nz! cannot be used with issubclass()rrr~rYrYrZ__subclasscheck__[sz_SpecialForm.__subclasscheck__cCs |||SrrrrrYrYrZ __getitem__^sz_SpecialForm.__getitem__N) rlrirjrrrrrrrrrrrYrYrYrZr`Dsr`)rc@seZdZeddddZdS)_LiteralSpecialFormTrcCs |||SrrrrYrYrZrdsz_LiteralSpecialForm.__getitem__NrlrirjrrrYrYrYrZrcsrcCst|ddS)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 subscriptableNrrrYrYrZr is r cCst|ddS)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. rNrrrYrYrZrPws rPcCst||d}t||fS)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.rer]rritemrYrYrZr sr cCst||d}t||fS)aSpecial 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. rrrrYrYrZr sr cs`|dkrtdt|ts |f}dtfdd|D}t|}t|dkrV|dSt||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]. rYz Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.c3s|]}t|VqdSrrerprrbrYrZrruzUnion..rr)r_rVryrr}rrrYrrZrs  rcCs t||d}t|tdfS)zEOptional type. Optional[X] is equivalent to Union[X, None]. z requires a single type.N)rerrU)rrrXrYrYrZrsrcCsXt|ts|f}t|}z"tddttt|D}WntyLYn0t||S)aSpecial 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|]\}}|VqdSrrY)rpr_rYrYrZrruzLiteral..)rVryrrlist_value_and_type_iterr_rrrYrYrZrs " rc@s>eZdZdZdZdddZddZdd Zd d Zd d Z dS)r z-Internal wrapper to hold a forward reference.)__forward_arg____forward_code____forward_evaluated____forward_value____forward_is_argument__TcCslt|tstd|zt|dd}Wn tyHtd|Yn0||_||_d|_d|_||_ dS)Nz*Forward reference must be a string -- got zevalz/Forward reference must be an expression -- got F) rVrWr_compile SyntaxErrorrrrrr)rrXrccoderYrYrZr s  zForwardRef.__init__cCs|j|vr|S|jr||ur|dur6|dur6i}}n|durD|}n |durP|}tt|j||d|jd}t|||||jhB|_d|_|jS)Nz*Forward references must evaluate to types.rcT)rrrerrrrr)rrrrtype_rYrYrZrs&   zForwardRef._evaluatecCs>t|tstS|jr2|jr2|j|jko0|j|jkS|j|jkSr)rVr NotImplementedrrrrotherrYrYrZ__eq__,s    zForwardRef.__eq__cCs t|jSr)hashrrrYrYrZ__hash__4szForwardRef.__hash__cCsd|jdS)Nz ForwardRef())rrrYrYrZr7szForwardRef.__repr__N)T) rlrirjrrrrrrrrYrYrYrZr s r c@s6eZdZdZdZddddddZdd Zd d ZdS) raType 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. )rl __bound____constraints__ __covariant____contravariant____dict__NF)bound covariant contravariantc s||_|r|rtdt||_t||_|r>|dur>td|rVt|dkrVtddtfdd|D|_|rt |d|_ nd|_ zt dj d d }Wnttfyd}Yn0|d kr||_dS) Nz"Bivariant types are not supported.z-Constraints cannot be combined with bound=...rz"A single constraint is not allowedz:TypeVar(name, constraint, ...): constraints must be types.c3s|]}t|VqdSrrrorrYrZrvruz#TypeVar.__init__..zBound must be a type.rl__main__typing)rl ValueErrorboolrrr_r}ryrrersys _getframe f_globalsgetAttributeErrorri)rnamerrr constraintsdef_modrYrrZrjs(    zTypeVar.__init__cCs&|jr d}n|jrd}nd}||jS)N+-~)rrrl)rprefixrYrYrZrs zTypeVar.__repr__cCs|jSr)rlrrYrYrZrszTypeVar.__reduce__)rlrirjrrrrrrYrYrYrZr;s+  rcCs|do|dS)N__) startswithendswith)attrrYrYrZ _is_dundersr csXeZdZdZdddddZddZd d Zd d Zfd dZddZ ddZ Z S)_BaseGenericAliasaThe 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. TNinstrcCs||_||_||_d|_dSr)_instrr^r)roriginr rrYrYrZrsz_BaseGenericAlias.__init__cOsT|js"td|jd|jjd|j|i|}z ||_WntyNYn0|S)NzType z cannot be instantiated; use z () instead)r r_rr^rl__orig_class__r)rrkwargsresultrYrYrZrs    z_BaseGenericAlias.__call__cCsdg}|j|vr||j||}||ddD]}t|tsLt|tr4q\q4|tt|S)Nr)r^rvindexrVr  issubclassrry)rrresibrYrYrZrs    z!_BaseGenericAlias.__mro_entries__cCs*d|jvrt|st|j|St|dS)Nr^)rr getattrr^r)rrrYrYrZ __getattr__s z_BaseGenericAlias.__getattr__cs2t|s|dvr t||nt|j||dS)N)rr _nparams)r super __setattr__setattrr^)rrval __class__rYrZrsz_BaseGenericAlias.__setattr__cCs|t|Sr)rrUrrYrYrZrsz#_BaseGenericAlias.__instancecheck__cCs tddS)NzBSubscripted generics cannot be used with class and instance checksrrrYrYrZrsz#_BaseGenericAlias.__subclasscheck__) rlrirjrrrrrrrr __classcell__rYrYrrZr s   r csdeZdZdddfdd ZddZdd Zed d Zd d ZddZ ddZ fddZ Z S)r]TNr csPtj|||dt|ts"|f}tdd|D|_t||_|sL|j|_dS)Nr css*|]"}|turdn|turdn|VqdS).rYN)_TypingEllipsis _TypingEmptyrrYrYrZrs  z)_GenericAlias.__init__..)rrrVryrrzrxri)rrrr rrrYrZrs   z_GenericAlias.__init__cCs&t|tstS|j|jko$|j|jkSr)rVr]rr^rrrYrYrZrs    z_GenericAlias.__eq__cCst|j|jfSr)rr^rrrYrYrZrsz_GenericAlias.__hash__cs|jttfvrtd|t|ts,|f}dtfdd|D}t||t|jt t |j|g}|j D]X}t|t r|}n6t|t tfr|j}|rtfdd|D}||}||qr|t|S)Nz%Cannot subscript already-subscripted *Parameters to generic types must be types.c3s|]}t|VqdSrrrrrYrZrruz,_GenericAlias.__getitem__..c3s|]}|VqdSrrY)rpx)substrYrZrru)r^rrr_rVryrr}rxdictziprrr]rrvr)rrnew_argsrX subparamssubargsrY)rbr%rZrs&     z_GenericAlias.__getitem__cCs|j|j||j|jdSN)rr )rr^rr rrrYrYrZrsz_GenericAlias.copy_withcCsB|jrd|j}n t|j}ddd|jD}|d|dS)Nr, cSsg|] }t|qSrYrnrrYrYrZrt ruz*_GenericAlias.__repr__..[])rrnr^joinr)rrrrYrYrZrs   z_GenericAlias.__repr__cCsR|jrt|j}n|j}t|j}t|dkrDt|dtsD|\}tj||ffSNrr) rglobalsr^ryrr}rVoperatorr)rrrrYrYrZrs z_GenericAlias.__reduce__csh|jrt|S|jtur`t|vr(dS||}||ddD]}t|trB||urBdSqB|jfS)NrYr) rrrr^rrrrVr )rrrrrrYrZrs   z_GenericAlias.__mro_entries__) rlrirjrrrrrrrrrr rYrYrrZr]s   r]csTeZdZdddfdd ZeddZdd Zd d Zfd d ZddZ Z S)_SpecialGenericAliasTNr cs^|dur|j}tj|||d||_|jdkrBd|jd|_nd|jd|jd|_dS)Nr rfzA generic version of r\)rlrrrrirjr)rrnparamsr rrrYrZr,s z_SpecialGenericAlias.__init__csBt|ts|f}dtfdd|D}t|||j||S)Nr#c3s|]}t|VqdSrrrrrYrZr;ruz3_SpecialGenericAlias.__getitem__..)rVryrrrr,rYrrZr6s  z _SpecialGenericAlias.__getitem__cCst|j||j|jdSr+)r]r^rr r,rYrYrZr?sz_SpecialGenericAlias.copy_withcCs d|jSrrrrYrYrZrCsz_SpecialGenericAlias.__repr__cs:t|trt|j|jSt|ts.t||jSt|Sr)rVr5rr^r]rrrrrYrZrFs    z&_SpecialGenericAlias.__subclasscheck__cCs|jSrrrrYrYrZrMsz_SpecialGenericAlias.__reduce__) rlrirjrrrrrrrr rYrYrrZr5+s   r5cs$eZdZfddZddZZS)_CallableGenericAliascsj|jdksJt|jdkr4|jdtur4tSdddd|jddDd t|jdd S) Nr rztyping.Callable[[r-cSsg|] }t|qSrYr.rrYrYrZrtWruz2_CallableGenericAlias.__repr__..z], r0)rr}rEllipsisrrr1rnrrrYrZrRs  z_CallableGenericAlias.__repr__cCsD|j}t|dkr|ddus6t|dd|df}tjt|ffS)Nr8r.r9)rr}rr4rr rrrYrYrZrZsz _CallableGenericAlias.__reduce__)rlrirjrrr rYrYrrZr7Qs r7c@s(eZdZddZddZeddZdS) _CallableTypecCst|j||j|jdSr+)r7r^rr r,rYrYrZrbsz_CallableType.copy_withcCsPt|trt|dkrtd|\}}t|tr>t||f}n||f}||S)Nr8z6Callable must be used as Callable[[arg, ...], result].)rVryr}r_r__getitem_inner__)rrrrrYrYrZrfs z_CallableType.__getitem__cCsb|\}}d}t||}|tur,|t|fSt|ts<|f}tdd|D}||f}||S)Nz.Callable[args, result]: result must be a type.css|]}t|VqdSr)r[)rprXrYrYrZr}ruz2_CallableType.__getitem_inner__..)rer:rr!rVry)rrrrrbrYrYrZr=ts   z_CallableType.__getitem_inner__N)rlrirjrrrr=rYrYrYrZr<asr<c@seZdZeddZdS) _TupleTypecs|dkr|tfSt|ts$|f}t|dkr\|ddur\dt|d}||tfSdtfdd |D}||S) NrYr8r.z Tuple[t, ...]: t must be a type.rz*Tuple[t0, t1, ...]: each t must be a type.c3s|]}t|VqdSrrrrrYrZrruz)_TupleType.__getitem__..)rr"rVryr}rer!)rrrrYrrZrs  z_TupleType.__getitem__NrrYrYrYrZr>sr>cs4eZdZddZddZddZfddZZS) rcCst|Sr)rr,rYrYrZrsz_UnionGenericAlias.copy_withcCs"t|tstSt|jt|jkSr)rVrrrrrrYrYrZrs z_UnionGenericAlias.__eq__cCstt|jSr)r frozensetrrrYrYrZrsz_UnionGenericAlias.__hash__csd|j}t|dkrZ|dtdur6dt|ddS|dtdurZdt|ddStS)Nr8rztyping.Optional[rr0)rr}rUrnrrr;rrYrZrs z_UnionGenericAlias.__repr__)rlrirjrrrrr rYrYrrZrsrcCsdd|DS)Ncss|]}|t|fVqdSr)rUrrYrYrZrruz'_value_and_type_iter..rY)rrYrYrZrsrc@seZdZddZddZdS)rcCs*t|tstStt|jtt|jkSr)rVrrrrrrrYrYrZrs z_LiteralGenericAlias.__eq__cCsttt|jSr)rr?rrrrYrYrZrsz_LiteralGenericAlias.__hash__N)rlrirjrrrYrYrYrZrsrcs4eZdZdZdZdZeddZfddZZ 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 rYFcst|ts|f}|s.|tur.td|jddtfdd|D}|ttfvrtdd|Dsxtd|jdt t |t |krtd|jd nt ||t |j t ||S) NzParameter list to z[...] cannot be emptyr#c3s|]}t|VqdSrrrrrYrZrruz,Generic.__class_getitem__..css|]}t|tVqdSr)rVrrrYrYrZrruzParameters to z [...] must all be type variablesz[...] must all be unique)rVryrr_rjrrallrlr}rrrxr])r~rrYrrZ__class_getitem__s&      zGeneric.__class_getitem__c stj|i|g}d|jvr,t|jv}nt|jvo>|jdk}|rLtdd|jvrt|j}d}|jD].}t |t rl|j turl|durtd|j }ql|durt |}t ||ksdfdd|D}ddd|D} td |d | d |}t||_ dS) N__orig_bases__rz!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.r-c3s|]}|vrt|VqdSrrWrogvarsetrYrZrruz,Generic.__init_subclass__..css|]}t|VqdSrrC)rpgrYrYrZrruzSome type variables (z) are not listed in Generic[r0)rrrrrB __bases__rlr_rzrVr]r^rxrr1ry) r~rrrserrorgvarsbasetvarsets_varss_argsrrDrZrs<          zGeneric.__init_subclass__) rlrirjrr _is_protocolrrArr rYrYrrZrs  rc@seZdZdZdS)r"zInternal placeholder for () or []. Used by TupleMeta and CallableMeta to allow empty list/tuple in specific places, without allowing them to sneak in where prohibited. NrlrirjrrYrYrYrZr" sr"c@seZdZdZdS)r!z(Internal placeholder for ... (ellipsis).NrOrYrYrYrZr!sr!)rxrBrrN_is_runtime_protocol) __abstractmethods____annotations__rrrri__new__r__subclasshook__rrA_MutableMapping__markercCsrt}|jddD]X}|jdvr$qt|di}t|jt|D] }|dsJ|tvrJ| |qJq|S)zCollect 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. Nr9)rrrR_abc_) r__mro__rlrrrkeysrEXCLUDED_ATTRIBUTESadd)r~attrsrJ annotationsrrYrYrZ_get_protocol_attrss  r]cstfddtDS)Nc3s|]}tt|dVqdSr)rarrprr~rYrZr2ruz,_is_callable_members_only..)r@r]r_rYr_rZ_is_callable_members_only0sr`cOst|jrtddS)Nz Protocols cannot be instantiated)rUrNr_)rrrrYrYrZ_no_init5s rac Cs4ztdjddvWSttfy.YdS0dS)zAllow instance and class checks for special stdlib modules. The abc and functools modules indiscriminately call isinstance() and issubclass() on the whole MRO of a user class, which may contain protocols. rl)abcrTN)rrrrrrYrYrYrZ_allow_reckless_class_cheks:srd) r r'rrr)rr%rr+r.AbstractContextManagerAbstractAsyncContextManager)zcollections.abc contextlibcseZdZfddZZS) _ProtocolMetacsVtddrtr$tjr$dSjrJtfddtDrJdStS)NrNFTc3s8|]0}t|o.tt|d p.t|duVqdSr)hasattrrarr^r~instancerYrZrZs z2_ProtocolMeta.__instancecheck__..) rr`rrrNr@r]rrrjrrjrZrRs  z_ProtocolMeta.__instancecheck__)rlrirjrr rYrYrrZrhOsrhcs,eZdZdZdZdZdZfddZZS)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: ... rYTFcstj|i|jdds6tddjD_fdd}djvrR|_js\dSjD]F}|tt fvsb|j t vr|j t |j vsbt |t r|jsbtd|qbt_dS) NrNFcss|]}|tuVqdSr)r)rprrYrYrZrruz-Protocol.__init_subclass__..csjddstStdds0tr(tStdtsJtrBtStdt|ts\tdt D]v}|j D]b}||jvr|j|durtSqdt|di}t|t j j rn||vrnt|trn|jrnqdqntSqddS) NrNFrPzLInstance and class checks can only be used with @runtime_checkable protocolsz._proto_hookrTz7Protocols can only inherit from other protocols, got %r)rrrranyrGrNrTobjectrri_PROTO_WHITELISTrlrr_rar)r~rrrmrJrr_rZrs, &   zProtocol.__init_subclass__) rlrirjrrrNrPrr rYrYrrZrcs r) metaclasscsHeZdZdZfddZddZddZdd Zd d Zd d 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|tr|j|}|j}t||||_dSr)rVrr __metadata__r^rr)rrmetadatarrYrZrs   z_AnnotatedAlias.__init__cCs$t|dksJ|d}t||jSr2)r}rrrs)rrnew_typerYrYrZrsz_AnnotatedAlias.copy_withcCs$dt|jddd|jDS)Nztyping.Annotated[{}, {}]r-css|]}t|VqdSr)rhrrYrYrZrruz+_AnnotatedAlias.__repr__..)formatrnr^r1rsrrYrYrZrsz_AnnotatedAlias.__repr__cCstjt|jf|jffSr)r4rrr^rsrrYrYrZrsz_AnnotatedAlias.__reduce__cCs&t|tstS|j|jko$|j|jkSr)rVrrrr^rsrrYrYrZrs    z_AnnotatedAlias.__eq__cCst|j|jfSr)rr^rsrrYrYrZrsz_AnnotatedAlias.__hash__) rlrirjrrrrrrrr rYrYrrZrrs rrc@s0eZdZdZdZddZeddZddZd S) raAdd 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()] rYcOs tddS)Nz&Type Annotated cannot be instantiated.rr~rrrYrYrZrSszAnnotated.__new__cCsJt|trt|dkrtdd}t|d|}t|dd}t||S)Nr8zUAnnotated[...] should be used with at least two arguments (a type and an annotation).z$Annotated[t, ...]: t must be a type.rr)rVryr}r_rerr)r~rrbrrtrYrYrZrAs zAnnotated.__class_getitem__cOstd|jdS)NzCannot subclass {}.Annotated)r_rvrirwrYrYrZrs zAnnotated.__init_subclass__N) rlrirjrrrSrrArrYrYrYrZrs  rcCs&t|tr|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)rrrNr_rPr_rYrYrZrR#s rRcCs|S)zCast 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). rY)typrrYrYrZrH<srHc Csz |j}Wnty iYS0|j}|j}|d|}|jpBd}|j}|rVt|ni}|t|}t||d|D]\}} ||vsJ| ||<qx|S)z:Internal helper to extract the default arguments, by name.NrY) __code__r co_argcount co_varnames __defaults____kwdefaults__r&r}r') rr pos_count arg_namesdefaults kwdefaultsr pos_offsetrvaluerYrYrZ _get_defaultsGs        rc Cst|ddriSt|tri}t|jD]z}|durDtj|jj}n|}|j di}| D]B\}} | durvtd} t| t rt | dd} t | ||} | ||<q^q(|r|Sdd| DS|durt|tjr|j}n"|} t| dr| j} qt| d i}|dur|}n|dur|}t|dd}|durPt|trBiStd |t|} t|}| D]d\}} | durtd} t| t rt | } t | ||} || vr| |durt| } | ||<qh|r|Sd d| DS) aReturn type hints for an object. This is often the same as obj.__annotations__, but it handles forward references encoded as string literals, adds Optional[t] if a default value equal to None is set and recursively replaces all 'Annotated[T, ...]' 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. __no_type_check__NrRFrcSsi|]\}}|t|qSrY_strip_annotationsrpkrqrYrYrZ ruz"get_type_hints.. __wrapped__ __globals__z1{!r} is not a module, class, method, or function.cSsi|]\}}|t|qSrYrrrYrYrZrru)rrVrUreversedrWrmodulesrirritemsrWr rrg ModuleTyperir_allowed_typesr_rvrr&r) rmrrinclude_extrashintsrJ base_globalsannrrnsobjrrYrYrZrL`s^                   rLcCst|trt|jSt|trJtdd|jD}||jkr@|S||St|trtdd|jD}||jkrv|St|j|S|S)z.Strips the annotations from a given type. css|]}t|VqdSrrrrYrYrZrruz%_strip_annotations..css|]}t|VqdSrrrrYrYrZrru) rVrrrr^r]ryrrr)rq stripped_argsrYrYrZrs        rcCs2t|trtSt|ttfr"|jS|tur.tSdS)aGet 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 N)rVrrrr rr^r)tprYrYrZrKs rKcCsft|tr|jf|jSt|ttfrb|j}|jtjj ur^|dt ur^t |dd|df}|SdS)aGet type arguments with all substitutions performed. For unions, basic simplifications used by Union constructor are performed. Examples:: get_args(Dict[str, int]) == (str, int) get_args(int) == () get_args(Union[int, Union[T, int], str][int]) == (int, str) get_args(Union[int, Tuple[T, int]][str]) == (int, Tuple[str, int]) get_args(Callable[[], T][int]) == ([], int) rNr9rY) rVrrr^rsr]rrrlrcr r:r)rrrYrYrZrJs rJcCst|trt|j}|jD]"\}}||j|fvr||q|D](}t|tj r`d|_ t|trJt |qJz d|_ Wnt yYn0|S)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) rVrUrcopyrrGpopvaluesrgrkrrNr_)rX arg_attrsrrrmrYrYrZrNs         rNcstfdd}|S)zDecorator 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)rN)rrrrrYrZwrapped_decoratorsz2no_type_check_decorator..wrapped_decorator)rr)rrrYrrZrOsrOcOs tddS)z*Helper for @overload to raise when called.zYou 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.N)NotImplementedErrorrrYrYrZ_overload_dummysrcCstS)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)rrYrYrZrQ(srQcCs|S)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. rY)frYrYrZrIEsrITKTVTT_co)rV_coVT_coT_contra)rCT_co)rrrGrrbr8aCallable 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. r)rr9rr a@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;r8r=r>rr-r9r:raA 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@s&eZdZdZdZeedddZdS)r4z(An ABC with one abstract method __int__.rYreturncCsdSrrYrrYrYrZ__int__szSupportsInt.__int__N)rlrirjrrrintrrYrYrYrZr4sr4c@s&eZdZdZdZeedddZdS)r2z*An ABC with one abstract method __float__.rYrcCsdSrrYrrYrYrZ __float__szSupportsFloat.__float__N)rlrirjrrrfloatrrYrYrYrZr2sr2c@s&eZdZdZdZeedddZdS)r1z,An ABC with one abstract method __complex__.rYrcCsdSrrYrrYrYrZ __complex__szSupportsComplex.__complex__N)rlrirjrrrcomplexrrYrYrYrZr1sr1c@s&eZdZdZdZeedddZdS)r0z*An ABC with one abstract method __bytes__.rYrcCsdSrrYrrYrYrZ __bytes__szSupportsBytes.__bytes__N)rlrirjrrrbytesrrYrYrYrZr0sr0c@s&eZdZdZdZeedddZdS)r3z*An ABC with one abstract method __index__.rYrcCsdSrrYrrYrYrZ __index__szSupportsIndex.__index__N)rlrirjrrrrrrYrYrYrZr3sr3c@s&eZdZdZdZeedddZdS)r/zMAn ABC with one abstract method __abs__ that is covariant in its return type.rYrcCsdSrrYrrYrYrZ__abs__szSupportsAbs.__abs__N)rlrirjrrrrrrYrYrYrZr/sr/c@s*eZdZdZdZedeedddZdS) r5zOAn ABC with one abstract method __round__ that is covariant in its return type.rYr)ndigitsrcCsdSrrY)rrrYrYrZ __round__szSupportsRound.__round__N)r) rlrirjrrrrrrrYrYrYrZr5sr5rYcCs@dd|D}dd|D}tj||||d}||_|j_|S)NcSsg|] \}}|qSrYrYrpnrqrYrYrZrtruz!_make_nmtuple..cSs$i|]\}}|t|d|dqS)zfield z annotation must be a typerrrYrYrZrsz!_make_nmtuple..rmodule)rl namedtuplerRrS)rrgrrfieldsnm_tplrYrYrZ _make_nmtuple sr> _field_defaults_replace_asdict_source_fieldsrrrS_make__getnewargs__>rlrRric@seZdZddZdS)NamedTupleMetac s|dtusJdi}g}|D]L}|vr<||q$|r$td|dt|dkrZdnddd |q$t||fd d |Dd d }D]<}|tvrt d|q|t vr||j vrt |||q|S)NrrRzNon-default namedtuple field z cannot follow default fieldrs r-csg|] }|qSrYrY)rprnsrYrZrt.ruz*NamedTupleMeta.__new__..rirz&Cannot overwrite NamedTuple attribute ) _NamedTuplerrvr_r}r1rr _prohibitedr_specialrr) r~typenamerrrg default_names field_namerkeyrYrrZrS!s,     zNamedTupleMeta.__new__N)rlrirjrSrYrYrYrZrsrc Ks`|dur|}n |rtdztdjdd}WnttfyPd}Yn0t|||dS)aTyped 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 bothrrlr)r) rr_rrrrrrr)rrrrrYrYrZr?9s  r?cCs*t|dkrtd|dtus$JtfS)Nrz5Multiple inheritance with NamedTuple is not supportedr)r}r_r?rrrYrYrZ_namedtuple_mro_entries^s rc@s&eZdZdddZeZddZeZdS)_TypedDictMetaTc s |D]}t|turtdqtt|tf|}i}|di}t|} dfdd|D}t} t} |D]@}| |j di| |j dd| |j ddqv| ||r| | 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 classrRz?TypedDict('Name', {f0: t0, f1: t1, ...}); each t must be a typecsi|]\}}|t|qSrYr)rprrrrYrZrzsz*_TypedDictMeta.__new__..__required_keys__rY__optional_keys__ __total__)rUrr_rSr&rrrXrupdaterrRr?rrrir) r~rrrtotalrJtp_dictr\own_annotationsown_annotation_keys required_keys optional_keysrYrrZrShs6           z_TypedDictMeta.__new__cCs tddS)Nz4TypedDict does not support instance and class checksr)r~rrYrYrZrsz _TypedDictMeta.__subclasscheck__N)T)rlrirjrSr&rrrrYrYrYrZrgs *rrc Ksj|dur|}n |rtddt|i}ztdjdd|d<WnttfyXYn0t|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 bothrRrrlrrirYr) r_r&rrrrrrr)rrrrrrYrYrZr@s* r@cCstfSr) _TypedDictrrYrYrZrurcCsdd}||_||_|S)a%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 function 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 cSs|SrrY)r$rYrYrZruszNewType..new_type)rl __supertype__)rrrurYrYrZrMsrMc@seZdZdZdZeeedddZeeedddZ eddd d Z eee dd d Z ee dd dZeddddZee dddZed7e edddZee dddZed8e edddZed9e eedddZed:e e e d d!d"Zee dd#d$Zee dd%d&Zed;e e d'd(d)Zee dd*d+Zeee d,d-d.Zeeedd/d0d1Zed2dd3d4Zeddd5d6ZdS)rrrrr"r!_TYPING_INTERNALS_SPECIAL_NAMESrYr]r`rardrprhrrrrrRrHrrkBuiltinFunctionType MethodTyperrrLrrKrJrNrOrrQrIrrrrrrrrUrrrWrG_aliasrr'r*r)r(rrr.r%rr+r r=rr#rr!r$r"rryrrr;dequer8rr>r rrr&rerrfr-r&r9 defaultdictr:r<r7r6rAr,rr4r2r1r0r3r/r5rrrrr?rSrrrrr@rrMrSrTrCrBrFrrlrrErDrYrYrYrZsf`          %  $8TFS&! Q  b)5  W                    #49 c#