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

Function extract_identifier

ngrams.py:92–105  ·  view source on GitHub ↗

Recursively traverse the RAW AST JSON tree and convert them into ASTNodeIdentifier tree :param node: :return:

(node)

Source from the content-addressed store, hash-verified

90
91
92def extract_identifier(node):
93 """
94 Recursively traverse the RAW AST JSON tree and convert them into ASTNodeIdentifier tree
95
96 :param node:
97 :return:
98 """
99 # We want to only process raw ast node which must be dict types and have a `_type` key
100 if isinstance(node, dict):
101 t = node.get('_type')
102 if t in AST_NODE_TYPES: # Process the AST node via a specific node converter
103 return AST_NODE_TYPES[t](node)
104 elif t is not None: # Unknown/unsupported node, output it as misc without further recursion
105 return ASTNodeIdentifier(label=t, node_type='misc')
106
107
108#---[ Functions to convert raw ast dict nodes into ASTNodeIdentifier based on their type ]---

Callers 11

extractFunction · 0.85
node_function_defFunction · 0.85
node_callFunction · 0.85
node_moduleFunction · 0.85
node_exprFunction · 0.85
node_class_defFunction · 0.85
node_attributeFunction · 0.85
node_assignFunction · 0.85
node_printFunction · 0.85
node_ifFunction · 0.85
node_compareFunction · 0.85

Calls 2

ASTNodeIdentifierClass · 0.85
getMethod · 0.80

Tested by

no test coverage detected