Coverage for src/configuraptor/cls.py: 100%
7 statements
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-15 14:30 +0200
« prev ^ index » next coverage.py v7.2.7, created at 2023-06-15 14:30 +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(
19 cls: typing.Type[C], data: T_data, key: str = None, init: dict[str, typing.Any] = None, strict: bool = True
20 ) -> C:
21 """
22 Load a class' config values from the config file.
24 SomeClass.load(data, ...) = load_into(SomeClass, data, ...).
25 """
26 return load_into(cls, data, key=key, init=init, strict=strict)