B @Z? >@sddlZddlmZmZddlZddlZddlZddlZddlZddlZ ddl Z ddl Z ddl m Z m Z mZdddddd d d d d ddddddddddddddddddd d!d"d#d$d%d&d'd(d)d*d+d,d-d.d/d0d1d2d3d4d5d6d7d8d9d:d;dd?d@dAg>ZddCdDZdEdFZdGdHZdIdJZdKdLZdMdNZgZdOdPZdQdRZGdSdTdTZGdUdVdVZGdWdXdXeedBdYZeddZd[Zed>d\d[Zedd]d[Zed d^d[Zed d_d[Z Gd`ddedBdYZ!Gdad d eedBdYZ"d2d d0d4d5d/d1d ddb Z#dcddZ$GdedfdfedBdYZ%Gdgdhdhe%dBdYZ&GdiddZ'GdjdkdkZ(GdldmdmZ)dnd9Z*dodpZ+e j,e j-e j.e j/e e efZ0ddqd:Z1drd<Z2dsd=Z3dtduZ4dvd?Z5Gdwdxdxe6Z7Gdydzdze'e7d{Z8e"d|Z9e"d}Z:e"d~Z;e"ddBdZe"ddBdZ?e"ddBe6dZ@e"d8eAeBZCdddZDeDejjEdZEeDejjFe<ZFeDejjGefZUeDejjVe:e;fZVeDejjWe<ZWeDejjXe9ZXeDejjYdZYe&eZdddBdZ[de[_QeDe\e9ddZ]eDej^e9Z_eDe`e9ddZReDeaefZeeDejjfe>ZfeDejge<ZheDejie<ZjeDeke:e;fddZleDejme:e;fZneDejoe:e;fZoeDejpe9ZpeDejqe:e;fZqeDejjresz&_collect_type_vars..)rHrappendrJ_specialextend__parameters__tuple)rXr_rR)r`rS_collect_type_varss  rgcCst|ts|St|j}x\t|jD]N\}}t|trbx:t|D]\}}||kr@||||<q@Wq$t|||||<q$W|jtkrtt |S| t |S)N) rHrJlist__args__ enumerater _subs_tvarsrKrrf copy_with)tpr`ZsubsZnew_argsarOiZtvarrRrRrSrks     rkc Cs^|jst|dt|}t|j}||krZtd||kr>dndd|d|d|dS)Nz is not a generic classzToo ZmanyZfewz parameters for z ; actual z , expected )rerLlen)cls parametersZalenZelenrRrRrS_check_generics  rscCsg}xn|D]f}t|tr0|jtkr0||jq t|trft|dkrf|dtkrf||ddq ||q Wt |}t|t|krg}x(|D] }||kr||| |qW|}t|S)Nr) rHrJrKrrdrirfrprbsetremove)rrparamspZ all_paramsZ new_paramsr_rRrRrS_remove_dups_flattens  "  rycs4ttjtfdd}|S)Ncs*y ||Stk rYnX||S)N)rL)argskwds)cachedfuncrRrSinners  z_tp_cache..inner) functools lru_cache _cleanupsrb cache_clearwraps)r}r~rR)r|r}rS _tp_caches  rcsbt|tr|St|tr^tfdd|jD}||jkrH|S||}|j|_|S|S)Nc3s|]}t|VqdS)N) _eval_type)r^rn)globalnslocalnsrRrS sz_eval_type..)rHr _evaluaterJrfrirlrc)r_rrZev_argsresrR)rrrSrs     rc@seZdZdZddZdS)_Final) __weakref__cOsd|krtddS)N_rootz&Cannot subclass special typing classes)rL)selfrzr{rRrRrS__init_subclass__sz_Final.__init_subclass__N)rZrVrW __slots__rrRrRrRrSrsrc@seZdZddZddZdS) _ImmutablecCs|S)NrR)rrRrRrS__copy__sz_Immutable.__copy__cCs|S)NrR)rZmemorRrRrS __deepcopy__!sz_Immutable.__deepcopy__N)rZrVrWrrrRrRrRrSrsrcsleZdZdZfddZddZddZdd Zd d Zd d Z ddZ ddZ ddZ e ddZZS)rM)_name_doccsBt|dkr6t|dtr6t|dtr6td|t|S)NrrtzCannot subclass )rprHrIrfrLsuper__new__)rqrzr{) __class__rRrSr,s  z_SpecialForm.__new__cCs||_||_dS)N)rr)rnamedocrRrRrS__init__9sz_SpecialForm.__init__cCst|tstS|j|jkS)N)rHrMNotImplementedr)rotherrRrRrS__eq__=s z_SpecialForm.__eq__cCs t|jfS)N)hashr)rrRrRrS__hash__Bsz_SpecialForm.__hash__cCs d|jS)Nztyping.)r)rrRrRrS__repr__Esz_SpecialForm.__repr__cCs|jS)N)r)rrRrRrS __reduce__Hsz_SpecialForm.__reduce__cOstd|dS)NzCannot instantiate )rL)rrzr{rRrRrS__call__Ksz_SpecialForm.__call__cCst|ddS)Nz! cannot be used with isinstance())rL)rr\rRrRrS__instancecheck__Nsz_SpecialForm.__instancecheck__cCst|ddS)Nz! cannot be used with issubclass())rL)rrqrRrRrS__subclasscheck__Qsz_SpecialForm.__subclasscheck__cs|jdkr t|d}t||fS|jdkr|dkr:tdt|tsJ|f}dtfdd|D}t|}t|d kr|d St||S|jd krt|d }t|t dfSt|d dS)Nr z"ClassVar accepts only single type.rrRz Cannot take a Union of no types.z)Union[arg, ...]: each arg must be a type.c3s|]}t|VqdS)N)rT)r^rx)rPrRrSr_sz+_SpecialForm.__getitem__..rtrr z#Optional[t] requires a single type.z is not subscriptable) rrTrJrLrHrfryrprrG)rrritemrOrR)rPrS __getitem__Ts$         z_SpecialForm.__getitem__)rZrVrWrrrrrrrrrrrr __classcell__rRrR)rrSrM%s rM)ra`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. )raSpecial 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. 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(). 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]. zEOptional type. Optional[X] is equivalent to Union[X, None]. c@s:eZdZdZdddZddZddZd d Zd d Zd S)r )__forward_arg____forward_code____forward_evaluated____forward_value____forward_is_argument__TcCsnt|tstd|yt|dd}Wn"tk rJtd|YnX||_||_d|_d|_||_ dS)Nz*Forward reference must be a string -- got zevalz/Forward reference must be an expression -- got F) rHrIrLcompile SyntaxErrorrrrrr)rrOrQcoderRrRrSrs zForwardRef.__init__cCsj|jr||k rd|dkr(|dkr(i}}n|dkr6|}n |dkrB|}tt|j||d|jd|_d|_|jS)Nz*Forward references must evaluate to types.)rQT)rrTrrrr)rrrrRrRrSrs   zForwardRef._evaluatecCs>t|tstS|jr2|jr2|j|jko0|j|jkS|j|jkS)N)rHr rrrr)rrrRrRrSrs     zForwardRef.__eq__cCs t|jS)N)rr)rrRrRrSrszForwardRef.__hash__cCsd|jdS)Nz ForwardRef())r)rrRrRrSrszForwardRef.__repr__N)T) rZrVrWrrrrrrrRrRrRrSr s  c@s2eZdZdZddddddZddZd d ZdS) r)rZ __bound____constraints__ __covariant____contravariant__NF)bound covariant contravariantc s||_|r|rtdt||_t||_|r>|dk r>td|rVt|dkrVtddtfdd|D|_|rt |d|_ nd|_ yt dj d d }Wnttfk rd}YnX|d kr||_dS) Nz"Bivariant types are not supported.z-Constraints cannot be combined with bound=...rtz"A single constraint is not allowedz:TypeVar(name, constraint, ...): constraints must be types.c3s|]}t|VqdS)N)rT)r^r_)rPrRrSr#sz#TypeVar.__init__..zBound must be a type.rZ__main__typing)rZ ValueErrorboolrrrLrprfrrTrsys _getframe f_globalsgetAttributeErrorrV)rrrrrZ constraintsZdef_modrR)rPrSrs(    zTypeVar.__init__cCs&|jr d}n|jrd}nd}||jS)N+-~)rrrZ)rprefixrRrRrSr/s zTypeVar.__repr__cCs|jS)N)rZ)rrRrRrSr8szTypeVar.__reduce__)rZrVrWrrrrrRrRrRrSrs , ) rhrfdictru frozensetdeque defaultdictrGr7cCs|do|dS)N__) startswithendswith)attrrRrRrS _is_dunderSsrcseZdZddddddZeddZd d Zd d Zd dZddZ ddZ ddZ ddZ fddZ ddZddZddZZS)rJTFN)instspecialrcCsz||_||_|r*|dkr*|j}t||}||_t|ts@|f}||_tdd|D|_ t ||_ d|_ |sv|j |_ dS)Ncss*|]"}|tkrdn|tkrdn|VqdS).rRN)_TypingEllipsis _TypingEmpty)r^rnrRrRrSrjsz)_GenericAlias.__init__..)_instrcrZ_normalize_aliasrrrHrfrKrirgrerrV)roriginrwrrrZ orig_namerRrRrSr`s     z_GenericAlias.__init__cs^|jttfkrtd|t|ts,|f}dtfdd|D}t||t||j|S)Nz%Cannot subscript already-subscripted z*Parameters to generic types must be types.c3s|]}t|VqdS)N)rT)r^rx)rPrRrSrzsz,_GenericAlias.__getitem__..) rKr rFrLrHrfrsrkre)rrwrR)rPrSrrs  z_GenericAlias.__getitem__cCst|j||j|jdS)N)rr)rJrKrr)rrwrRrRrSrl~sz_GenericAlias.copy_withcCs|jdks&t|jdkrx|jdtkrx|jr8d|j}n t|j}|jshdddd|jDd }nd }||S|jrd Sd dd d|jddDdt|jdd S)Nrrztyping.[z, cSsg|] }t|qSrR)r])r^rnrRrRrSrasz*_GenericAlias.__repr__..]ztyping.Callableztyping.Callable[[cSsg|] }t|qSrR)r])r^rnrRrRrSrasz], )rrpriEllipsisr]rKrcjoin)rrrzrRrRrSrs     z_GenericAlias.__repr__cCsRt|tstS|j|jkrdS|jtkrF|jtkrFt|jt|jkS|j|jkS)NF)rHrJrrKrrri)rrrRrRrSrs  z_GenericAlias.__eq__cCs,|jtkrttt|jfSt|j|jfS)N)rKrrrri)rrRrRrSrs z_GenericAlias.__hash__cOsT|js$td|jd|jd|j||}y ||_Wntk rNYnX|S)NzType z cannot be instantiated; use z () instead)rrLrlowerrKZ__orig_class__r)rrzkwargsresultrRrRrSrs  z_GenericAlias.__call__cCs|jrZg}|j|kr ||j||}tdd||ddDsR|tt|S|jtkr||}x.||ddD]}t|tr||k rdSqW|jfS)Ncss"|]}t|tpt|tVqdS)N)rHrJ issubclassr )r^brRrRrSrsz0_GenericAlias.__mro_entries__..rtrR) rrKrbindexanyr rfrHrJ)rbasesrrorrRrRrS__mro_entries__s      z_GenericAlias.__mro_entries__cCs*d|jkrt|st|j|St|dS)NrK)__dict__rgetattrrKr)rrrRrRrS __getattr__s z_GenericAlias.__getattr__cs2t|s|dkr t||nt|j||dS)N)rrrc)rr __setattr__setattrrK)rrval)rrRrSrsz_GenericAlias.__setattr__cCs|t|S)N)rrG)rr\rRrRrSrsz_GenericAlias.__instancecheck__cCs<|jr0t|tst||jS|jr0t|j|jStddS)NzBSubscripted generics cannot be used with class and instance checks)rcrHrJrrKrL)rrqrRrRrSrs   z_GenericAlias.__subclasscheck__cCs|jr |jS|jr t|j}n|j}|tkrht|jdkrJ|jdtksht|jdd|jdf}n*t |j}t|dkrt |dt s|\}t j ||ffS)Nrrrrt) rcrglobalsrKrrprirrhrfrHoperatorgetitem)rrrzrRrRrSrs z_GenericAlias.__reduce__)rZrVrWrrrrlrrrrrrrrrrrrRrR)rrSrJWs      rJcs(eZdZddZefddZZS)_VariadicGenericAliascCs|jdks|js||St|tr0t|dkr8td|\}}|tkrRt|f}n$t|tsjtd|t||f}||S)Nrrz6Callable must be used as Callable[[arg, ...], result].z1Callable[args, result]: args must be a list. Got ) rrc__getitem_inner__rHrfrprLrrh)rrwrzrrRrRrSrs    z!_VariadicGenericAlias.__getitem__cs |jtkr|jr|dkr$|tfSt|ts4|f}t|dkrl|ddkrldt|d}||tfSdtfdd |D}||S|jt j j kr|jr|\}}d t|}|t kr|t|fSd tfd d |D}||f}||St |S) NrRrrt.z Tuple[t, ...]: t must be a type.rz*Tuple[t0, t1, ...]: each t must be a type.c3s|]}t|VqdS)N)rT)r^rx)rPrRrSr sz:_VariadicGenericAlias.__getitem_inner__..z.Callable[args, result]: result must be a type.z6Callable[[arg, ...], result]: each arg must be a type.c3s|]}t|VqdS)N)rT)r^rO)rPrRrSrs)rKrfrcrlrrHrprTr collectionsabcrrrr)rrwrxrzr)r)rPrSrs.      z'_VariadicGenericAlias.__getitem_inner__)rZrVrWrrrrrRrR)rrSrsrcs8eZdZdZfddZeddZfddZZS)r rRcsP|tkrtdtjtjkr8|jtjk r8t|}ntj|f||}|S)NzHType Generic cannot be instantiated; it can be used only as a base class)r rLrrobjectr)rqrzr{r\)rrRrSr.s zGeneric.__new__cst|ts|f}|s.|tk r.td|jddtfdd|D}|tkrtdd|Dsjtdtt|t|krtdn|t krn t ||t ||S) NzParameter list to z[...] cannot be emptyz*Parameters to generic types must be types.c3s|]}t|VqdS)N)rT)r^rx)rPrRrSr@sz,Generic.__class_getitem__..css|]}t|tVqdS)N)rHr)r^rxrRrRrSrCsz5Parameters to Generic[...] must all be type variablesz-Parameters to Generic[...] must all be unique) rHrfr rLrWr allrprurFrsrJ)rqrwrR)rPrS__class_getitem__8s$   zGeneric.__class_getitem__c stj||g}d|jkr(t|jk}nt|jko:|jdk}|rHtdd|jkr t|j}d}x8|jD].}t |t rj|j tkrj|dk rtd|j }qjW|dkr|}n`t |}t ||ksdfdd|D}ddd|D} td |d | d |}t||_ dS) N__orig_bases__rFz!Cannot inherit from plain Genericz0Cannot inherit from Generic[...] multiple types.z, c3s|]}|krt|VqdS)N)rI)r^r_)gvarsetrRrSrosz,Generic.__init_subclass__..css|]}t|VqdS)N)rI)r^grRrRrSrpszSome type variables (z) are not listed in Generic[r)rrrr r __bases__rZrLrgrHrJrKrerurrf) rqrzrr`errorZgvarsbaseZtvarsetZs_varsZs_args)r)rrSrQs6         zGeneric.__init_subclass__) rZrVrWrrrrrrrRrR)rrSr s c@s eZdZdS)rN)rZrVrWrRrRrRrSrwsrc@s eZdZdS)rN)rZrVrWrRrRrRrSr~srcCs|S)NrR)typrrRrRrSr<sc Csy |j}Wntk riSX|j}|j}|d|}|jp@d}|j}|rTt|ni}|t|}x&t||d|D]\}} | ||<qxW|S)NrR) __code__r co_argcount co_varnames __defaults____kwdefaults__rrpzip) r}rZ pos_countZ arg_namesdefaultsZ kwdefaultsrZ pos_offsetrvaluerRrRrS _get_defaultss     rc Cst|ddriSt|tri}xt|jD]~}|dkrFtj|jj}n|}|j di}xN| D]B\}}|dkrztd}t|t rt |dd}t |||}|||<qbWq*W|S|dkrt|tjr|j}n&|} xt| dr| j} qWt| di}|dkr|}n|dkr|}t|dd}|dkrFt|tr8iStd|t|} t|}xp| D]d\}}|dkrztd}t|t rt |}t |||}|| kr| |dkrt|}|||<q`W|S)N__no_type_check____annotations__F)rQ __wrapped__ __globals__z1{!r} is not a module, class, method, or function.)rrHrGreversed__mro__rmodulesrVrritemsrIr rrX ModuleTypehasattrr _allowed_typesrLformatrrr ) r\rrZhintsrZ base_globalsannrrZnsobjrrRrRrSr=s\                  cCst|tr||j}x0|jD]"\}}||j|fkr ||q Wx4|D](}t|tj rfd|_ t|trPt |qPWy d|_ Wnt k rYnX|S)NT) rHrGrcopyrrpopvaluesrXrYrr?rL)rOZ arg_attrsrrr\rRrRrSr?s      cstfdd}|S)Ncs||}t|}|S)N)r?)rzr{r}) decoratorrRrSwrapped_decorators z2no_type_check_decorator..wrapped_decorator)rr)rrrR)rrSr@scOs tddS)NzYou 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.)NotImplementedError)rzr{rRrRrS_overload_dummy&srcCstS)N)r)r}rRrRrSrB/scs,eZdZfddZddZddZZS) _ProtocolMetacs"t|jkrt|StddS)Nz+Protocols cannot be used with isinstance().)rFrrrrL)rr\)rrRrSrSs  z_ProtocolMeta.__instancecheck__csL|js tS|tkrdS|}x(|D] tfdd|jDs$dSq$WdS)NTc3s|]}|jkVqdS)N)r)r^d)rrRrSresz2_ProtocolMeta.__subclasscheck__..F) _is_protocolrrF_get_protocol_attrsrr )rrqattrsrR)rrSrXs z_ProtocolMeta.__subclasscheck__cCs&g}x.|jD]$}t|ddr |jdkr ||q Wt}x|D]}x|jD]}x|jD]$}||k r^||jkr^t|dds^Pq^W|dsR|dkrR|dkrR|dkrR|dkrR|dkrR|d krR|d krR|d krR|d krR|d krR|dkrR|dkrR|dkrR|dkrR|dkrR|dkrR||qRWqBW|S)NrFrFZ_abc___abstractmethods__r rZ_gorgrrirrZ__next_in_mro__rerKrZ __extra__Z __tree_hash__rV) r rrZrbrurkeysradd)rZprotocol_basescr rrrRrRrSris<     z!_ProtocolMeta._get_protocol_attrs)rZrVrWrrrrrRrR)rrSrLs rcs$eZdZdZdZfddZZS)rFrRTcs t|S)N)rr)rqrw)rrRrSrsz_Protocol.__class_getitem__)rZrVrWrrrrrRrR)rrSrFsrF) metaclassTKTVTT_co)rV_coVT_coT_contra)rCT_co)rrcCst||d|dS)NT)rr)rJ)rrwrrRrRrS_aliassr.rR)raCallable 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. F)rra@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, ...]. )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"eZdZdZeedddZdS)r.rR)returncCsdS)NrR)rrRrRrS__int__ szSupportsInt.__int__N)rZrVrWrrintr0rRrRrRrSr.sc@s"eZdZdZeedddZdS)r-rR)r/cCsdS)NrR)rrRrRrS __float__szSupportsFloat.__float__N)rZrVrWrrfloatr2rRrRrRrSr-sc@s"eZdZdZeedddZdS)r,rR)r/cCsdS)NrR)rrRrRrS __complex__szSupportsComplex.__complex__N)rZrVrWrrcomplexr4rRrRrRrSr,sc@s"eZdZdZeedddZdS)r+rR)r/cCsdS)NrR)rrRrRrS __bytes__'szSupportsBytes.__bytes__N)rZrVrWrrbytesr6rRrRrRrSr+#sc@s"eZdZdZeedddZdS)r*rR)r/cCsdS)NrR)rrRrRrS__abs__0szSupportsAbs.__abs__N)rZrVrWrrr)r8rRrRrRrSr*,sc@s&eZdZdZedeedddZdS)r/rRr)ndigitsr/cCsdS)NrR)rr9rRrRrS __round__9szSupportsRound.__round__N)r)rZrVrWrrr1r)r:rRrRrRrSr/5sc svdfdd|D}t|dd|D}t||_|_ytdjdd|_ Wnt t fk rpYnX|S)NzDNamedTuple('Name', [(f0, t0), (f1, t1), ...]); each t must be a typecsg|]\}}|t|fqSrR)rT)r^nr_)rPrRrSra@sz!_make_nmtuple..cSsg|] \}}|qSrRrR)r^r;r_rRrRrSraAsrrZr) r namedtupler6r  _field_typesrrrrrVrr)rrXnm_tplrR)rPrS _make_nmtuple>sr?) rrr__getnewargs___fields_field_defaultsr=_make_replace_asdictZ_source)rVrZr cseZdZfddZZS)NamedTupleMetac s|ddrt||||S|di}t||}g}i}xP|D]H}||krn||} || | ||<qF|rFtdj|d| dqFWt ||j_ t ||j_||_xD|D]<} | tkrtd| q| tkr| |jkrt|| || qW|S)NrFr zXNon-default namedtuple field {field_name} cannot follow default field(s) {default_names}z, ) field_nameZ default_namesz&Cannot overwrite NamedTuple attribute )rrrr?rrbrLrrr"rr6r rfrrB _prohibitedrrcrAr) rqtypenamernsrXr>rZ defaults_dictrGZ default_valuekey)rrRrSrVs0       zNamedTupleMeta.__new__)rZrVrWrrrRrR)rrSrFTsrFc@seZdZdZddZde_dS)r9TcOs|s td|^}}|r"|^}}nd|kr6|d}ntd|r~y |\}Wqtk rztdt|dddYqXn$d|krt|dkr|d}nd}|dkr|}n |rtd t||S) Nz*NamedTuple.__new__(): not enough argumentsrIzGNamedTuple.__new__() missing 1 required positional argument: 'typename'z@NamedTuple.__new__() takes from 2 to 3 positional arguments but rz were givenfieldsrtzIEither list of fields or keywords can be provided to NamedTuple, not both)rLrrrprr?)rzrrqrIrLrRrRrSrs,      zNamedTuple.__new__z*($cls, typename, fields=None, /, **kwargs)N)rZrVrWrr__text_signature__rRrRrRrSr9sscCsdd}||_||_|S)NcSs|S)NrR)xrRrRrSnew_typeszNewType..new_type)rZZ __supertype__)rrmrOrRrRrSr>sc@seZdZdZeedddZeedddZedddd Z ee dd d Z ee dd d Z eddddZee dddZed6e edddZee dddZed7e edddZed8e eedddZed9e e e dd d!Zee dd"d#Zee dd$d%Zed:e e d&d'd(Zee dd)d*Zeee d+d,d-Zeeedd.d/d0Zed1dd2d3Zeddd4d5ZdS);IOrR)r/cCsdS)NrR)rrRrRrSmodeszIO.modecCsdS)NrR)rrRrRrSrszIO.nameNcCsdS)NrR)rrRrRrScloseszIO.closecCsdS)NrR)rrRrRrSclosedsz IO.closedcCsdS)NrR)rrRrRrSfilenosz IO.filenocCsdS)NrR)rrRrRrSflushszIO.flushcCsdS)NrR)rrRrRrSisattysz IO.isattyr)r;r/cCsdS)NrR)rr;rRrRrSreadszIO.readcCsdS)NrR)rrRrRrSreadablesz IO.readable)limitr/cCsdS)NrR)rrYrRrRrSreadlinesz IO.readline)hintr/cCsdS)NrR)rr[rRrRrS readlines sz IO.readlinesr)offsetwhencer/cCsdS)NrR)rr]r^rRrRrSseek szIO.seekcCsdS)NrR)rrRrRrSseekablesz IO.seekablecCsdS)NrR)rrRrRrStellszIO.tell)sizer/cCsdS)NrR)rrbrRrRrStruncatesz IO.truncatecCsdS)NrR)rrRrRrSwritablesz IO.writable)sr/cCsdS)NrR)rrerRrRrSwrite!szIO.write)linesr/cCsdS)NrR)rrgrRrRrS writelines%sz IO.writelinesz IO[AnyStr]cCsdS)NrR)rrRrRrS __enter__)sz IO.__enter__cCsdS)NrR)rrGr tracebackrRrRrS__exit__-sz IO.__exit__)r)r)r)r)N)rZrVrWrrrIrQrrrRrrSr1rTrUrVr;rWrXrZr5r\r_r`rarcrdrfrhrirkrRrRrRrSrPsR rPc@s>eZdZdZeeeefedddZ eddddZ dS) BinaryIOrR)rer/cCsdS)NrR)rrerRrRrSrf7szBinaryIO.write)r/cCsdS)NrR)rrRrRrSri;szBinaryIO.__enter__N) rZrVrWrrrr7 bytearrayr1rfrirRrRrRrSrl2s rlc@seZdZdZeedddZeedddZee edddZ ee dd d Z ee dd d Zeddd dZdS)TextIOrR)r/cCsdS)NrR)rrRrRrSbufferEsz TextIO.buffercCsdS)NrR)rrRrRrSencodingIszTextIO.encodingcCsdS)NrR)rrRrRrSerrorsMsz TextIO.errorscCsdS)NrR)rrRrRrSline_bufferingQszTextIO.line_bufferingcCsdS)NrR)rrRrRrSnewlinesUszTextIO.newlinescCsdS)NrR)rrRrRrSriYszTextIO.__enter__N)rZrVrWrrrlrorIrpr rqrrrrrsrrirRrRrRrSrn@srnc@s"eZdZdddgZeZeZeZdS)iorPrnrlN)rZrVrW__all__rPrnrlrRrRrRrSrt^s rtz.ioc@seZdZddgZeZeZdS)rePatternMatchN)rZrVrWrurwrxrRrRrRrSrvmsrvz.re)T)NN)T)rrrrZcollections.abc contextlibrrrvZ stdlib_rerrXrrrrurTr]rgrkrsryrrrrrrMrrAr rr r rrrrJrr rrr<rrYBuiltinFunctionType MethodTyperrr=r?r@rrBrGrrFr&r'r(r)r*r+r,r-r7rIr;r.rr"r%r$r#rrr)r rr&r__doc__r7rrrrrrrrfr rhr5rr2rurr8rrrr!AbstractContextManagerrAbstractAsyncContextManagerr(rr3rr4r6r1r0r:r'rr.r-r,r+r*r/r?rHrcrFr9r>rCrDrPrlrnrtrZrrwrxrRrRrRrSs !   E  2a/_   V D                  <`