concepts.dsl.parsers.fol_python_parser.ast_get_simple_function#

ast_get_simple_function(function)[source]#

Get the arguments, return type, and body of a simple function. This function only works for “simple functions”. That is, the function body contains only a single return statement. This function imposes strong restrictions:

  • The function should have a single return statement.

  • All arguments and return type should be annotated with either a single class name or a string. (It does not support type hints like List[int].)

Parameters:

function (FunctionDef) – the function definition.

Returns:

the arguments of the function as a tuple of Variable (types are strings). - return_type: the return type of the function (string). - body: the body of the function.

Return type:

  • arguments