class documentation

Add ParsedDocstring interface on top of TypeDocstring and allow to parse types from nodes.Node objects, providing the --process-types option.

Method __init__ Undocumented
Method to_node Not implemented.
Method to_stan Present the type as a stan tree.
Constant FIELDS Undocumented
Property has_body Does this docstring have a non-empty body?
Method _convert_obj_tokens_to_stan Convert TokenType.OBJ and PEP 484 like TokenType.DELIMITER type to stan, merge them together. Leave the rest untouched.
Method _convert_type_spec_to_stan Convert type to Tag object.
Method _tokenize_node_type_spec Undocumented
Instance Variable _lineno Undocumented
Instance Variable _tokens Undocumented

Inherited from TypeDocstring:

Method __str__ No summary
Instance Variable warnings Undocumented
Class Method _tokenize_type_spec Split the string in tokens for further processing.
Static Method _recombine_set_tokens Merge the special literal choices tokens together.
Method _build_tokens Undocumented
Method _convert_type_spec_to_rst Undocumented
Method _token_type Find the type of a token. Types are defined in C{TokenType} enum.
Method _trigger_warnings Append some warnings.
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 _annotation Undocumented
Instance Variable _warns_on_unknown_tokens Undocumented

Inherited from ParsedDocstring (via TypeDocstring):

Method get_summary Returns the summary of this docstring.
Method get_toc The table of contents of the docstring if titles are defined or None.
Instance Variable fields A list of Fields, each of which encodes a single field. The field's bodies are encoded as ParsedDocstrings.
Instance Variable _stan Undocumented
Instance Variable _summary Undocumented
def __init__(self, annotation: nodes.document | str, warns_on_unknown_tokens: bool = False, lineno: int = 0): (source)
def to_stan(self, docstring_linker: DocstringLinker) -> Tag: (source)

Present the type as a stan tree.

FIELDS: tuple[str, ...] = (source)

Undocumented

Value
('type', 'rtype', 'ytype', 'returntype', 'yieldtype')

Does this docstring have a non-empty body?

The body is the part of the docstring that remains after the fields have been split off.

def _convert_obj_tokens_to_stan(self, tokens: list[tuple[str | nodes.Node, TokenType]], docstring_linker: DocstringLinker) -> list[tuple[str | Tag | nodes.Node, TokenType]]: (source)

Convert TokenType.OBJ and PEP 484 like TokenType.DELIMITER type to stan, merge them together. Leave the rest untouched.

Exemple:

>>> tokens = [("list", TokenType.OBJ), ("(", TokenType.DELIMITER), ("int", TokenType.OBJ), (")", TokenType.DELIMITER)]
>>> ann._convert_obj_tokens_to_stan(tokens, NotFoundLinker())
... [(Tag('code', children=['list', '(', 'int', ')']), TokenType.OBJ)]
Parameters
tokens:list[tuple[str | nodes.Node, TokenType]]List of tuples: (token, type)
docstring_linker:DocstringLinkerUndocumented
Returns
list[tuple[str | Tag | nodes.Node, TokenType]]Undocumented
def _convert_type_spec_to_stan(self, docstring_linker: DocstringLinker) -> Tag: (source)

Convert type to Tag object.

def _tokenize_node_type_spec(self, spec: nodes.document) -> list[str | nodes.Node]: (source)

Undocumented

Undocumented