Class to hold chain properties with (limited) type-checking
Definition at line 9 of file ChainDefInMenu.py.
◆ __post_init__()
def ChainDefInMenu.ChainProp.__post_init__ |
( |
|
self | ) |
|
Definition at line 36 of file ChainDefInMenu.py.
36 def __post_init__(self):
37 f = self._check_types()
39 raise TypeError(f
"Expected type of '{f.name}' to be {f.type}, "
40 f
"got {repr(getattr(self, f.name))}")
◆ _check_types()
def ChainDefInMenu.ChainProp._check_types |
( |
|
self | ) |
|
|
private |
Check field types
Definition at line 22 of file ChainDefInMenu.py.
22 def _check_types(self):
23 """Check field types"""
24 for f
in dataclasses.fields(self):
25 actual_type = typing.get_origin(f.type)
or f.type
26 value = getattr(self, f.name)
27 if actual_type == list:
30 if not isinstance(el, typing.get_args(f.type)):
32 elif not isinstance(value, actual_type):
◆ default_factory
ChainDefInMenu.ChainProp.default_factory |
|
static |
◆ int
ChainDefInMenu.ChainProp.int |
|
static |
◆ str
ChainDefInMenu.ChainProp.str |
|
static |
The documentation for this class was generated from the following file: