devctrl.gui.test.settings.NestedTestSettings#

class NestedTestSettings(f_bool: bool = True, f_int: int = -5, f_float: float = 0.0, f_str: str = '')[source]#

Bases: SettingsClass

Methods

as_dict

Convenience wrapper for dataclasses.asdict(self)

from_dict

Recursively construct a SettingsClass from a dictionary.

load_yaml

save_yaml

Attributes

__annotations__ = {'f_bool': <class 'bool'>, 'f_float': <class 'float'>, 'f_int': <class 'int'>, 'f_str': <class 'str'>}#
__dataclass_fields__ = {'f_bool': Field(name='f_bool',type=<class 'bool'>,default=True,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'f_float': Field(name='f_float',type=<class 'float'>,default=0.0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Valid from -10 to -3', 'valid': [-42.5, 13.0, 0.0, 123.0]}),kw_only=False,_field_type=_FIELD), 'f_int': Field(name='f_int',type=<class 'int'>,default=-5,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Valid from -10 to -3', 'valid': (-10, -3)}),kw_only=False,_field_type=_FIELD), 'f_str': Field(name='f_str',type=<class 'str'>,default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}#
__dataclass_params__ = _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False,match_args=True,kw_only=False,slots=False,weakref_slot=False)#
__dict__ = mappingproxy({'__module__': 'devctrl.gui.test.settings', '__firstlineno__': 4, '__annotations__': {'f_bool': <class 'bool'>, 'f_int': <class 'int'>, 'f_float': <class 'float'>, 'f_str': <class 'str'>}, 'f_bool': True, 'f_int': -5, 'f_float': 0.0, 'f_str': '', '__static_attributes__': (), '__doc__': "NestedTestSettings(f_bool: bool = True, f_int: int = -5, f_float: float = 0.0, f_str: str = '')", '__dataclass_params__': _DataclassParams(init=True,repr=True,eq=True,order=False,unsafe_hash=False,frozen=False,match_args=True,kw_only=False,slots=False,weakref_slot=False), '__dataclass_fields__': {'f_bool': Field(name='f_bool',type=<class 'bool'>,default=True,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD), 'f_int': Field(name='f_int',type=<class 'int'>,default=-5,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Valid from -10 to -3', 'valid': (-10, -3)}),kw_only=False,_field_type=_FIELD), 'f_float': Field(name='f_float',type=<class 'float'>,default=0.0,default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({'doc': 'Valid from -10 to -3', 'valid': [-42.5, 13.0, 0.0, 123.0]}),kw_only=False,_field_type=_FIELD), 'f_str': Field(name='f_str',type=<class 'str'>,default='',default_factory=<dataclasses._MISSING_TYPE object>,init=True,repr=True,hash=None,compare=True,metadata=mappingproxy({}),kw_only=False,_field_type=_FIELD)}, '__replace__': <function _replace>, '__hash__': None, '__init__': <function NestedTestSettings.__init__>, '__repr__': <function NestedTestSettings.__repr__>, '__eq__': <function NestedTestSettings.__eq__>, '__match_args__': ('f_bool', 'f_int', 'f_float', 'f_str')})#
__eq__(other)#

Return self==value.

__firstlineno__ = 4#
__hash__ = None#
__init__(f_bool: bool = True, f_int: int = -5, f_float: float = 0.0, f_str: str = '') None#
__match_args__ = ('f_bool', 'f_int', 'f_float', 'f_str')#
__module__ = 'devctrl.gui.test.settings'#
__or__(other)#

Merge with another settings class or a dictionary.

__replace__(**changes)#
__repr__()#

Return repr(self).

__static_attributes__ = ()#
__weakref__#

list of weak references to the object

as_dict() dict#

Convenience wrapper for dataclasses.asdict(self)

f_bool: bool = True#
f_float: float = 0.0#
f_int: int = -5#
f_str: str = ''#
classmethod from_dict(data: dict)#

Recursively construct a SettingsClass from a dictionary.

If the value of a field is another SettingsClass, from_dict() will be called for that field as well. Handled are:

  • SettingsClass

  • list[SettingsClass]

  • dict[<any>, SettingsClass]

  • all of the above as Optional (Union with None)

  • a Union with any handled types

Raises:
  • ValueError – If data contains a value that has the wrong type for the field of cls (ONLY if the type is a subclass of SettingsClass! Other types are not enforced)

  • KeyError – If data contains a key that is not a field name of cls

classmethod load_yaml(yaml_path: str, loader=<class 'yaml.loader.Loader'>)#
save_yaml(yaml_path: str)#