bg1dZddlmZddlZddlmZddlmZmZddl m Z m Z m Z ddl mZddlmZmZmZmZdd lmZdd lmZmZe jd Zejd kr dd lmZddlmZn ddlmZddl m!ZedZ"Gddej#Z$Gddej%Z&Gdde j'Z(Gdde j'Z)Gdde j*Z+Gdde j*Z,Gdde j*Z-Gdd ej.Z/ej%e)fej0_1Gd!d"ej.Z2dS)#a" Inference objects are a way to represent composite AST nodes, which are used only as inference results, so they can't be found in the original AST tree. For instance, inferring the following frozenset use, leads to an inferred FrozenSet: Call(func=Name('frozenset'), args=Tuple(...)) ) annotationsN) Generator)AnyTypeVar)bases decoratorsutil)InferenceContext)AttributeInferenceErrorInferenceErrorMroError SuperError)AstroidManager) node_classes scoped_nodeszinterpreter.objectmodel))cached_property)Literal)cachedproperty_Tc:eZdZdZd dZd dd Zed ZdS) FrozenSetz.Class representing a FrozenSet composite node.returnLiteral['builtins.frozenset']cdS)Nzbuiltins.frozensetselfs `/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/astroid/objects.pypytypezFrozenSet.pytype/s##NcontextInferenceContext | Nonekwargsrc+K|VdSNrrr#r%s r _inferzFrozenSet._infer2 r"c^tj}|ddS)N frozensetrrbuiltins_modulegetattrr ast_builtinss r _proxiedzFrozenSet._proxied5s)%''7 ##K0033r")rrr'r#r$r%r)__name__ __module__ __qualname____doc__r!r)rr2rr"r rr,sb88$$$$44_444r"rceZdZdZejdZfdZddd Zd Z e d Z ddZ ddZ edZddZ dddZdddZxZS)SuperaProxy class over a super call. This class offers almost the same behaviour as Python's super, which is MRO lookups for retrieving attributes from the parents. The *mro_pointer* is the place in the MRO from where we should start looking, not counting it. *mro_type* is the object which provides the MRO, it can be both a type or an instance. *self_class* is the class where the super call is, while *scope* is the function where the super call is. c4tSr') objectmodel SuperModelrr"r zSuper.Isk6L6L6N6Nr"c||_||_d|_||_||_t dS)NF)type mro_pointer _class_based _self_class_scopesuper__init__)rr@mro_type self_classscope __class__s r rEzSuper.__init__KsE &!%  r"Nr#r$r%rc+K|VdSr'rr(s r r)z Super._inferSr*r"c2t|jtjst d|t|jtjrd|_|j}nMt|jdd}t|tj tjfst d||j st d|| }|j|vrt d|| |j}||dzdS) zBGet the MRO which will be used to lookup attributes in this super.zIThe first argument to super must be a subtype of type, not {mro_pointer}.)super_Tr2NzPThe second argument to super must be an instance or subtype of type, not {type}.z*Unable to call super on old-style classes.) isinstancer@rClassDefrr?rAr/rInstancenewstylemroindex)rrFrRrSs r super_mrozSuper.super_mroVs7$*L,ABB +  di!6 7 7  $D yHHty*d;;Hh9N(OPP  ?   XIRVWWW Wllnn  3 & &;   $*++519;;r"c^tj}|ddS)NrDrr-r0s r r2zSuper._proxiedzs)%''7 ##G,,Q//r"rLiteral['builtins.super']cdS)Nzbuiltins.superrrs r r!z Super.pytypesr"strcdS)NzSuper ofrrs r display_typezSuper.display_typeszr"c|jjS)z Get the name of the MRO pointer.)r@namers r r\z Super.names$$r"Literal['super']cdS)NrDrrs r qnamez Super.qnameswr"r\c #K|dkr|j|VdS |}nY#t$r}t d||||j|d}~wt $r%}t d||||j|j|d}~wwxYwd}|D]m}||j vr d}tj ||g|| D]>}t|tjs|V"|jd krtj||VE|jjd kr|jd kr|Ve|js |jd kr|V|t|t&rD|j} ||| Ed{V#t,$rt.jVYwxYwtj|r> |||Ed{V#t,$rt.jVY#wxYwtj||V@o|s'||jvr|j|VdS|st |||dS)z9Retrieve the inferred values of the given attribute name.rINzHLookup for {name} on {target!r} because super call {super!r} is invalid.)target attributer#rLzJLookup for {name} on {target!r} failed because {cls!r} has an invalid MRO.)rarbr#mrosclsFT)frame classmethodmethod staticmethodcallerr#)rarbr#)special_attributeslookuprTrr rLr rcrdlocalsr _infer_stmtsrNr FunctionDefr? BoundMethodrCrAPropertyfunctioninfer_call_resultr r Uninferable _is_property) rr\r#rRexcfoundrdinferredrrs r igetattrzSuper.igetattrsb ;  )0066 6 6 6 F ..""CC   )"z       )#XG     ! ;! ;C3:%%E!.D {G4PPP ; ;!(L,DEE"NNN=M11+Hc::::::[%668=H;T;T"NNNN&;(->*I*I"NNNN(33;'0H/#+#=#=#'$>$$*///"....../'11;/#+#=#=dG#L#LLLLLLLLL)///"....../ +Hc::::::9 ;@ !888)0066 6 6 6 F X)wWWW W X XsE= BA!! B. BB E>>FF1GG+*G+cJt|||S)N)r#)listry)rr\r#s r r/z Super.getattrs DMM$M88999r"r'r3)rrVrrX)rr])r\rXr#r$r#r$)r4r5r6r7r lazy_descriptorrkrEr)rTrr2r!rZpropertyr\r_ryr/ __classcell__rIs@r r9r9;s9  .-.N.NOO" " " H00_0    %%X%=APXPXPXPXPXd:::::::::r"r9c(eZdZdZedZdS)ExceptionInstancezClass for instances of exceptions. It has special treatment for some of the exceptions's attributes, which are transformed at runtime into certain concrete objects, such as the case of .args. c|}tj|tj}||Sr')r_r;BUILTIN_EXCEPTIONSgetExceptionInstanceModel)rr_instances r rkz$ExceptionInstance.special_attributessG 155 ;5  xxzz$r"N)r4r5r6r7rrkrr"r rrs9  _   r"rc4eZdZdZejdZdS) DictInstancezSpecial kind of instances for dictionaries. This instance knows the underlying object model of the dictionaries, which means that methods such as .values or .items can be properly inferred. c4tSr')r; DictModelrr"r r=zDictInstance.sk6K6K6M6Mr"N)r4r5r6r7r r~rkrr"r rrs3.-.M.MNNr"rc>eZdZejjZejjZdS) DictItemsNr4r5r6rNodeNG__str____repr__rr"r rr$!)G"+HHHr"rc>eZdZejjZejjZdS)DictKeysNrrr"r rrrr"rc>eZdZejjZejjZdS) DictValuesNrrr"r rr rr"rcjeZdZdZejd d fd Zd dfd Zdd ZxZ S)PartialFunctionzEA class representing partial function obtained via functools.partial.'Use the postinit arg 'doc_node' insteaddocNct|||d||_||_|jdd|_|j|_|jd}t| }t|tr)|j|jz|_i|j|j|_t|j|_ dS)Nlineno col_offsetparentrMr)rDrE_docrpositional_arguments filled_argskeyword_argumentsfilled_keywordsnextinferrNrlenfilled_positionals) rcallr\rrrrwrapped_functioninferred_wrapped_functionrIs r rEzPartialFunction.__init__s fDQQQ  4QRR8#54Q7$()9)?)?)A)A$B$B! / A A 8DtGWWD $+;$&$D #&d&6"7"7r"r#r$cF|r|d|jjD}|jD]*\}}||vr!|jj||f+|jjpg}|j|z|j_t||S)Nch|]\}}|Srr).0keyword_s r z4PartialFunction.infer_call_result../s)'''(Wa'''r"ri) callcontextkeywordsritemsappendargsrrDrs)rrjr#current_passed_keywordsrvaluecall_context_argsrIs r rsz!PartialFunction.infer_call_result-s  L'',3,?,H''' ##'"6"<"<">"> J J"999'077%8HIII ' 3 8 >B '+'7:K'KG  $ww(((HHHr"rrXc|jjSr')rIr4rs r r_zPartialFunction.qname;s ~&&r"NNNNNNNr}r|) r4r5r6r7rdeprecate_argumentsrErsr_rrs@r rrsOO#Z#(QRRRNR88888SR80 I I I I I I I''''''''r"rceZdZdZejd dfd ZejdZ dZ dd Z ddd Z dddZ xZS)rqz%Class representing a Python property.rrNcn||_t||||||_dS)Nr)rrrDrEr)rrrr\rrrrrIs r rEzProperty.__init__Gs8!  fFSSS r"c4tSr')r; PropertyModelrr"r r=zProperty.Qsk6O6O6Q6Qr"rrLiteral['builtins.property']cdS)Nzbuiltins.propertyrrs r r!zProperty.pytypeTs""r"r#r$c td)NzProperties are not callable)r )rrjr#s r rszProperty.infer_call_resultWs:;;;r"rrr%rGenerator[_T, None, None]c+K|VdSr'rr(s r r)zProperty._inferZs r"r)rrrr}r')rrr#r$r%rrr)r4r5r6r7rrrEr r~rkr?r!rsr)rrs@r rqrqDs//#Z#(QRRRRVSR.-.Q.QRR D####<<<<<6:r"rq)3r7 __future__rsyscollections.abcrtypingrrastroidrrr astroid.contextr astroid.exceptionsr r r rastroid.managerr astroid.nodesrr lazy_importr; version_info functoolsrrtyping_extensionsastroid.decoratorsrr BaseContainerrrr9rPrrProxyrrrrorDict __bases__rqrr"r rs( #""""" %%%%%%++++++++++,,,,,, +*****44444444d899 v))))))))))))DDDDDD WT]] 4 4 4 4 4 * 4 4 4e:e:e:e:e:L e:e:e:P        "OOOOO5>OOO,,,,, ,,, ,,,,,u{,,, ,,,,,,,, +'+'+'+'+'l.+'+'+'` ,2LA |'r"