class documentation

class ParsedTypeDocstring(TypeDocstring, ParsedDocstring):

View In Hierarchy

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__ Returns ------- The parsed type in reStructuredText format.
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:

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
def __init__(self, annotation, warns_on_unknown_tokens=False, lineno=0):

Undocumented

Parameters
annotation:Union[nodes.document, str]Undocumented
warns​_on​_unknown​_tokens:boolUndocumented
lineno:intUndocumented
def to_node(self):
Not implemented.
Returns
nodes.documentUndocumented
def to_stan(self, docstring_linker):
Present the type as a stan tree.
Parameters
docstring​_linker:DocstringLinkerUndocumented
Returns
TagUndocumented
FIELDS: tuple[str, ...] =

Undocumented

Value
('type', 'rtype', 'ytype', 'returntype', 'yieldtype')
@property
has_body: bool =

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, docstring_linker):

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[Union[str, nodes.Node], TokenType]]List of tuples: (token, type)
docstring​_linker:DocstringLinkerUndocumented
Returns
List[Tuple[Union[str, Tag, nodes.Node], TokenType]]Undocumented
def _convert_type_spec_to_stan(self, docstring_linker):
Convert type to Tag object.
Parameters
docstring​_linker:DocstringLinkerUndocumented
Returns
TagUndocumented
def _tokenize_node_type_spec(self, spec):

Undocumented

Parameters
spec:nodes.documentUndocumented
Returns
List[Union[str, nodes.Node]]Undocumented
_lineno =

Undocumented