HasExamples
Create `Example` objects from Examples docstring section. Examples are returned from `griffe.DocstringSection.value` as a list of (kind, value) tuples. Examples: Description >>> some code [('text', 'Description'), ('examples', 'some code')] Description of a second example, which may span multiple lines >>> the example code >>> which can span multiple lines [('text', 'Description of a second example, which may span multiple lines'), ('examples', 'the example code which can span multiple lines')]
Methods
__init__(self, obj : GriffeObjType) -> None
Parameters
- Name
self
- Type
- Default
- Description
- Name
obj
- Type
- GriffeObjType
- Default
- Description
get_docstring(self, kind : str) -> typing.Optional[str]
Extract a `griffe.DocstringSection` of a given `kind`s parsed value.
Parameters
- Name
self
- Type
- Default
- Description
- Name
kind
- Type
- str
- Default
- Description
The kind of `griffe.DocstringSection` to extract. Valid values are `text`, `parameters`, `returns`, `raises`, and `examples`.
Response
- Type
- typing.Optional[str]
- Description
Attributes
- Name
obj
- Type
- Value
= obj
- Description
- Name
examples
- Type
- list[Example]
- Value
= None
- Description