diff options
author | Maxim Devaev <[email protected]> | 2022-09-04 18:08:40 +0300 |
---|---|---|
committer | Maxim Devaev <[email protected]> | 2022-09-04 18:08:40 +0300 |
commit | ee3e224e396494cd0d69bb6167087a071a20349c (patch) | |
tree | 5becd28570e58a03c6e1e231d0db24c264a73f88 /kvmd/plugins/ugpio/gpio.py | |
parent | 4b75221e9470b4a009955d7677f16adf8e23e302 (diff) |
new typing style
Diffstat (limited to 'kvmd/plugins/ugpio/gpio.py')
-rw-r--r-- | kvmd/plugins/ugpio/gpio.py | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/kvmd/plugins/ugpio/gpio.py b/kvmd/plugins/ugpio/gpio.py index 692ee884..4e4533ed 100644 --- a/kvmd/plugins/ugpio/gpio.py +++ b/kvmd/plugins/ugpio/gpio.py @@ -20,9 +20,7 @@ # ========================================================================== # -from typing import Dict from typing import Callable -from typing import Optional from typing import Any import gpiod @@ -52,16 +50,16 @@ class Plugin(BaseUserGpioDriver): self.__device_path = device_path - self.__input_pins: Dict[int, aiogp.AioReaderPinParams] = {} - self.__output_pins: Dict[int, Optional[bool]] = {} + self.__input_pins: dict[int, aiogp.AioReaderPinParams] = {} + self.__output_pins: dict[int, (bool | None)] = {} - self.__reader: Optional[aiogp.AioReader] = None + self.__reader: (aiogp.AioReader | None) = None - self.__chip: Optional[gpiod.Chip] = None - self.__output_lines: Dict[int, gpiod.Line] = {} + self.__chip: (gpiod.Chip | None) = None + self.__output_lines: dict[int, gpiod.Line] = {} @classmethod - def get_plugin_options(cls) -> Dict: + def get_plugin_options(cls) -> dict: return { "device": Option("/dev/gpiochip0", type=valid_abs_path, unpack_as="device_path"), } @@ -73,7 +71,7 @@ class Plugin(BaseUserGpioDriver): def register_input(self, pin: str, debounce: float) -> None: self.__input_pins[int(pin)] = aiogp.AioReaderPinParams(False, debounce) - def register_output(self, pin: str, initial: Optional[bool]) -> None: + def register_output(self, pin: str, initial: (bool | None)) -> None: self.__output_pins[int(pin)] = initial def prepare(self) -> None: |