bg[YUdZddlmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl m Z ddl mZmZddlmZmZddlmZmZddlmZmZdd lmZdd lmZejeZee j e j!e j"e j#e j$e j%fZ&e'ej(Z)e*eZ+e,dZ-e,e.Z/e,d Z0dIdZ1dJdZ2efdIdZ3dIdZ4dKdZ5dLdMdZ6 dNdOdZ7 dPdQd(Z8dRd-Z9dLdSd0Z:dTd6Z;dUd9ZdVd<Z? dXdYd=Z@dZd@ZAd[dBZBGdCdDZCiZDdEeEdF<d\dGZFdJdHZGeGdS)]zthis module contains a set of functions to create astroid trees from scratch (build_* functions) or from living object (object_build_* functions) ) annotationsN)Iterable)redirect_stderrredirect_stdout)AnyUnion)basesnodes)_EMPTY_OBJECT_MARKERIS_PYPY)AstroidManager) node_classes.namestrreturnNonec>||_||dSN)radd_local_node)parentnoders e/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/astroid/raw_building.py_attach_local_noder0s#DI $c|j}t|dd}|sdSd|jD}t|||j}|g|jd<dS)zFAdd a __class__ member to the given func node, if we can determine it.__name__Ncg|] }|j Sr).0ancestors r z%_add_dunder_class..;sHHHx"HHHr __class__)r#getattr __bases__ build_class__doc__instance_attrs)funcmember python_clscls_name cls_bases ast_klasss r_add_dunder_classr/5sg!Jz:t44H HH:3GHHHIHi1CDDI(1{D $$$rc\tj}||_t|||dS)zdcreate a dummy node and register it in the locals of the given node with the specified name N)r EmptyNodeobjectr)rrruntime_objectenodes rattach_dummy_noder5@s0 O  E!ELtUD)))))rcb||jvr%t|tj||dSdS)zdcreate a Const node and register it in the locals of the given node with the specified name N)special_attributesrr const_factory)rrvalues rattach_const_noder:Is= 4***4!4U!;!;TBBBBB+*rmodname membernamecXtj||dfg}t|||dS)zicreate a ImportFrom node and register it in the locals of the given node with the specified name N)r ImportFromr)rr;r< from_nodes rattach_import_noder@Qs6 J+=*>??ItY 33333rdoc str | None nodes.Modulectj|dd}|g|rtj|nd|S)z,create and initialize an astroid Module nodeF) pure_pythonpackager9N)bodydoc_node)r ModulepostinitConst)rrArs r build_modulerMYsW <% ? ? ?DMM +.83''''D Krr basenames Iterable[str]nodes.ClassDefctj|fd|Dgd|rtj|ndS)z/Create and initialize an astroid ClassDef node.c<g|]}tj|S)rr)r Name)r basers rr"zbuild_class..is(HHHduztD111HHHrNrGr rH decoratorsrI)r ClassDefrKrL)rrNrArs @rr&r&csm >$  DMMHHHHiHHH +.83''''D  Krargslist[str] | None posonlyargsdefaultslist[Any] | None kwonlyargskwonlydefaultsnodes.FunctionDefc ^tj|}tj||fd|D}nd}g} |6|D]2} tj| } | _| | 3nd} g} |6|D]2} tj| }|_| |3nd} || fd|pdD| gfd|pdD|g|rtj|nd |rt||S) z1create and initialize an astroid FunctionDef node)rNc<g|]}tj|SrSr AssignNamer argargsnodes rr"z"build_function..s)QQQSU%3x@@@QQQrc<g|]}tj|SrSrcres rr"z"build_function..s6   .s6   !+ ; ;M!&!4]!C!C (0  %  & &'9 : : : : ; #      CMCSQS   (    CNCTRT       MM  +.83''''D  !4   Krfromnamenames list[str]nodes.ImportFromc@tj|d|DS)z.s&F&F&Fd|&F&F&Fr)r r>)rwrxs rbuild_from_importr}s$  H&F&F&F&F&F G GGrr) list | Nonec|r|jjr%||jj|j|jjr%||jj|j|jj}|dS|D]M}t |t jr||j|8t||j NdS)z{add given arguments to local args is a list that may contains nested lists (i.e. def func(a, (b, c, d)): ...) N) rYvararg set_localkwarg isinstancer rdrrnelts)r)rYrfs rrnrns | 9  8 NN49+TY 7 7 7 9? 7 NN49?DI 6 6 6y~ < F// c5+ , , / NN38S ) ) ) ) tSX . . . . //rrnodes.Module | nodes.ClassDefr*type localnamecJd|jD}t||||S)z(create astroid for a living class objectcg|] }|j Srr)r rUs rr"z&object_build_class..s<<<4<<rtA|||atj!|rt||||jtE|dr8tG|}tI||||||t|||dS)z}recursive method which create a partial ast from real objects (only function, class, and method are handled) N__class_getitem__ignorerr#__all__)%rdirr warningscatch_warnings simplefilterr$rr5rismethod__func__ isfunctionrr isbuiltinimported_memberrisclassrr rXlocalsgetrrrrismethoddescriptorisdatadescriptorr _CONSTANTSr: isroutinerrMr)rrrrpypy__class_getitem__r* class_noders rrzInspectBuilder.object_builds $*  4 3HH3 63 6D%,$K8K0K ! ,..00)(333$S$//F000000000000000"   !$--- '' )0E )!&))% 6$T4FFFF"6**# 6.C# 6''fd;;-dFDAAAA(( 6''fd;;TZ''!%F!3J%j%.AAAAA!r)B)BBB++J===!3D&$!G!GJ%%j&999;&&:+<+D(, 4<(@J%+F33 6-dFDAAAA)&11 6+D&$????FJ// 6!$f5555"6** 6%T4FFFF$VY77 6%d++"4666!!&&1111"$f5555ts5B %A:. B:A> >BA> BB#"B#rrrc t|dd}n#t$rd}YnwxYw|$|dvr tj}nt |||dS|dkr|jjdksdSdd i||}||jjkrS ttj 5}ttj 5}ttj ||| }|r-td |tj ||| } | r-td |tj || dddn #1swxYwYdddn #1swxYwYt#|||n(#t$t&f$rt |||YnwxYwdSdS) z1verify this is not an imported class or handle it __module__N>__new____subclasshook__T_iobuiltinsFgtkgtk_gtkz,Captured stderr while getting %s from %s: %sz,Captured stdout while getting %s from %s: %s)r$rrrr5rrrioStringIOrsysmodulesgetvalueloggererrorinfor@KeyErrorr) rrr*rr; real_namestderrstdout stderr_value stdout_values rrzInspectBuilder.imported_members  flD99GG   GGG  ?666#+!$f555t e  DL$9Z$G$G5I&**7G<<  - - - 8$R[]]33vKMM@@CK0$777#)??#4#4L# K K0(  $*??#4#4L# K K0( .#4$7777n- 6 6 6!$f55555 64usg ## F6.!FB'F6 FF F F F F6FF6 F!F66"GGr)rrrrNN)rrr;rBrrBrrC)rrrrrr)rrrr)rr __qualname__r'rrrrrrrrrms '''''# <====~888888rrzdict[type, nodes.ClassDef] _CONST_PROXYc0t|jjSr)rr9r#)consts r _set_proxiedrs  - ..rc  t}|t}tjD]\}}|t urtd}||_n||turtd}||_n\|turtd}||_n<| |j d}t|tjsJ|t t"t$t&fvr||_|t*|<t-t.tj_tjt2jj }||_t2jjr$tjt2jjnd}|ggd||t:j_|t:jjt2jtAt2drtjt2j!j }||_t2j!jr$tjt2j!jnd}|ggd||t:j"_|t:j"jt2j!tAt2d rtjt2j#j } || _t2j#jr$tjt2j#jnd} | ggd| | t:j#_|t:j#jt2j#t2j$t2jt2j%t tt2j&t2j't2j(t2j)t2j*f } | D]} | j |vrztj| j } || _| ggd| jrtj| jnd|| | | || j <dS) z)astroid bootstrapping the builtins moduleNoneTypeNotImplementedTypeEllipsisrrGNrVAsyncGeneratorType UnionType)+rrrr CONST_CLSr TYPE_NONEr&rTYPE_NOTIMPLEMENTED TYPE_ELLIPSISr$rrr rXdictlistsettuple_proxiedrpropertyrrLtypes GeneratorTyper'rKr Generatorrrr AsyncGeneratorr GetSetDescriptorTypeMemberDescriptorType FunctionType MethodTypeBuiltinFunctionType ModuleType TracebackType)builderastroid_builtinclsnode_clsproxy_GeneratorTypegenerator_doc_node_AsyncGeneratorTypeasync_generator_doc_node_UnionTypeTypeunion_type_doc_node builtin_types_typers r_astroid_bootstrappingr/sG++H55O%/5577&& X )   ++E*ELL ' ' ' 455E*ELL M ! ! ++E*ELL#++CL99! ? ? ? ? ! $$- %   )<%U1:E 0 0N5>22E*EL NN=B]T5=9999PT       . . ..3OEN + 4 4r)rrrr)rr)r;rr<rrrr)rrrArBrrC)rN)rrrNrOrArBrrP)NNNNNN)rrrYrZr[rZr\r]rArBr^rZr_r]rr`)rwrrxryrrz)r)r`rYr~rr)rrr*rrrrrP)r*rrr)rrr*rrrrr)rrr*rrrrrPr) rrr*rrNryrrBrrBrrP) rrrrr*rrrrr)r*rrr)rrP)Hr' __future__rrrrloggingrrrrcollections.abcr contextlibrrtypingrrastroidr r astroid.constr r astroid.managerr astroid.nodesr getLoggerrrrrrWrapperDescriptorTypeMethodDescriptorTypeClassMethodDescriptorTyperrr rvars _BUILTINSrrNotImplementedrrrr/r5r:r@rMr&rvr}rnrrrrrrrrrr__annotations__rr/rrrrAs #"""""  $$$$$$77777777 77777777******&&&&&&  8 $ $      # %U<) * * DNN DJJ d>**S     33337K*****CCCC4444AE      "$(!%#''+;;;;;|HHHH /////.RRRRCCCCD))))2<<<< $ $ $ $$ %%%%%P2222.aaaaaaaaL,. ----//// e4e4e4e4Pr