sphinx_pyppeteer_builder/typings/sphinx/config.pyi

165 lines
4.5 KiB
Python

"""
This type stub file was generated by pyright.
"""
import os
from typing import Any, NamedTuple, TYPE_CHECKING
from collections.abc import Generator, Iterator, Sequence
from sphinx.application import Sphinx
from sphinx.environment import BuildEnvironment
from sphinx.util.tags import Tags
"""Build configuration file handling."""
if TYPE_CHECKING:
...
logger = ...
CONFIG_FILENAME = ...
UNSERIALIZABLE_TYPES = ...
class ConfigValue(NamedTuple):
name: str
value: Any
rebuild: bool | str
...
def is_serializable(obj: Any) -> bool:
"""Check if object is serializable or not."""
...
class ENUM:
"""Represents the candidates which a config value should be one of.
Example:
app.add_config_value('latex_show_urls', 'no', None, ENUM('no', 'footnote', 'inline'))
"""
def __init__(self, *candidates: str | bool | None) -> None:
...
def match(self, value: str | list | tuple) -> bool:
...
class Config:
r"""Configuration file abstraction.
The config object makes the values of all config values available as
attributes.
It is exposed via the :py:class:`~sphinx.application.Sphinx`\ ``.config``
and :py:class:`sphinx.environment.BuildEnvironment`\ ``.config`` attributes.
For example, to get the value of :confval:`language`, use either
``app.config.language`` or ``env.config.language``.
"""
config_values: dict[str, tuple] = ...
def __init__(self, config: dict[str, Any] | None = ..., overrides: dict[str, Any] | None = ...) -> None:
...
@classmethod
def read(cls, confdir: str | os.PathLike[str], overrides: dict | None = ..., tags: Tags | None = ...) -> Config:
"""Create a Config object from configuration file."""
...
def convert_overrides(self, name: str, value: Any) -> Any:
...
def pre_init_values(self) -> None:
"""
Initialize some limited config variables before initializing i18n and loading
extensions.
"""
...
def init_values(self) -> None:
...
def post_init_values(self) -> None:
"""
Initialize additional config variables that are added after init_values() called.
"""
...
def __getattr__(self, name: str) -> Any:
...
def __getitem__(self, name: str) -> Any:
...
def __setitem__(self, name: str, value: Any) -> None:
...
def __delitem__(self, name: str) -> None:
...
def __contains__(self, name: str) -> bool:
...
def __iter__(self) -> Generator[ConfigValue, None, None]:
...
def add(self, name: str, default: Any, rebuild: bool | str, types: Any) -> None:
...
def filter(self, rebuild: str | Sequence[str]) -> Iterator[ConfigValue]:
...
def __getstate__(self) -> dict:
"""Obtains serializable data for pickling."""
...
def __setstate__(self, state: dict) -> None:
...
def eval_config_file(filename: str, tags: Tags | None) -> dict[str, Any]:
"""Evaluate a config file."""
...
def convert_source_suffix(app: Sphinx, config: Config) -> None:
"""Convert old styled source_suffix to new styled one.
* old style: str or list
* new style: a dict which maps from fileext to filetype
"""
...
def convert_highlight_options(app: Sphinx, config: Config) -> None:
"""Convert old styled highlight_options to new styled one.
* old style: options
* new style: a dict which maps from language name to options
"""
...
def init_numfig_format(app: Sphinx, config: Config) -> None:
"""Initialize :confval:`numfig_format`."""
...
def correct_copyright_year(_app: Sphinx, config: Config) -> None:
"""Correct values of copyright year that are not coherent with
the SOURCE_DATE_EPOCH environment variable (if set)
See https://reproducible-builds.org/specs/source-date-epoch/
"""
...
def check_confval_types(app: Sphinx | None, config: Config) -> None:
"""Check all values for deviation from the default value's type, since
that can result in TypeErrors all over the place NB.
"""
...
def check_primary_domain(app: Sphinx, config: Config) -> None:
...
def check_root_doc(app: Sphinx, env: BuildEnvironment, added: set[str], changed: set[str], removed: set[str]) -> set[str]:
"""Adjust root_doc to 'contents' to support an old project which does not have
any root_doc setting.
"""
...
def setup(app: Sphinx) -> dict[str, Any]:
...