MCPcopy Index your code
hub / github.com/SourceCode-AI/aura / enrich_from_previous

Method enrich_from_previous

aura/analyzers/python/nodes.py:155–182  ·  view source on GitHub ↗

Enrich the current node using the information from the previous node This is used when AST tree is rewritten/replace with a new node so we copy all the information from the previous one :param node: previous node that was replaced that we want to copy information from

(self, node: typing.Union[dict, ASTNode])

Source from the content-addressed store, hash-verified

153 self._taint_log: typing.List[TaintLog] = []
154
155 def enrich_from_previous(self, node: typing.Union[dict, ASTNode]):
156 """
157 Enrich the current node using the information from the previous node
158 This is used when AST tree is rewritten/replace with a new node so we copy all the information from the previous one
159
160 :param node: previous node that was replaced that we want to copy information from
161 :type node: typing.Union[dict, ASTNode]
162 """
163 if type(node) == dict:
164 if not self.line_no and "lineno" in node:
165 self.line_no = node["lineno"]
166 if not self.col and "col_offset" in node:
167 self.col = node["col_offset"]
168 if not self.end_line_no and "end_lineno" in node:
169 self.end_line_no = node["end_lineno"]
170 if not self.end_col and "end_col_offset" in node:
171 self.end_col = node["end_col_offset"]
172 if not self._docs:
173 self._docs = node.get("_doc_string")
174 elif isinstance(node, ASTNode):
175 if not self.line_no:
176 self.line_no = node.line_no
177 if not self.end_line_no:
178 self.end_line_no = node.end_line_no
179 if not self.col:
180 self.col = node.col
181 if not self.end_col:
182 self.end_col = node.end_col
183
184 @property
185 def full_name(self):

Callers 15

__post_init__Method · 0.95
binopMethod · 0.80
string_sliceMethod · 0.80
inline_decodeMethod · 0.80
rewrite_function_callMethod · 0.80
replace_stringMethod · 0.80
unary_opMethod · 0.80
visit_StrFunction · 0.80
visit_NumFunction · 0.80
visit_ConstantFunction · 0.80
visit_DictFunction · 0.80
visit_CallFunction · 0.80

Calls 1

getMethod · 0.80

Tested by

no test coverage detected