class GoogleDocstring: (source)
Known subclasses: pydoctor.napoleon.docstring.NumpyDocstring
Constructor: GoogleDocstring(docstring, what, process_type_fields)
Convert Google style docstrings to reStructuredText.
Example
>>> docstring = '''One line summary. ... ... Extended description. ... ... Args: ... arg1(int): Description of `arg1` ... arg2(str): Description of `arg2` ... Returns: ... str: Description of return value. ... ''' >>> print(GoogleDocstring(docstring)) One line summary. <BLANKLINE> Extended description. <BLANKLINE> :param arg1: Description of `arg1` :type arg1: int :param arg2: Description of `arg2` :type arg2: str <BLANKLINE> :returns: Description of return value. :returntype: str >>> print(GoogleDocstring(docstring, process_type_fields=True)) One line summary. <BLANKLINE> Extended description. <BLANKLINE> :param arg1: Description of `arg1` :type arg1: `int` :param arg2: Description of `arg2` :type arg2: `str` <BLANKLINE> :returns: Description of return value. :returntype: `str`
Method | __init__ |
No summary |
Method | __str__ |
Return the parsed docstring in reStructuredText format. |
Method | lines |
Return the parsed lines of the docstring in reStructuredText format. |
Instance Variable | warnings |
Warning messages triggered during the conversion. |
Method | _consume |
Undocumented |
Method | _consume |
Undocumented |
Method | _consume |
Undocumented |
Method | _consume |
Undocumented |
Method | _consume |
Undocumented |
Method | _consume |
Undocumented |
Method | _consume |
Undocumented |
Method | _consume |
Undocumented |
Method | _consume |
Undocumented |
Method | _consume |
Undocumented |
Method | _convert |
Tokenize the string type and convert it with additional markup and auto linking, with L{TypeDocstring}. |
Method | _dedent |
Undocumented |
Method | _escape |
Undocumented |
Method | _fix |
Undocumented |
Method | _format |
Undocumented |
Method | _format |
Undocumented |
Method | _format |
Undocumented |
Method | _format |
Undocumented |
Method | _format |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _get |
Undocumented |
Method | _indent |
Undocumented |
Method | _is |
Undocumented |
Method | _is |
Undocumented |
Method | _is |
Undocumented |
Method | _is |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _parse |
Undocumented |
Method | _partition |
Undocumented |
Method | _partition |
Partition multiple lines on colon. If the type or name span multiple lines, they will be automatically joined. |
Method | _strip |
Undocumented |
Class Variable | _name |
Undocumented |
Instance Variable | _is |
Undocumented |
Instance Variable | _line |
Undocumented |
Instance Variable | _parsed |
Undocumented |
Instance Variable | _process |
Undocumented |
Instance Variable | _section |
Undocumented |
Instance Variable | _sections |
Undocumented |
Instance Variable | _what |
Undocumented |
str | list[ str]
, what: Literal[ 'function', 'module', 'class', 'attribute'] | None
= None, process_type_fields: bool
= False):
(source)
¶
Parameters | |
docstring:str or list of str | The docstring to parse, given either as a string or split into individual lines. |
what:Literal[ | Optional string representing the type of object we're documenting. |
processbool | Whether to process the type fields or to leave them untouched (default) in order to be processed later. Value process_type_fields=False is currently only used in the tests. |
bool
= True, prefer_type: bool
= False, **kwargs: Any
) -> Field
:
(source)
¶
pydoctor.napoleon.docstring.NumpyDocstring
Undocumented
bool
= True, prefer_type: bool
= False, multiple: bool
= False, **kwargs: Any
) -> list[ Field]
:
(source)
¶
pydoctor.napoleon.docstring.NumpyDocstring
Undocumented
Tokenize the string type and convert it with additional markup and auto linking, with L{TypeDocstring}.
Parameters | |
_type:bool | the string type to convert. |
isbool | Whether the string is the content of a :type: or rtype field.
If this is True and GoogleDocstring 's process_type_fields is False (defaults),
the type will NOT be converted (instead, it's returned as is) because it will be converted by the code provided by
ParsedTypeDocstring class in a later stage of docstring parsing. |
lineno:int | Undocumented |
Returns | |
str | Undocumented |
list[ Field]
, field_role: str
= 'param', type_role: str
= 'type') -> list[ str]
:
(source)
¶
Undocumented
str
, _type: str
, _desc: list[ str]
, lineno: int
= 0) -> list[ str]
:
(source)
¶
Undocumented
str
, field_type: str
= 'raises', prefer_type: bool
= True) -> list[ str]
:
(source)
¶
Undocumented
list[ str]
, format_validator: Callable[ [ str], bool]
) -> tuple[ str, str, list[ str]]
:
(source)
¶
Partition multiple lines on colon. If the type or name span multiple lines, they will be automatically joined.
Parameters | |
lines:list[ | Lines to split |
formatCallable[ | Validator returning Note The validator will be called with a one line string as the argument. Note Only used for multiline fields. |
Returns | |
tuple[ |