gemseo.utils.source_parsing module#

Parse source code to extract information.

get_callable_argument_defaults(callable_)[source]#

Return the default values of the kwargs of a callable.

Parameters:
  • callable -- The callable.

  • callable_ (Callable[[...], Any])

Returns:

The defaults if any, an empty dictionary otherwise.

Return type:

dict[str, Any]

get_options_doc(function)[source]#

Get the documentation of a function.

Parameters:

function (Callable[[...], Any]) -- The function to retrieve the doc from.

Returns:

The descriptions of the options.

Return type:

dict[str, str]

parse_google(docstring, n_arguments=0)[source]#

Parse a Google docstring.

Parameters:
  • docstring (str) -- The docstring to be parsed.

  • n_arguments (int) --

    The number of arguments of the function.

    By default it is set to 0.

Returns:

The parsed docstring with the function arguments names bound to their descriptions.

Return type:

dict[str, str]