ML i dZddlmZddlmZddlmZmZmZddl m Z m Z ddl m Z ddlmZddlmZmZmZdd lmZdd lmZdd lmZdd lmZmZmZmZmZm Z m!Z!m"Z"m#Z#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/dd l0m1Z1ddl2m3Z3ddl4m5Z5m6Z6m7Z7m8Z8m9Z9m:Z:m;Z;mZ>m?Z?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZHmIZImJZJmKZKmLZLmMZMmNZNmOZOmPZPmQZQmRZRmSZSGddZTddddddddd d8dZU d9 d:dZV d9 d;dZW d9 ddZZd?dZ[ d@dZ\dAdZ]dBdZ^ dCd Z_dDd!Z`dEd"ZadFd#ZbdGd$Zcddd% dHd&Zd dId'Ze dJd(Zf dK dLd)Zg dMd*Zhddd+ dNd,Zi dOd-Zj dPd.Zk dQd/Zl dR dSd0Zm dTd1Zned2eA3Zod9dUd4ZpdVd5ZqdWd6ZrdXd7Zsy)Yz!Type checking of attribute access) annotations)Sequence)CallableTypeVarcast)message_registrystate)TypeCheckerSharedApi)erase_typevars)expand_self_typeexpand_type_by_instancefreshen_all_functions_type_vars)map_instance_to_supertype)is_overlapping_types)MessageBuilder)ARG_POSARG_STAR ARG_STAR2EXCLUDED_ENUM_ATTRIBUTESSYMBOL_FUNCBASE_TYPESContext Decorator ExpressionFuncBaseFuncDef IndexExprMypyFileNameExprOverloadedFuncDef SymbolTableTempNode TypeAliasTypeInfoTypeVarLikeExprVar is_final_node)AttributeContext) is_subtype) bind_selferase_to_boundfreeze_all_type_vars function_typeget_all_type_varsmake_simplified_unionsupported_self_typetuple_fallback)AnyType CallableType DeletedType FunctionLikeInstance LiteralTypeNoneType Overloaded ParamSpecType PartialType ProperType TupleTypeType TypedDictType TypeOfAnyTypeTypeTypeVarLikeTypeTypeVarTupleType TypeVarTypeUninhabitedType UnionTypeget_proper_typeceZdZdZdddddddd d dZd dZd dZddZdddd  dd Zy) MemberContextzInformation and objects needed to type check attribute access. Look at the docstring of analyze_member_access for more information. NF) self_typemodule_symbol_table no_deferralis_selfrvaluesuppress_errorspreserve_type_var_idsc ||_||_||_||_|xs||_||_||_|j|_||_| |_ | |_ | |sJ| |_ | |_ | |_ yN) is_lvalueis_super is_operator original_typerIcontextchkmsgrJrKrLrMrNrO)selfrRrSrTrUrVrWrIrJrKrLrMrNrOs V/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/mypy/checkmember.py__init__zMemberContext.__init__Vs"#  &*"3m 77#6 &   9 .&;"c8|jj|SrQ)rW named_type)rYnames rZr^zMemberContext.named_type{sxx""4((r\c<|jj||yrQ)rWhandle_cannot_determine_type)rYr_rVs rZnot_ready_callbackz MemberContext.not_ready_callback~s --dGanalyze_typeddict_accessr7analyze_none_member_accessrArCvaluesr. upper_boundr3rNrXdeleted_as_rvaluerV from_errorrD ambiguousreport_missing_attributerU)r_rzrfrt attr_types rZrwrws # C#x -dC]KK C !y11cBB C #*4b99 C &3??+<24bAA C ".tS"mLL C #%dN3,?]SS C+|4 5%dCLL"mLL C ''c2}EE C ")$R88 C ) c; 'CJJ)+CJJ7] &dCOOROO C %!! FF $ $S"** 5y++,, C )#% !mm  #B$4$4c4 DDr\c |jjry|jj5|jj 5}|jj ||}| ddddddyt |||j||}|j cdddcdddS#1swYnxYwdddy#1swYyxYw)z7Check if the given type has the attribute when awaited.FNrI) rWchecking_missing_awaitchecking_await_setrX filter_errorsget_precise_awaitable_typerwrghas_new_errors)r_rzrfrt local_errorsaw_type_s rZmay_be_awaitable_attributers vv$$  " " $1bff&:&:&<1 &&33CF ?111 # '2++g+>   ..001111111s/C B?-C>.B?, C?C CCc|jrttjS|jj ||||j |j}|jjs4t||||r&|jj|j |ttjSrQ) rNr1r?rrX has_no_attrrVrJprefer_simple_messagesrpossible_missing_await)rUrzr_rfrt error_codes rZrr*s y++,,##M3bjj"J`J`aJ 66 ( ( * %dC] C FF ) )"**j A 9'' ((r\c|j}|r|}|j|}|dk(r^|jsR|jsF|r |js8|j t j ttjStjr|jtjdk(rc|tjdk(rM|jsA|jjdj tj|j"|rt%|t&s|jr|js t)|||j*rt%|t,sJ|j.d}t%|t&sJ|j0rF|j2j4r0|j6j9|j:|j"t=||j2||S|j0r1|js%|jj?|j"t%|t,stA||jCd}n|jW|jDs2|j.r&|jG|j|j"ttjHSt%|jtJsJ|j}|jLs tO|}|jPst%|tRt,fr#|jTrtW||jX}nZt[||jX|j\|j"||j}t_||jX|j\}ta||jb}te||}tg||Sti||||S)Nr[rzOccurrence of '{}.{}'builtins.functionis_classmethod)5type get_methodrSis_finalrdrCANNOT_ACCESS_INITr1r?rr find_occurrencesr_rNrXnoteformatrVrxrvalidate_super_call is_propertyritemsrRvaris_settable_propertyrWwarn_deprecatedsetter analyze_varcant_assign_to_methodr,r^rKrb special_formr8rOr is_staticris_trivial_selfbind_self_fastrIcheck_self_argis_classr)rinfor r+analyze_member_var_access) r_rzrfrtrmethodgetter signature member_types rZrr>s 88D __T "F z"++dmmV__ GG$77 89//0 0  II//2 2 E**1- -""  2+22E4J4JKRZZXj3 ;;r11  +   f&78 88\\!_Ffi0 00|| ? ?&&v}}bjjAtVZZb9 9 << 2 2 FF ( ( 4&"34%fbmm499DIINND//L!!djjdjjmY7 77::a=--==L DIItyy~~rzzBr\c|jdj}t|tsJt|tr t |}t|t r |j}t|trX|js5t||||jdj|j}|r|St||j|SJd|)Nr) original_vars mcs_fallbackzUnexpected type ) rret_typerxr;r<r0r>rr5rTanalyze_class_attribute_access variablesrw)r_rzrfrr{s rZrrsyy|$$H h ++ +(I&!(+(M*$$(H%~~4$#))A,2H2HWZWcWcF %dCLL"==5( 55ur\cRd}|jd}t|jtr|j}n$t|jtr2|j j 5t||||cdddSt|jtrt|jj}t|tr|}nt|tr8t|tj||j|j||St|t r t#|}n&t|tr|j j 5t||||cdddSt|jt rt#|j}nt|jt$r1|jj'r|jj(}nht|jtrNt|jjtr*|jjj*j,}d}||j*j,xs|}|rQ|j.sEt1|||||}|r3tt|tr|j*j2s|Sd}|j j |5t||||cdddS#1swYxYw#1swYxYw#1swYyxYw)N builtins.type)linecolumnF)rrtT)r)r^rxitemr5r1rXrrwrCrFrrEr@make_normalizedrrr<r0r4rrrmetaclass_typerTrfallback_to_any) r_rzrfrtrrrignore_messagesr{s rZrrsn D}}_-H#((H%xx CHHg & VV ! ! # M)$"mL M M CHHk *%chh&:&:; k8 ,D  Y /)((388CJJW    Y /!+.D  W -%%' Q-dHb-P Q Q CHHi (chh' CHHl +0D0D0Fxx   CHHh ' chhmmX .88==%%44DO 99++7x BNN/ $  v6@TYYE^E^ #'   O  <I%dHb-HIIW M M  Q Q6IIs$0L%L-LLLL&c |jj5g}|jD]0}|j|}|j t |||2 dddt |S#1swYt SxYw)Nr)rXdisable_type_namesrelevant_itemsrgappendrwr.)r_rzrfresultssubtypeitem_mxs rZrrs  " " $K))+ KG&&&9G NN1$I J KK ! )) K ! ))s AA55Bc |dk(r;td|jd}tggg||jdSt||jd|S)N__bool__Fz builtins.boolrr) arg_types arg_kinds arg_namesrrbuiltins.object)r6r^r2rw)r_rzrf literal_falses rZrrs` z#EBMM/4RS "]]#67   &dBMM:K,LbQQr\c  |j|}|r |jnd}|jj||j|}d}t |t r_|j}|jjxr |j }|jr"|jst|j|t |trJdt |tr/|jj j#|j$t |t&t(tt*frO|jj,j/||j|j0}t3||}||_t |t2rh||j6} |j0r<|jj9s"t;|||j<|jt?||||| |S|s|dvr|j@s|jB|j0sdD]} |jE| } | s| j4j$dk7s2tG| || | } tI|| j4}tKtM| |} t | tNr | jP}n| }| j4j$d |}|jjRjU|}|rF|tWtK|jX||j0|j|j}|cSn|jEd }|r|j4j$dk7rtG||d |j[d  }tI||j4}tKtM||}t |tNr't]|j^d kDr|j^dS|j`jbrtetfjhS|jjrG||jjjlvr/|jjjns|jjjl|S|jrK|js?|j<jq||jtetfjrStu|jX|||}|jB||jBvr|jB|jvsw|jB|j}ty|}|j{|j||_|jj,j}||j0S|S)zAnalyse attribute access that does not target a method. This is logically part of analyze_member_access and the arguments are similar. original_type is the type of E in the expression E.var NFzDid not expect a function)rimplicitr) __getattr__ __setattr____getattribute__)rrrdefnityper_rf.r)rRr)lvalue)?getrrWrrVrxrrrr decoratorsrSrNrrr module_refsaddfullnamer#r"r$ expr_checkeranalyze_static_referencerRr%rrget_final_contextcheck_final_memberrXrrTrJr$analyze_decorator_or_funcbase_accessrrFr r2rpluginget_attribute_hookr'rUrglenrrrr1r?r extra_attrsattrsmod_nameundefined_in_superclassrr module_publicrset_lineanalyze_ref_expr)r_rrrfrvvvrrzr method_namer bound_method getattr_typer{rhook setattr_meth bound_type setattr_typeretes rZrrsv 88D>D tAFF1bjj) BO"i FF''11G"--6G ;;r11  ,!W111u!X qzz*"xHoFGff!!::2rzz2<<X 3 !S:&& << 8 8 : tT2662:: >4E2Rabb J J  " " * ||B " 5 fkk226GG#G#5{r$L4E6;;GC#23JO OA%&''%'8  0|7H7HI./FzSV/WX lL9c,BXBX>Y\]>]'11"55 zz!!y--.. TU%6%6%<%<<  ))$$**40 0 {{2-- &&tRZZ8y++,,&r'7'7bI  " " ....**40>>&&t,11AA JJrzz "AF66&&77",,7O O r\c|jD]J}|jj|}|s!t|js7|j |d|Ly)z?Give an error if the name being assigned was declared as final.T) attr_assignctxN)mronamesrr&rcant_assign_to_final)r_rrXrbasesyms rZrrsLFjjnnT" =*  $ $Tt $ EFr\c >t|j}|}t|}t|tr-t |j Dcgc]}t ||c}St|ts|S|js|jjds|S|jr'|jjdr t||S|jr|jjds|S|jjd}|j|jtjj!|j#|j$j&t)t*j,St/||d|j1|}t3||j4}t7||}t|t8r4|j;r$|j dj<}t?}n)t|t@r|jB}t?}n|}|jDjFjI|d} |jDjFjK| |tM||jNtMtAjP||jNgtRtRg|jN|}|jDjFjU|tM||jNtMtAjP||jNgtRtRg|jN|| \} } |jDjW||jNt| } t| t(r| St| tXsj|jtjj!|j#|j$j&t)t*j,S| j<Scc}w) a]Type check descriptor access. Arguments: descriptor_type: The type of the descriptor attribute being accessed (the type of ``f`` in ``a.f`` when ``f`` is a descriptor). mx: The current member access context. Return: The return type of the appropriate ``__get__/__set__`` overload for the descriptor. __get____set__rrrrV object_typer callable_name)-rFrIrxrEr.ranalyze_descriptor_accessr5rRrhas_readable_memberanalyze_descriptor_assignrrdrDESCRIPTOR_GET_NOT_CALLABLErstr_with_optionsrXoptionsr1r?rrrgrrr r4rrr7r@rrWrmethod_fullnametransform_callee_typer!rVrr check_callrr2) descriptor_typerf instance_typeorig_descriptor_typerz dunder_getrdunder_get_type owner_typerrinferred_dunder_get_types rZr r sX$BLL1M*%o6O/9-$;J;P;P QC &sB / Q   2## << 4 4 H H S## ||,,@@K("== ||O00DDYO## %%00;J   8 8 ? ?00@  y++,,7    o  6 L $OZ__ EC-lC@O-.=3L3L3N"((+44  M8 ,"''  " FF''77SMff))?? ]BJJ 7 X--j92:: N  ' #@ O#%&&"5"5"@"@ ]BJJ 7 X--j92:: N  ' ###A #AFF:rzz2./GH*G4'' . =   8 8 ? ?00@  y++,, # , ,,s RsPc t|j}|jjd}|t|j t j j|j|jjjttjSt||d|j!d|}t#||j$}t'||}|j(j*j-|d}|j.xs.t1ttj2|j4}|j(j*j7||t1||j4|gt8t8g|j4|}|} |jj;5|j(j*j=|t1||j4| gt8t8g|j4||\} } dddt } t?| t@r.t1ttj2|j4} |j(j*j=|t1||j4| gt8t8g|j4|||j(jC||j4t?| t@rtE| jFdkrttjS| jFd S#1swYxYw) NrF)rRrIrrrrr)$rFrIrrrdrDESCRIPTOR_SET_NOT_CALLABLErr$rXr%valuer1r?rrrgrrr rWrr&rMr!rrVr'rrr(rxr2rrr) r)rfr* dunder_setrrzdunder_set_typerrM type_contextrinferred_dunder_set_types rZr"r"s#BLL1M %%00;J   8 8 ? ?00@ e y++,,7    e  G L $OZ__ EC-lC@OFF''77SM YY W(79+A+A#BBJJWFff))?? - 4f= ' # @OL     &(ff&9&9&D&D  mRZZ 8, G g  JJ'' 'E' # #  //GH*L9 (>(> ?T FF"" - 4lC ' ## #FF:rzz2 / > $ . ./!3y++,, # - -a 00A  s =AL44L>c|j|jjvxrM|jj|jj|uxr|j xr |j S)z;Return if var is an instance variable according to PEP 526.)r_rrr is_classvar is_inferred)rs rZis_instance_varr;Fsa CHHNN" HHNN388 $ ) )S 0     r\rc d |}t||j}|jr3|jr'|j}|%|j r|j }n |j }|rt|tr2|jj||j||jS|jr|js{|jr=|js1|jj||j |j|j r&|jj#||jt%|||||}d} |j&r~t)|r |j*rgt-|}t|t.r|j1s|} n9|jr+|j3||d} t-t5d|| } n|} t| t.rY| j1sI|jr=|js1|js%|jj7|j| r|j8sg} t| t:r | j<n| gD]j} t-| } t| t.r-| j?r |jrtA| |||||}nt%| ||||}| jC|lt;jD| }nW|j s2|jFs&|jI|jJ|jtMtNjP}|jjRd|}|jjTjW|}|jjXr|js||jjZvr$|dvr t]||}|j3|}nOtt-|x}t^r4|j jRd k(r|j`r|j`d }|r/|s-|jjbr t)|s te||}|rF|tgt-|jh||j|j|j}|S) aAnalyze access to an attribute via a Var node. This is conceptually part of analyze_member_access and the arguments are similar. itype is the instance type in which attribute should be looked up original_type is the type of E in the expression E.var if implicit is True, the original Var was created as an assignment to self if is_trivial_self is True, we can use fast path for bind_self(). NF)rUrIrR__call__r>r_r3rryenum.nonmemberr)5rrrrR setter_typeis_readyrrxr:rWhandle_partial_var_typerVrNrrXread_only_propertyr9cant_assign_to_classvarexpand_without_bindingis_initialized_in_classr;rTrFr4rrgrwris_staticmethodrErboundexpand_and_bind_callabler make_unionrKrbr_r1r?rrrris_enum enum_membersr6r5args is_protocolr r'rU)r_rrrfrroriginal_ityperzr{ call_typedeco_mx bound_itemsctp_ctrrr  enum_literalp_results rZrrRs$N %eSXX 6E BLL?? ;3<<((Chh c; '6611#r||S"**U U << 2 2s'?'?))$ BJJG..tRZZ@'S%L(,  & &0D!#&C#|,S__5F **W\*]+,B:sT[,\]   i .y7L7L7N||COOB BC&sE2H" Or\c|js t|}tt|||j}t |t sJ|rt||j}nYt||j|j|j||j}t||j|j}t||}t||js|St |t r4|j"st%t&j(S|j"d}t |t*sJ||j,r|j.r|j0|j2r|j4xs.t7t%t&j8|j}|j:j<j?||gt@g|j\} } t| }t |t*sJ|jBst%t&j(S|jBdS|jDS)Nrr)#rOrrFr rIrxr4rrrrVrXr)r r+rr8rr1r?rr2rrRr@rrMr!rrWrr(rrr) functyperrr_rfrrzrYtype_ctxrinferred_expandeds rZrIrIs  # #28< *3",,G HC c< (( (S",,/S",,0B0BBJJPTVXV\V\]R\\3+=+=>&sE2H" ??(J'~~9//0 0>>!$ h -7x7 - BLLS__5P   yyaHWY5K5K-LVXV`V`$aH#%66#6#6#A#A8*wi$ A ''89Hh 5 55!!9//0 0!!!$$   r\ct|j}|jsl|js`|j}|rEt |t r |j }n(t |trt|j}n|}t|||Stt|jddr7|j}|rt |t r |j }t|||S|jrw|j|jk7r^|jjH||jjj!k(r!t|||jjS|S)zExpand special Self type in a backwards compatible manner. This should ensure that mixing old-style and new-style self-types work seamlessly. Also, re-bind new style self-types in subclasses if needed. F)allow_instancesallow_callable)rFrIrLrSrxr@rr2r rr r/rrrWscopeactive_self_type)trfrrroriginalrepls rZrXrXsr||,H JJ"++|| (H-}}Hl3%h&7&78Q--  %   ||  8X6==DQ-- JJ#(( " JJ , RVV\\224 4Q (<(<==r\c |j}|s|Sg}|rtj|}t|}|D]} | jr| j dt tfvr|j|| ||cSt| jd} t| trAt|tr1| j|jur| jr t|| s|j| |r|}g}|D]} t| jd} |dk(xrt| t} | s:t!|t#t%| t'dt)| Ddr|j| t| t*r|j| t| t,st.|s|j1|||d|||St3|dk(r|dSt5|S)aCheck that an instance has a valid type for a method with annotated 'self'. For example if the method is defined as: class A: def f(self: S) -> T: ... then for 'x.f' we check that type(x) <: S. If the method is overloaded, we select only overloads items that satisfy this requirement. If there are no matching overloads, an error is generated. rr=c3>K|]}t|t ywrQ)rxrC).0tvs rZ z!check_self_arg..Rs!46Jr;//!sT)always_covariantignore_pos_arg_namesr)rr@rrFrrrrno_formal_selfrxr5rrMrrr2r(r r*anyr-r9rBNotImplementedErrorincompatible_self_argumentrr8) r[dispatched_arg_typerrVr_rXr new_itemsp_dispatched_arg_typerselfarg self_callables rZrrs" NNE I&667JK+,?@~~!27H:M!M   tT7 3O!$.."34 gx (Z8Mx-X||4999gll+,A7K" &!$.."34 *Pz'

