MCPcopy Create free account
hub / github.com/catid/supercharger / extract_function_name

Function extract_function_name

codegen/codegen.py:33–45  ·  view source on GitHub ↗
(function_def)

Source from the content-addressed store, hash-verified

31 return prototype
32
33def extract_function_name(function_def):
34 # Split the function definition by whitespace
35 words = re.split(r'[^A-Za-z0-9_]|(?<![A-Za-z_])[0-9]+', function_def)
36
37 # Look for the "def" keyword and extract the function name
38 for i, word in enumerate(words):
39 if word == "def":
40 function_name = words[i+1]
41 # Strip any trailing parentheses or whitespace
42 function_name = function_name.rstrip("() ")
43 return function_name
44
45 raise Exception("No function name found")
46
47def get_script_name_from_function_name(function_name, is_test=False, variation=None):
48 if variation is None:

Callers 1

codegen.pyFile · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected