diff options
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/apps/__init__.py | 7 | ||||
-rw-r--r-- | kvmd/validators/basic.py | 4 |
2 files changed, 8 insertions, 3 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py index 8014d8f6..b04f13a6 100644 --- a/kvmd/apps/__init__.py +++ b/kvmd/apps/__init__.py @@ -51,6 +51,7 @@ from ..yamlconf.loader import load_yaml_file from ..validators.basic import valid_bool from ..validators.basic import valid_number +from ..validators.basic import valid_float_f0 from ..validators.basic import valid_float_f01 from ..validators.auth import valid_users_list @@ -224,9 +225,9 @@ def _get_config_scheme() -> Dict: "cap_pin": Option(-1, type=valid_gpio_pin_optional), "conv_pin": Option(-1, type=valid_gpio_pin_optional), - "sync_delay": Option(1.0, type=valid_float_f01), - "init_delay": Option(3.0, type=valid_float_f01), - "init_restart_after": Option(0.0, type=(lambda arg: valid_number(arg, min=0.0, type=float))), + "sync_delay": Option(1.0, type=valid_float_f0), + "init_delay": Option(3.0, type=valid_float_f0), + "init_restart_after": Option(0.0, type=valid_float_f0), "shutdown_delay": Option(10.0, type=valid_float_f01), "state_poll": Option(1.0, type=valid_float_f01), diff --git a/kvmd/validators/basic.py b/kvmd/validators/basic.py index 87056428..0328490d 100644 --- a/kvmd/validators/basic.py +++ b/kvmd/validators/basic.py @@ -74,6 +74,10 @@ def valid_int_f1(arg: Any) -> int: return int(valid_number(arg, min=1)) +def valid_float_f0(arg: Any) -> float: + return float(valid_number(arg, min=0, type=float)) + + def valid_float_f01(arg: Any) -> float: return float(valid_number(arg, min=0.1, type=float)) |