'2 3!!:KG:T!"&     T "  /   T " !1 2% %+&,  && %uQx  9~| i  r\)rtrc |j}|r|}|jd|}|jjj |}|j |} | s|j rG||j jvr/|j js|j j|S|js |jr$t||ttjSyt| j t"r4| j j$s|s|jj |ry|jj'| j |j(t| j t*} | xst| j t,} |j.rl|j0s`| r%|j2j5|j(t| j t6r|j9t:j<|j>r<||j>vr.|j9t:j@jC|| jDrrt| j t"rX| j jFrB|j9t:jHjC| j jJ|j.r<|jjMs"tO|||j2|j(|jPr,|j.s | s| stS|||} | r t||| S| j} | rt| tTr[| j }t|t"sJt|||jjW| |j.||j(St| j t*r!| j jXjZ}n9t| j t"t\fr| j jZ}nd}|sd}n t_||}t| j t"r|Jta|jb}| j j$ }te| j jZjfjh}|rO| j jZjbr/|jk| j jZjbt|tl xs | jD}|r_|teto| zrH| j j$rt:jp}nt:jr}|j9|tu| || j |d} tw| |} |rte|jjfjh}|r;|jjbr%|jk|jjbty| |Dchc]}|jzc}} | xr.t}t*| j j~jxsft| j t\xr| j jxs2t| j t"xr| j j}ta| } d}t| j t*r:| j j~jxr| j j }n6t| j ttfr| j j}t| trB|r@|s>| js.t| |jbd|j(||j2} t| |||||} | r2tu| |t}t*| j jX||} | }|j.s t||}t|||St| j t"r5|j||j(ttjSt| j t6tttfrE|jjj| j |j(|j.S| rt| j t*sJ| j jr!t||| j jS|j||j(ttjSt| j t\sJt| j |jd}| j jr t|}t|||Scc}w)aAnalyze access to an attribute on a class object. itype is the return type of the class object callable, original_type is the type of E in the expression E.var, original_vars are type variables of the class callable (for generic classes). rNT)rF)rrr)UrrrWrget_class_attribute_hookrrrrrmeta_fallback_to_anyapply_class_attr_hookr1r?rrxrr%r9rrVrrrRrNrXrr#rdrCANNOT_ASSIGN_TO_TYPEslotsCLASS_VAR_CONFLICTS_SLOTSrrr!CANNOT_ACCESS_FINAL_INSTANCE_ATTRr_rrrK#analyze_enum_class_attribute_accessr:rBrrrrrFrIsetr type_varsrr@r-GENERIC_CLASS_VAR_ACCESS!GENERIC_INSTANCE_VAR_CLASS_ACCESSrXr r idrrrrrrrrr4rHradd_class_tvarsr rbr"rr$rrrr,r^r)rr_rfrrtrrrr r is_decorated is_methodenum_class_attribute_typercsymnode super_infoisuperr prohibit_selfdef_varsprohibit_genericmessage erase_varsrirrr{rzs rZrrhs7 ::D--$(H 66== 1 1( ;D 88D>D    ):):)@)@!@$$--((..t44   4#<#<(T79;Q;Q3RS S 499c" %%    ! !$ 'FF499bjj1dii3L? 499h ?I ||B..  FF ( ( 4 dii * GG$:: ; zzddjj(  ::AA$GH }}DIIs3 8J8J  BBII$))..YZ ||BFF4464rvvrzz: ||R\\\Y$GtUW$X! $(T3LM M A a %iiGgs+ ++(D"&&88BLL'SUS]S]^  dii +*.))--*<*#? @JJF.ujAF dii %% %%)",,7K!% 5 55M499>>..889H!9!9 TYY^^556#-k8#DDU Hs3DQ3G/H$H99((.GGG.PPG *1b$))UTRA'62A   !:!:;  UZZ%9%9NN5::#7#78"1z&Bruu&BC Fd9dii8==FF )499&;<SASAS )$))S)) ((  A  dii +"iinn<<YTYYEYEYAYO  G->#? @"ii77O q, '#GGIq",,rzz4PA    '+   *2tItyy155u~A||.vr:F$Rv66 DIIs # dBJJ/y--..$))h 8_MNvv"";;DIIrzzSUS_S_``$))Y/// 99>>(T499>>B B  ! !$ 39//0 0$))%:;;;DIIr}}5H'IJ 99   %C$Rs33A'Csh c |rF|tt|j||j|j|j }|SrQ)r'rFrUrRrVrW)rfr r{s rZryry2sE   0 0162<<UWU[U[   Mr\c|tvrt|j|||S|jdr|j dddk7ry|j j |}|re|j rYt|j }t|tr4|j jdk(r|jr|jdSt||}|j|S)N__rr?rrr>)rrrU startswithreplacerrrFrxr5rrMr6rg)rr_rfrproperrUs rZr~r~>s '''(8(8%rJJ tc2!6"!< ::>>$ D   + vx ( $$(88 ;;q> !te4L     ==r\c  |dk(rt|jtr|jjj ||jj d\}}|j|z}|rM|jsA|jj||jnttj}t|jjd|gt t gddgt#|jjd|S|dk(rRt|jjdgt gdgt#|jjd|St%||j&||S) N __setitem__T)setitemrz builtins.strr)rrrrrr_ __delitem__)rxrVrrWrvisit_typeddict_index_exprindex readonly_keysrNrXreadonly_keys_mutatedr1r?implementation_artifactr2r^rr7rwr)r_rzrfrt item_type key_namesassigned_readonly_keyss rZrrWsT } bjj) ,$&66#6#6#Q#QRZZ%%t$R$ Iy&)%6%6%B "%b.@.@,,-CRZZ,X  A ABIvv((8)D(TlZVV&&':;     vv((89ifZVV&&':;    "$ b- HHr\c6t|tr||ng}|js t|}|r=|js1|rt ||j }nt||j d}| t||}t||jt|t|jzSt|tr?t|jDcgc] }ttt!|||||"c}S| t||}|Scc}w)aInstantiate type variables during analyze_class_attribute_access, e.g T and Q in the following: class A(Generic[T]): @classmethod def foo(cls: Type[Q]) -> Tuple[T, Q]: ... class B(A[str]): pass B.foo() Args: t: Declared type of the method (or property) isuper: Current instance mapped to the superclass where method was defined, this is usually done by map_instance_to_supertype() is_classmethod: True if this method is decorated with @classmethod original_vars: Type variables of the class callable on which the method was accessed is_trivial_self: if True, we can use fast path for bind_self(). Returns: Expanded method type with added type variables (when needed). Tr)r)r)rxr2rOris_boundrrIr)r r+rglistrr8rrr)rcrrrfrrtvarsrs rZrr~sT!\"!.!: ''/2A !**"1bll3adC  '62AQetAKK7H)HII Az " GG     #D&."Tab    #Av . H s%Dct|trt||j||St ||j j d}t|ttfr"|jrt||jSt||j|j|j||j}t!||j|jS)zAnalyzes the type behind method access. The function itself can possibly be decorated. See: https://github.com/python/mypy/issues/10409 r)rUr)rxrrrr,rWr^rrrrrIrrrVrXr))rrr_rfrzs rZrrs$ "45"55 bff//0CD EC$"345$:N:Nc2<<00 bllDMM2::tRVV TC S T]] SSr\F)rHct|tr<|jDcgc]}t||}}t t t|St|t sJ|js|S|jdttfvr|S|j|jdd|jdd|jdddScc}w)zReturn a copy of `method`, with the type of its first parameter (usually self or cls) bound to original_type. This is a faster version of mypy.typeops.bind_self() that can be used for methods with trivial self/cls annotations. rrNT)rrrr) rxr8rrrrr2rrrrrgr)rrUcrs rZrrs&*%;A<<Ha=1HHAz%()) fl ++ +     x33   ""12&""12&""12&  IsCct|}t|tr|j}t|tryt|t r#t fd|jDSt|tr5|jr%|jjjSt|trl|j}t|tr|j}t|t r#t fd|jDSt!|St#|jjS)aDoes type have operator with the given name? Note: this follows the rules for operator access, in particular: * __getattr__ is not considered * for class objects we only look in metaclass * instance level attributes (i.e. extra_attrs) are not considered Tc38K|]}t|ywrQ) has_operatorrhxr^ op_methods rZrjzhas_operator..sXa<9j9Xc38K|]}t|ywrQ)meta_has_operatorrs rZrjzhas_operator..sbq(IzBbr)rFrxrAvalues_or_boundr1rEallrr4rrrr!r@rrCrinstance_fallback)rzrr^rs `` rZrrs # C#'!!##w#y!X3CUCUCWXXX#|$):||  44Y??#x xx dK ('')D dI &bDL_L_Labb b y*== S* - 2 2 F Fy QQr\ct|tr|St|tr t|St|tt fr |j S|dS)Nr)rxr5r<r0r6r>r)rzr^s rZrrsK#x  #y!c""# ]34|| ' ((r\ct|}t|tryt||}|jj xs|d}|jj |S)NTr)rFrxr1rrrr!)rrr^metas rZrrsS 4 D$  T: .D 99 # # Bz/'BD 99 ( ( 33r\)"r_rnrzr=rVrrRrhrSrhrTrhrUr=rWr rtTypeInfo | NonerurhrIrirJrjrKrhrLrhrMrkrNrhrlr=rQ) r_rnrzr=rfrHrtrrlr=) r_rnrzr=rfrHrtrrlrh) rUr=rzr=r_rnrfrHrtrrlr=) r_rnrzr5rfrHrtrrlr=)rrrfrHrlrm)r_rnrzr4rfrHrlr=) r_rnrzr@rfrHrtrrlr=)r_rnrzrErfrHrlr=)r_rnrzr7rfrHrlr=) r_rnrr5rr#rfrHrlr=) r_rnrr#rXrrrrlrm)r)r=rfrHrlr=)r)r5rfrHrlr=)rr%rlrh)r_rnrr%rr5rfrHrrhrrhrlr=) rzr=rr%rr5rOr5rfrHrlr=)r[r4rr%rr5r_rnrfrHrrhrlr=)F) rcr=rfrHrr%rr5rrhrlr=)r[r4rqr=rrhrVrr_rnrXrrlr4)rr5r_rnrfrHrr5rtrr Sequence[TypeVarLikeType] | Nonerlri)rfrHr z)Callable[[AttributeContext], Type] | Noner{r=rlri)rr5r_rnrfrHrlri) r_rnrzr>rfrHrtrrlr=)NF)rcr;rzInstance | NonerrhrfrHrrrrhrlr=) rzDecorator | FuncBaserr5r_rnrfrHrlr=)rrrUrirlr)rzr=rrnr^Callable[[str], Instance]rlrh)rzr;r^rrlr5)rr=rrnr^rrlrh)trr __future__rcollections.abcrtypingrrrmypyrr mypy.checker_sharedr mypy.erasetyper mypy.expandtyper r r mypy.maptyper mypy.meetr mypy.messagesr mypy.nodesrrrrrrrrrrrrrrr r!r"r#r$r%r& mypy.pluginr' mypy.subtypesr( mypy.typeopsr)r*r+r,r-r.r/r0 mypy.typesr1r2r3r4r5r6r7r8r9r:r;r<r=r>r?r@rArBrCrDrErFrHr}rwrrrrrrrrrrr r"r;rrErIrXrrryr~rrrrrrrrrsr\rZrs'"$**(4) 3*(.)$   4PPz&*$!.2 $!#I I II  I  III I#III,III !I"#I$ %IZOS'E 'E'E+'E D>D>"/D>@OD> D>N C!6H5I 5I5I"/5I@O5I 5Ip* RA AA&.A4AA AHFj-ZB1J $!^ ^ ^ ^  ^  ^^ ^B  (:BHU ,!,! ,! ,!  ,!  ,!  ,! ,!`MR) ))%()19)EI) )XL!L!L!L! L!  L!  L!L!j&*6:G4 G4 G4 G4  G4 # G44G4G4T  F PT  > >>$1>>2$I $I!$I'4$IET$I $IX7;! C C C C   C 4 C  C  C LT T'/T7:T@MT T" C|$2 RF)4r\