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

Function _limit_functions

code2flow/engine.py:613–636  ·  view source on GitHub ↗

Exclude nodes (functions) which match any of the exclude_functions :param list[Group] file_groups: :param list exclude_functions: :param list include_only_functions: :rtype: list[Group]

(file_groups, exclude_functions, include_only_functions)

Source from the content-addressed store, hash-verified

611
612
613def _limit_functions(file_groups, exclude_functions, include_only_functions):
614 """
615 Exclude nodes (functions) which match any of the exclude_functions
616
617 :param list[Group] file_groups:
618 :param list exclude_functions:
619 :param list include_only_functions:
620 :rtype: list[Group]
621 """
622
623 removed_functions = set()
624
625 for group in list(file_groups):
626 for node in group.all_nodes():
627 if node.token in exclude_functions or \
628 (include_only_functions and node.token not in include_only_functions):
629 node.remove_from_parent()
630 removed_functions.add(node.token)
631
632 for function_name in exclude_functions:
633 if function_name not in removed_functions:
634 logging.warning(f"Could not exclude function '{function_name}' "
635 "because it was not found.")
636 return file_groups
637
638
639def _generate_graphviz(output_file, extension, final_img_filename):

Callers 1

map_itFunction · 0.85

Calls 4

setFunction · 0.85
all_nodesMethod · 0.80
remove_from_parentMethod · 0.45
addMethod · 0.45

Tested by

no test coverage detected