API Reference

parse_docstring

docstring_utils.parse_docstring(func: Callable[[...], Any], *, filter_args: bool = False) docstring_utils.parsed_docstring.ParsedDocstring

Parses the docstring of a function into a dictionary

Parameters
  • func (Callable[..., Any]) – The function to parse the docstring of

  • filter_args (bool) – Whether to filter out arguments that are not in the function signature

Returns

The parsed docstring

Return type

ParsedDocstring

ParsedDocstring

class docstring_utils.ParsedDocstring(docstring: str, parsed_docstring: Dict[str, Any])

Class representing a docstring that has been parsed.

property args: Dict[str, docstring_utils.parsed_docstring.ParsedArgument]

The parsed arguments.

Type

Dict[str, ParsedArgument]

property description: str

The description of the parsed docstring.

Type

str

property docstring: str

The docstring that was parsed.

Type

str

property return_value: docstring_utils.parsed_docstring.ParsedReturnValue

The parsed return value.

Type

ParsedReturnValue

ParsedReturnValue

Attributes
class docstring_utils.ParsedReturnValue(type: str, description: str)

Represents a parsed return value

type

The return type.

Type

str

description

The description of the return value.

Type

str

ParsedArgument

Attributes
class docstring_utils.ParsedArgument(name: str, type: str, description: str)

Represents a parsed argument

name

The name of the argument.

Type

str

type

The type of the argument.

Type

str

description

The description of the argument.

Type

str