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

Function _resolve_str_variable

code2flow/model.py:64–83  ·  view source on GitHub ↗

String variables are when variable.points_to is a string This happens ONLY when we have imports that we delayed processing for This function looks through all files to see if any particular node matches the variable.points_to string :param Variable variable: :param list[Gr

(variable, file_groups)

Source from the content-addressed store, hash-verified

62
63
64def _resolve_str_variable(variable, file_groups):
65 """
66 String variables are when variable.points_to is a string
67 This happens ONLY when we have imports that we delayed processing for
68
69 This function looks through all files to see if any particular node matches
70 the variable.points_to string
71
72 :param Variable variable:
73 :param list[Group] file_groups:
74 :rtype: Node|Group|str
75 """
76 for file_group in file_groups:
77 for node in file_group.all_nodes():
78 if any(ot == variable.points_to for ot in node.import_tokens):
79 return node
80 for group in file_group.all_groups():
81 if any(ot == variable.points_to for ot in group.import_tokens):
82 return group
83 return OWNER_CONST.UNKNOWN_MODULE
84
85
86class BaseLanguage(abc.ABC):

Callers 1

resolve_variablesMethod · 0.85

Calls 2

all_nodesMethod · 0.80
all_groupsMethod · 0.80

Tested by

no test coverage detected