summaryrefslogtreecommitdiff
path: root/kvmd/validators/kvm.py
diff options
context:
space:
mode:
authorDevaev Maxim <[email protected]>2020-09-08 12:32:16 +0300
committerDevaev Maxim <[email protected]>2020-09-08 12:32:16 +0300
commitd528a3002e53bb7a5b5e6d9b5385252372738fbf (patch)
tree9746fb7061c82ec101f01151a440e1659799df6e /kvmd/validators/kvm.py
parentd932a937caede7f54c0f4384ce08f7ecc291af23 (diff)
refactoring
Diffstat (limited to 'kvmd/validators/kvm.py')
-rw-r--r--kvmd/validators/kvm.py9
1 files changed, 7 insertions, 2 deletions
diff --git a/kvmd/validators/kvm.py b/kvmd/validators/kvm.py
index 17895c47..5a4dd6c8 100644
--- a/kvmd/validators/kvm.py
+++ b/kvmd/validators/kvm.py
@@ -21,6 +21,8 @@
from typing import List
+from typing import Set
+from typing import Optional
from typing import Any
from ..keyboard.mappings import KEYMAP
@@ -92,9 +94,12 @@ def valid_hid_mouse_wheel(arg: Any) -> int:
# =====
-def valid_ugpio_driver(arg: Any) -> str:
+def valid_ugpio_driver(arg: Any, variants: Optional[Set[str]]=None) -> str:
name = "GPIO driver"
- return check_len(check_re_match(arg, name, r"^[a-zA-Z_][a-zA-Z0-9_-]*$"), name, 255)
+ arg = check_len(check_re_match(arg, name, r"^[a-zA-Z_][a-zA-Z0-9_-]*$"), name, 255)
+ if variants is not None:
+ arg = check_string_in_list(arg, f"configured {name}", variants)
+ return arg
def valid_ugpio_mode(arg: Any) -> str: