bgdZddlmZddlZddlZddlmZddlmZm Z ddl m Z ddl m Z ddlmZerdd l mZejd krdd lmZndd lmZGd deZGddeZGddeZGddeZGddeZGddeeeZGddeZGddeZdS)zThis module contains some base nodes that can be inherited for the different nodes. Previously these were called Mixin nodes. ) annotationsN)Iterator) TYPE_CHECKINGClassVar) decorators)AttributeInferenceError)NodeNG)nodes))cached_property)cachedpropertyc$eZdZdZdZ dZdZdS) StatementzpStatement node adding a few attributes. NOTE: This class is part of the public API of 'astroid.nodes'. Tc|j|}||} ||dzS#t$rYdSwxYw)z|The next sibling statement node. :returns: The next sibling statement node. :rtype: NodeNG or None N)parentchild_sequenceindex IndexErrorselfstmtsrs j/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/astroid/nodes/_base_nodes.py next_siblingzStatement.next_sibling's`  **400 D!! # #   44 s < A  A c|j|}||}|dkr ||dz SdS)zThe previous sibling statement. :returns: The previous sibling statement node. :rtype: NodeNG or None rN)rrrrs rprevious_siblingzStatement.previous_sibling4sG  **400 D!! A::# #tN)__name__ __module__ __qualname____doc__ is_statementrrrrrrsF L2        rrceZdZdZddZdS)NoChildrenNodez1Base nodes for nodes with no children, e.g. Pass.returnIterator[NodeNG]c#KdEd{VdS)Nr$r$rs r get_childrenzNoChildrenNode.get_childrenDs rN)r'r()rr r!r"r+r$rrr&r&As.;;rr&c eZdZdZddZdZdS)FilterStmtsBaseNodez6Base node for statement filtering and assignment type.mystmtStatement | NonecD|d|ur|gdfS|dfS)zAMethod used in _filter_stmts to get statements and trigger break.TfutureF statement)r_node_stmtsr.s r_get_filtered_stmtsz'FilterStmtsBaseNode._get_filtered_stmtsKs3 >>> & && 0 064< u}rc|SNr$r*s r assign_typezFilterStmtsBaseNode.assign_typeS rNr.r/)rr r!r"r8r;r$rrr-r-Hs=@@rr-c eZdZdZdZddZdS)AssignTypeNodez8Base node for nodes that can 'assign' such as AnnAssign.c|Sr:r$r*s rr;zAssignTypeNode.assign_typeZr<rr.r/cT||ur|dfS|d|ur|gdfS|dfS)zMethod used in filter_stmts.Tr1Fr3)r lookup_noder6r7r.s rr8z"AssignTypeNode._get_filtered_stmts]sF 6>>4<  >>> & && 0 064< u}rNr=)rr r!r"r;r8r$rrr?r?Ws=BBrr?ceZdZdZdZdS)ParentAssignNodezGBase node for nodes whose assign_type is determined by the parent node.c4|jSr:)rr;r*s rr;zParentAssignNode.assign_typeks{&&(((rN)rr r!r"r;r$rrrDrDhs)QQ)))))rrDcDeZdZUdZded< ded< dZddd Zdd ZdS) ImportNodez$Base node for From and Import Nodes. str | Nonemodnamezlist[tuple[str, str | None]]namesc|Sr:r$)rframenames r _infer_namezImportNode._infer_namer<rNr' nodes.Modulec|}t|dd}||j}||||jkrd}nd}|||t |o|dk|S)zGReturn the ast for a module whose name is imported by .levelNFTr)rQ relative_only use_cache)rootgetattrrIrelative_to_absolute_namerM import_modulebool)rrImymodulerQrSs rdo_import_modulezImportNode.do_import_modules99;;#D'488 ?lG  - -gu = = N NIII%% u3!44 &   rasnamestrc|jD]9\}}|dkr|cS|s|ddd}|}||kr|cS:td||)zGet name from 'as' name.*.rrz:Could not find original name for {attribute} in {target!r})target attribute)rJsplitr)rr[rM_asnames r real_namezImportNode.real_names!Z  MD's{{  zz#q))!,   !% H    rr:)rIrHr'rO)r[r\r'r\)rr r!r"__annotations__rNrZrdr$rrrGrGos|.. ('''      .      rrGcdeZdZUdZdZded<edZdZdZ e j dZ d S) MultiLineBlockNodea(Base node for multi-line blocks, e.g. For and FunctionDef. Note that this does not apply to every node with a `body` field. For instance, an If node has a multi-line body, but the body of an IfExpr is not multi-line, and hence cannot contain Return nodes, Assign nodes, etc. r$zClassVar[tuple[str, ...]]_multi_line_block_fieldscDtfdjDS)Nc38K|]}t|VdSr:)rU).0fieldrs r z8MultiLineBlockNode._multi_line_blocks..s-UUeWT5))UUUUUUr)tuplerhr*s`r_multi_line_blocksz%MultiLineBlockNode._multi_line_blockss)UUUUt7TUUUUUUrc#lK|jD])}|D]$}|jr |Ed{V%*dSr:)ro is_function _get_return_nodes_skip_functionsrblock child_nodes rrrz3MultiLineBlockNode._get_return_nodes_skip_functionssr, I IE# I I )%FFHHHHHHHHHH I I Irc#lK|jD])}|D]$}|jr |Ed{V%*dSr:)ro is_lambda_get_yield_nodes_skip_lambdasrss rrxz0MultiLineBlockNode._get_yield_nodes_skip_lambdassr, F FE# F F '%CCEEEEEEEEEE F F Frc|d|jD}ttj|S)Nc3HK|]}|D]}|VdSr:)_get_assign_nodes)rkrtrus rrmz7MultiLineBlockNode._get_assign_nodes..sY! ! #! !   ( ( * *! ! ! ! ! ! ! r)rolist itertoolschain from_iterable)rchildren_assign_nodess rr{z$MultiLineBlockNode._get_assign_nodessE! ! 0! ! !  IO112GHHIIIrN) rr r!r"rhrer rorrrxrcachedr{r$rrrgrgs;=<<<<VV_VIIIFFFJJJJJrrgc0eZdZdZedZddZdS)MultiLineWithElseBlockNodez>Base node for multi-line blocks that can have else statements.c|jSr:)linenor*s rblockstart_tolinenoz.MultiLineWithElseBlockNode.blockstart_tolinenos {rNc||jkr||fS|r2||djkr||djfS||djdz fS||p|jfS)z_Handle block line numbers range for try/finally, for, if and while statements. rr) fromlinenotolineno)rrorelselasts r_elsed_block_rangez-MultiLineWithElseBlockNode._elsed_block_rangesp T_ $ $6> !  4---vbz2226!9/!33 3t,t},,rr:)rr r!r"r rrr$rrrrsGHH_ - - - - - -rr)r" __future__rr}syscollections.abcrtypingrrastroidrastroid.exceptionsrastroid.nodes.node_ngr r version_info functoolsr astroid.decoratorsrrr&r-r?rDrGrgrr$rrrsR  #""""" $$$$$$********666666((((((v)))))))DDDDDD        FV     &   V")))))~)))8 8 8 8 8 $ni8 8 8 v$J$J$J$J$J$J$J$JN-----!3-----r