class documentation
class TypeDocstring: (source)
Known subclasses: pydoctor.epydoc.markup._types.ParsedTypeDocstring
Constructor: TypeDocstring(annotation, warns_on_unknown_tokens)
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).
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 |
Class Method | _tokenize |
Split the string in tokens for further processing. |
Static Method | _recombine |
Merge the special literal choices tokens together. |
Method | _build |
Undocumented |
Method | _convert |
Undocumented |
Method | _token |
Find the type of a token. Types are defined in C{TokenType} enum. |
Method | _trigger |
Append some warnings. |
Class Variable | _ast |
Undocumented |
Class Variable | _ast |
Undocumented |
Class Variable | _default |
Undocumented |
Class Variable | _natural |
Undocumented |
Class Variable | _natural |
Undocumented |
Class Variable | _token |
Undocumented |
Instance Variable | _annotation |
Undocumented |
Instance Variable | _tokens |
Undocumented |
Instance Variable | _warns |
Undocumented |
Merge the special literal choices tokens together.
Example
>>> tokens = ["{", "1", ", ", "2", "}"] >>> TypeDocstring._recombine_set_tokens(tokens) ['{1, 2}']