mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
gpio view and refactoring
This commit is contained in:
@@ -23,7 +23,6 @@
|
||||
from typing import Any
|
||||
|
||||
from . import check_in_list
|
||||
from . import check_string_in_list
|
||||
from . import check_re_match
|
||||
|
||||
from .basic import valid_number
|
||||
@@ -44,14 +43,6 @@ def valid_gpio_pin_optional(arg: Any) -> int:
|
||||
return int(valid_number(arg, min=-1, name="optional GPIO pin"))
|
||||
|
||||
|
||||
def valid_gpio_mode(arg: Any) -> str:
|
||||
return check_string_in_list(arg, "GPIO mode", ["input", "output"])
|
||||
|
||||
|
||||
def valid_gpio_channel(arg: Any) -> str:
|
||||
return check_re_match(arg, "GPIO channel", r"^[a-zA-Z_][a-zA-Z0-9_-]*$")[:255]
|
||||
|
||||
|
||||
def valid_otg_gadget(arg: Any) -> str:
|
||||
return check_re_match(arg, "OTG gadget name", r"^[a-z_][a-z0-9_-]*$")[:255]
|
||||
|
||||
|
||||
Reference in New Issue
Block a user