recline.vendor.docstring_parser.parser package

Submodules

recline.vendor.docstring_parser.parser.common module

Common methods for parsing.

class recline.vendor.docstring_parser.parser.common.Docstring

Bases: object

Docstring object representation.

property examples: DocstringExamples | None

Return example information indicated in docstring.

property params: List[DocstringParam]

Return parameters indicated in docstring.

property raises: List[DocstringRaises]

Return exceptions indicated in docstring.

property returns: DocstringReturns | None

Return return information indicated in docstring.

class recline.vendor.docstring_parser.parser.common.DocstringExamples(args: List[str], description: str)

Bases: DocstringTypeMeta

DocstringMeta symbolizing :examples metadata.

property name: str | None

Return the example name associated with given param.

class recline.vendor.docstring_parser.parser.common.DocstringMeta(args: List[str], description: str)

Bases: object

Docstring meta information.

Symbolizes lines in form of

param arg:

description

raises ValueError:

if something happens

classmethod from_meta(meta: DocstringMeta) Any

Copy DocstringMeta from another instance.

class recline.vendor.docstring_parser.parser.common.DocstringParam(args: List[str], description: str)

Bases: DocstringMeta

DocstringMeta symbolizing :param metadata.

property arg_name: str | None

Return argument name associated with given param.

property type_name: str | None

Return type name associated with given param.

class recline.vendor.docstring_parser.parser.common.DocstringRaises(args: List[str], description: str)

Bases: DocstringTypeMeta

DocstringMeta symbolizing :raises metadata.

class recline.vendor.docstring_parser.parser.common.DocstringReturns(args: List[str], description: str)

Bases: DocstringTypeMeta

DocstringMeta symbolizing :returns metadata.

class recline.vendor.docstring_parser.parser.common.DocstringTypeMeta(args: List[str], description: str)

Bases: DocstringMeta

Docstring meta whose only optional arg contains type information.

property type_name: str | None

Return type name associated with given docstring metadata.

exception recline.vendor.docstring_parser.parser.common.ParseError

Bases: RuntimeError

Base class for all parsing related errors.

recline.vendor.docstring_parser.parser.google module

Google-style docstring parsing.

recline.vendor.docstring_parser.parser.google.parse(text: str) Docstring

Parse the Google-style docstring into its components.

Returns:

parsed docstring

recline.vendor.docstring_parser.parser.rest module

ReST-style docstring parsing.

recline.vendor.docstring_parser.parser.rest.parse(text: str) Docstring

Parse the ReST-style docstring into its components.

Returns:

parsed docstring

Module contents

Docstring parsing.

class recline.vendor.docstring_parser.parser.Style(value)

Bases: Enum

An enumeration.

auto = 3
google = 2
rest = 1
recline.vendor.docstring_parser.parser.parse(text: str, style: Style = Style.auto) Docstring

Parse the docstring into its components.

Parameters:
  • text – docstring text to parse

  • style – docstring style

Returns:

parsed docstring representation