e.HelloWorld HelloWorld d d
finder = NameFinder()
finder.visit(ast.parse(code))
example_code_obj = {}
for name, full_name in finder.get_mapping():
// name is as written in file (e.g. np.asarray)
After Change
e.HelloWorld HelloWorld d d
finder = NameFinder()
try:
finder.visit(ast.parse(code))
except SyntaxError:
return {}
example_code_obj = {}
for name, full_name in finder.get_mapping():
// name is as written in file (e.g. np.asarray)
// full_name includes resolved import path (e.g. numpy.asarray)