Coverage for src/typedconfig/cls.py: 100%
7 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-13 18:49 +0200
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-13 18:49 +0200
1"""
2Logic for the TypedConfig inheritable class.
3"""
5import typing
7from .core import T_data, load_into
9C = typing.TypeVar("C", bound=typing.Any)
12class TypedConfig:
13 """
14 Can be used instead of load_into.
15 """
17 @classmethod
18 def load(cls: typing.Type[C], data: T_data, key: str = None, init: dict[str, typing.Any] = None) -> C:
19 """
20 Load a class' config values from the config file.
22 SomeClass.load(data, ...) = load_into(SomeClass, data, ...).
23 """
24 return load_into(cls, data, key=key, init=init)