From 4a8e741bfabd53562f84ad2c391830ab5f936467 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vlastimil=20Z=C3=ADma?= Date: Fri, 27 Sep 2024 12:28:20 +0200 Subject: [PATCH] Update Loader docs --- docs/changelog/3352.doc.rst | 1 + docs/plugins_api.rst | 3 +++ src/tox/config/loader/api.py | 6 +++++- src/tox/config/loader/memory.py | 2 ++ 4 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 docs/changelog/3352.doc.rst diff --git a/docs/changelog/3352.doc.rst b/docs/changelog/3352.doc.rst new file mode 100644 index 000000000..4a5ea7b67 --- /dev/null +++ b/docs/changelog/3352.doc.rst @@ -0,0 +1 @@ +Update Loader docs - by :user:ziima diff --git a/docs/plugins_api.rst b/docs/plugins_api.rst index 99f8094c1..3aad0207f 100644 --- a/docs/plugins_api.rst +++ b/docs/plugins_api.rst @@ -63,6 +63,9 @@ config .. autoclass:: tox.config.loader.api.Loader :members: +.. autoclass:: tox.config.loader.memory.MemoryLoader + :members: + .. autoclass:: tox.config.loader.convert.Convert :members: diff --git a/src/tox/config/loader/api.py b/src/tox/config/loader/api.py index d0437357b..2409a3bff 100644 --- a/src/tox/config/loader/api.py +++ b/src/tox/config/loader/api.py @@ -77,7 +77,10 @@ def copy(self) -> ConfigLoadArgs: class Loader(Convert[T]): - """Loader loads a configuration value and converts it.""" + """Loader loads configuration values and converts it. + + :param overrides: A list of overrides to be applied. + """ def __init__(self, section: Section, overrides: list[Override]) -> None: self._section = section @@ -88,6 +91,7 @@ def __init__(self, section: Section, overrides: list[Override]) -> None: @property def section(self) -> Section: + """Return the section of the configuration from where the values are extracted.""" return self._section @abstractmethod diff --git a/src/tox/config/loader/memory.py b/src/tox/config/loader/memory.py index 80ad82202..34f52f128 100644 --- a/src/tox/config/loader/memory.py +++ b/src/tox/config/loader/memory.py @@ -14,6 +14,8 @@ class MemoryLoader(Loader[Any]): + """Loads configuration directly from data in memory.""" + def __init__(self, **kwargs: Any) -> None: super().__init__(Section(prefix="", name=str(id(self))), []) self.raw: dict[str, Any] = {**kwargs}