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

Function _find_target_node

code2flow/engine.py:99–117  ·  view source on GitHub ↗

Find the node referenced by subset_params.target_function :param subset_params SubsetParams: :param all_nodes list[Node]: :rtype: Node

(subset_params, all_nodes)

Source from the content-addressed store, hash-verified

97
98
99def _find_target_node(subset_params, all_nodes):
100 """
101 Find the node referenced by subset_params.target_function
102 :param subset_params SubsetParams:
103 :param all_nodes list[Node]:
104 :rtype: Node
105 """
106 target_nodes = []
107 for node in all_nodes:
108 if node.token == subset_params.target_function or \
109 node.token_with_ownership() == subset_params.target_function or \
110 node.name() == subset_params.target_function:
111 target_nodes.append(node)
112 if not target_nodes:
113 raise AssertionError("Could not find node %r to build a subset." % subset_params.target_function)
114 if len(target_nodes) > 1:
115 raise AssertionError("Found multiple nodes for %r: %r. Try either a `class.func` or "
116 "`filename::class.func`." % (subset_params.target_function, target_nodes))
117 return target_nodes[0]
118
119
120def _filter_nodes_for_subset(subset_params, all_nodes, edges):

Callers 1

_filter_nodes_for_subsetFunction · 0.85

Calls 2

token_with_ownershipMethod · 0.80
nameMethod · 0.80

Tested by

no test coverage detected