pydata_sphinx_theme.utils
#
General helpers for the management of config parameters.
Module Contents#
Functions#
|
Check if the user has manually provided the config. |
|
Helper function to remove ansi coloring from sphinx warnings. |
Return theme options for the application w/ a fallback if they don't exist. |
|
|
Wraps the Sphinx logger to allow warning suppression. |
|
Triage node.traverse (docutils <0.18.1) vs node.findall. |
Attributes#
- pydata_sphinx_theme.utils.config_provided_by_user(app, key)[source]#
Check if the user has manually provided the config.
- Parameters:
app (sphinx.application.Sphinx) –
key (str) –
- Return type:
bool
- pydata_sphinx_theme.utils.escape_ansi(string)[source]#
Helper function to remove ansi coloring from sphinx warnings.
- Parameters:
string (str) –
- Return type:
str
- pydata_sphinx_theme.utils.get_theme_options_dict(app)[source]#
Return theme options for the application w/ a fallback if they don’t exist.
The “top-level” mapping (the one we should usually check first, and modify if desired) is
app.builder.theme_options
. It is created by Sphinx as a copy ofapp.config.html_theme_options
(containing user-configs from theirconf.py
); sometimes that copy never occurs though which is why we check both.- Parameters:
app (sphinx.application.Sphinx) –
- Return type:
Dict[str, Any]
- pydata_sphinx_theme.utils.maybe_warn(app, msg, *args, **kwargs)[source]#
Wraps the Sphinx logger to allow warning suppression.
- Parameters:
app (sphinx.application.Sphinx) –
- pydata_sphinx_theme.utils.traverse_or_findall(node, condition, **kwargs)[source]#
Triage node.traverse (docutils <0.18.1) vs node.findall.
TODO: This check can be removed when the minimum supported docutils version for numpydoc is docutils>=0.18.1.
- Parameters:
node (docutils.nodes.Node) –
condition (str) –
- Return type:
Iterator[docutils.nodes.Node]