The sphinx_github_style.utils.sphinx submodule

sphinx_github_style.utils.sphinx.get_conf_val(app, attr, default=None)View on GitHub
View Source Code
def get_conf_val(app: Sphinx, attr: str, default: Optional[Any] = None) -> Any: """Retrieve the value of a ``conf.py`` config variable :param attr: the config variable to retrieve :param default: the default value to return if the variable isn't found """ return app.config._raw_config.get(attr, getattr(app.config, attr, default))

Retrieve the value of a conf.py config variable

Parameters
  • attr (str) – the config variable to retrieve

  • default (Optional[Any]) – the default value to return if the variable isn’t found

Return type

Any

sphinx_github_style.utils.sphinx.set_conf_val(app, attr, value)View on GitHub
View Source Code
def set_conf_val(app: Sphinx, attr: str, value: Any) -> None: """Set the value of a ``conf.py`` config variable :param attr: the config variable to set :param value: the variable value """ app.config._raw_config[attr] = value setattr(app.config, attr, value)

Set the value of a conf.py config variable

Parameters
  • attr (str) – the config variable to set

  • value (Any) – the variable value