MCPcopy Create free account
hub / github.com/scottrogowski/code2flow / process_assign

Function process_assign

code2flow/python.py:60–82  ·  view source on GitHub ↗

Given an element from the ast which is an assignment statement, return a Variable that points_to the type of object being assigned. For now, the points_to is a string but that is resolved later. :param element ast: :rtype: Variable

(element)

Source from the content-addressed store, hash-verified

58
59
60def process_assign(element):
61 """
62 Given an element from the ast which is an assignment statement, return a
63 Variable that points_to the type of object being assigned. For now, the
64 points_to is a string but that is resolved later.
65
66 :param element ast:
67 :rtype: Variable
68 """
69
70 if type(element.value) != ast.Call:
71 return []
72 call = get_call_from_func_element(element.value.func)
73 if not call:
74 return []
75
76 ret = []
77 for target in element.targets:
78 if type(target) != ast.Name:
79 continue
80 token = target.id
81 ret.append(Variable(token, call, element.lineno))
82 return ret
83
84
85def process_import(element):

Callers 1

make_local_variablesFunction · 0.70

Calls 2

VariableClass · 0.85

Tested by

no test coverage detected