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

Method generate

code2flow/engine.py:70–95  ·  view source on GitHub ↗

:param target_function str: :param upstream_depth int: :param downstream_depth int: :rtype: SubsetParams|Nonetype

(target_function, upstream_depth, downstream_depth)

Source from the content-addressed store, hash-verified

68
69 @staticmethod
70 def generate(target_function, upstream_depth, downstream_depth):
71 """
72 :param target_function str:
73 :param upstream_depth int:
74 :param downstream_depth int:
75 :rtype: SubsetParams|Nonetype
76 """
77 if upstream_depth and not target_function:
78 raise AssertionError("--upstream-depth requires --target-function")
79
80 if downstream_depth and not target_function:
81 raise AssertionError("--downstream-depth requires --target-function")
82
83 if not target_function:
84 return None
85
86 if not (upstream_depth or downstream_depth):
87 raise AssertionError("--target-function requires --upstream-depth or --downstream-depth")
88
89 if upstream_depth < 0:
90 raise AssertionError("--upstream-depth must be >= 0. Exclude argument for complete depth.")
91
92 if downstream_depth < 0:
93 raise AssertionError("--downstream-depth must be >= 0. Exclude argument for complete depth.")
94
95 return SubsetParams(target_function, upstream_depth, downstream_depth)
96
97
98

Callers 3

mainFunction · 0.80
test_subset_cliFunction · 0.80
test_allFunction · 0.80

Calls 1

SubsetParamsClass · 0.85

Tested by 2

test_subset_cliFunction · 0.64
test_allFunction · 0.64