class documentation

Convert natural language type strings to reStructuredText.

Syntax is based on numpydoc type specification with additionnal recognition of PEP 484-like type annotations (with parentheses or square brackets characters).

Exemples of valid type strings and output
Type string Output
List[str] or list(bytes), optional List[str] or list(bytes), optional
{"html", "json", "xml"}, optional {"html", "json", "xml"}, optional
list of int or float or None, default: None list of int or float or None, default: None
`complicated string` or `strIO <twisted.python.compat.NativeStringIO>` complicated string or strIO
Method __init__ Undocumented
Method __str__ No summary
Instance Variable warnings Undocumented
Static Method _convert_type_spec_to_rst Undocumented
Class Variable _ast_like_delimiters_regex Undocumented
Class Variable _ast_like_delimiters_regex_str Undocumented
Class Variable _default_regex Undocumented
Class Variable _natural_language_delimiters_regex Undocumented
Class Variable _natural_language_delimiters_regex_str Undocumented
Class Variable _token_regex Undocumented
Instance Variable _tokens Undocumented
def __init__(self, annotation: str, warns_on_unknown_tokens: bool = False): (source)

Undocumented

def __str__(self) -> str: (source)
Returns
strThe parsed type in reStructuredText format.
warnings = (source)

Undocumented

def _convert_type_spec_to_rst(tokens: list[Token]) -> str: (source)

Undocumented

_ast_like_delimiters_regex = (source)

Undocumented

_ast_like_delimiters_regex_str: str = (source)

Undocumented

_default_regex = (source)

Undocumented

_natural_language_delimiters_regex = (source)

Undocumented

_natural_language_delimiters_regex_str: str = (source)

Undocumented

_token_regex = (source)

Undocumented

Undocumented