Skip to content

Commit

Permalink
Update Loader docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ziima committed Sep 27, 2024
1 parent 329db63 commit 4a8e741
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions docs/changelog/3352.doc.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Update Loader docs - by :user:ziima
3 changes: 3 additions & 0 deletions docs/plugins_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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:

Expand Down
6 changes: 5 additions & 1 deletion src/tox/config/loader/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 2 additions & 0 deletions src/tox/config/loader/memory.py
Original file line number Diff line number Diff line change
Expand Up @@ -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="<memory>", name=str(id(self))), [])
self.raw: dict[str, Any] = {**kwargs}
Expand Down

0 comments on commit 4a8e741

Please sign in to comment.