diff options
author | Bernát Gábor <bgabor8@bloomberg.net> | 2020-10-19 09:29:51 +0100 |
---|---|---|
committer | Bernát Gábor <bgabor8@bloomberg.net> | 2020-10-19 09:29:51 +0100 |
commit | 61869b12edd970998e235c86fcf72b189445c6eb (patch) | |
tree | 2b9bc817bfc28fa6d11ec2bba82dedd065e4aeed /src/tox/config/source/api.py | |
parent | 860983a992f5b6a613c111b5e1cbfd2a7213bea8 (diff) | |
download | tox-git-61869b12edd970998e235c86fcf72b189445c6eb.tar.gz |
Improve documentation
Signed-off-by: Bernát Gábor <bgabor8@bloomberg.net>
Diffstat (limited to 'src/tox/config/source/api.py')
-rw-r--r-- | src/tox/config/source/api.py | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/src/tox/config/source/api.py b/src/tox/config/source/api.py index 7d8405a8..53f6b295 100644 --- a/src/tox/config/source/api.py +++ b/src/tox/config/source/api.py @@ -9,14 +9,14 @@ from tox.execute.request import shell_cmd if sys.version_info >= (3, 8): from typing import Literal else: - from typing_extensions import Literal + from typing_extensions import Literal # noqa _NO_MAPPING = object() class Command: def __init__(self, args): - self.args = args # type:List[str] + self.args: List[str] = args def __repr__(self): return f"{type(self).__name__}(args={self.args!r})" @@ -44,6 +44,8 @@ class EnvList: class Convert(ABC): + """Base abstract class that defines transformation of a value to a tox configuration""" + def to(self, raw, of_type): from_module = getattr(of_type, "__module__", None) if from_module in ("typing", "typing_extensions"): @@ -63,7 +65,7 @@ class Convert(ABC): def _to_typing(self, raw, of_type): origin = getattr(of_type, "__origin__", getattr(of_type, "__class__", None)) if origin is not None: - result = _NO_MAPPING # type: Any + result: Any = _NO_MAPPING if origin in (list, List): result = [self.to(i, of_type.__args__[0]) for i in self.to_list(raw)] elif origin in (set, Set): @@ -159,9 +161,11 @@ class Loader(Convert, ABC): class Source(ABC): + """An abstract configuration source. Has a core and per tox environment configuration loader.""" + def __init__(self, core: Loader) -> None: - self.core = core # type: Loader - self._envs = {} # type: Dict[str, Loader] + self.core: Loader = core + self._envs: Dict[str, Loader] = {} @abstractmethod def envs(self, core_conf): |