Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
self._nodes_by_line = defaultdict(list)
self.tree = None
self._qualnames = {}
try:
self.tree = ast.parse(ast_text, filename=filename)
except SyntaxError:
pass
else:
for node in ast.walk(self.tree):
for child in ast.iter_child_nodes(node):
child.parent = node
if hasattr(node, 'lineno'):
self._nodes_by_line[node.lineno].append(node)
visitor = QualnameVisitor()
visitor.visit(self.tree)
self._qualnames = visitor.qualnames
def __init__(self):
super(QualnameVisitor, self).__init__()
self.stack = []
self.qualnames = {}