:class:
role.
NumpyDocstring
class from the sphinx.ext.napoleon
module.
process_return
Name | Type | Description |
---|---|---|
lines | list[str] | A list of strings representing lines in a docstring’s “Returns” section. |
Name | Type | Description |
---|---|---|
generator[str] | Yields reformatted lines or the original line if no match is found. |
lines
.r"(?P<param>\w+)\s+:\s+(?P<type>[\w.]+)"
. This pattern captures a “parameter” and its “type” separated by a colon.f'-{m["param"]} (:class:
~)'
, which creates a hyperlink for the type using the :class:
role.scanpy_parse_returns_section
_parse_returns_section
method of the NumpyDocstring
class. It processes the “Returns” section of a docstring to format return values with hyperlinks to their types.
Name | Type | Description |
---|---|---|
self | NumpyDocstring | The NumpyDocstring instance. |
section | str | The content of the “Returns” section from the docstring. |
Name | Type | Description |
---|---|---|
list[str] | Returns a list of strings representing the formatted “Returns” section. |
process_return
to reformat the lines of the “Returns” section._format_block
with “:returns: ” as the prefix.setup
NumpyDocstring
class to use the custom scanpy_parse_returns_section
method.
Name | Type | Description |
---|---|---|
app | Sphinx | The Sphinx application object. |
_parse_returns_section
attribute of the NumpyDocstring
class to the custom scanpy_parse_returns_section
function.
Dependency | Purpose |
---|---|
sphinx | Used for interacting with Sphinx and its components. |
sphinx.ext.napoleon | Used for parsing NumPy-style docstrings. |
re | Used for regular expression matching. |