| 31 | return prototype |
| 32 | |
| 33 | def 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 | |
| 47 | def get_script_name_from_function_name(function_name, is_test=False, variation=None): |
| 48 | if variation is None: |