def check_func(val): val = voice_conversion(val, "function") parameters = get_params(val) function_name = val.split("parameters")[0] # attempts to make function a Python builtin if to_builtin(function_name): function_name = to_builtin(function_name) else: # formats the name as snake_case if it is not a builtin function_name = format_var_func_name(function_name.rstrip()) if parameters is False: return False else: return "{0}{1}".format(function_name, parameters)
def get_method(val): val = voice_conversion(val, "method") # makes sure that command contains a method call if "method" in val: method_spot = val.find("method") parameters = get_params(val) # gets method name and converts it to builtin if it can method = val.split("parameters")[0][method_spot+7:] if to_builtin(method): method = to_builtin(method) else: method = format_var_func_name(method.rstrip()) if parameters is False: return False # returns the method and the text that needs to be removed from val else: return [".{0}{1}".format(method, parameters), val[method_spot:]] else: return ["", ""]