diff options
author | Maxim Devaev <[email protected]> | 2021-09-08 06:08:11 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2021-09-08 06:08:11 +0300 |
commit | ca812117e48cbc6e2c71947b912748cfd3ff9691 (patch) | |
tree | d8daa43c9e606ed0c4226a112e943aa683fd627f /kvmd/plugins/ugpio/hidrelay.py | |
parent | 5d1228eb9e5b159d0909453ed85280b9fb794a9e (diff) |
improved pins validation
Diffstat (limited to 'kvmd/plugins/ugpio/hidrelay.py')
-rw-r--r-- | kvmd/plugins/ugpio/hidrelay.py | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/kvmd/plugins/ugpio/hidrelay.py b/kvmd/plugins/ugpio/hidrelay.py index d4bdda48..06bb526d 100644 --- a/kvmd/plugins/ugpio/hidrelay.py +++ b/kvmd/plugins/ugpio/hidrelay.py @@ -22,6 +22,7 @@ import asyncio import contextlib +import functools from typing import Dict from typing import Set @@ -83,8 +84,8 @@ class Plugin(BaseUserGpioDriver): return set([UserGpioModes.OUTPUT]) @classmethod - def get_pin_validator(cls) -> Callable[[Any], str]: - return (lambda arg: str(valid_number(arg, min=0, max=7, name="HID relay channel"))) + def get_pin_validator(cls) -> Callable[[Any], Any]: + return functools.partial(valid_number, min=0, max=7, name="HID relay channel") def register_output(self, pin: str, initial: Optional[bool]) -> None: self.__initials[int(pin)] = initial |