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/apps/otg | |
parent | 4b75221e9470b4a009955d7677f16adf8e23e302 (diff) |
new typing style
Diffstat (limited to 'kvmd/apps/otg')
-rw-r--r-- | kvmd/apps/otg/__init__.py | 8 | ||||
-rw-r--r-- | kvmd/apps/otg/hid/keyboard.py | 4 | ||||
-rw-r--r-- | kvmd/apps/otg/hid/mouse.py | 8 |
3 files changed, 6 insertions, 14 deletions
diff --git a/kvmd/apps/otg/__init__.py b/kvmd/apps/otg/__init__.py index 9b6f5e69..4c811d2b 100644 --- a/kvmd/apps/otg/__init__.py +++ b/kvmd/apps/otg/__init__.py @@ -29,10 +29,6 @@ import argparse from os.path import join # pylint: disable=ungrouped-imports -from typing import List -from typing import Optional -from typing import Union - from ...logging import get_logger from ...yamlconf import Section @@ -78,7 +74,7 @@ def _unlink(path: str, optional: bool=False) -> None: os.unlink(path) -def _write(path: str, value: Union[str, int], optional: bool=False) -> None: +def _write(path: str, value: (str | int), optional: bool=False) -> None: logger = get_logger() if optional and not os.access(path, os.F_OK): logger.info("WRITE --- [SKIPPED] %s", path) @@ -320,7 +316,7 @@ def _cmd_stop(config: Section) -> None: # ===== -def main(argv: Optional[List[str]]=None) -> None: +def main(argv: (list[str] | None)=None) -> None: (parent_parser, argv, config) = init( add_help=False, argv=argv, diff --git a/kvmd/apps/otg/hid/keyboard.py b/kvmd/apps/otg/hid/keyboard.py index d10a4b73..6a4d0184 100644 --- a/kvmd/apps/otg/hid/keyboard.py +++ b/kvmd/apps/otg/hid/keyboard.py @@ -20,13 +20,11 @@ # ========================================================================== # -from typing import Optional - from . import Hid # ===== -def make_keyboard_hid(report_id: Optional[int]=None) -> Hid: +def make_keyboard_hid(report_id: (int | None)=None) -> Hid: return Hid( protocol=1, # Keyboard protocol subclass=1, # Boot interface subclass diff --git a/kvmd/apps/otg/hid/mouse.py b/kvmd/apps/otg/hid/mouse.py index 71249569..e0f7350b 100644 --- a/kvmd/apps/otg/hid/mouse.py +++ b/kvmd/apps/otg/hid/mouse.py @@ -20,13 +20,11 @@ # ========================================================================== # -from typing import Optional - from . import Hid # ===== -def make_mouse_hid(absolute: bool, horizontal_wheel: bool, report_id: Optional[int]=None) -> Hid: +def make_mouse_hid(absolute: bool, horizontal_wheel: bool, report_id: (int | None)=None) -> Hid: maker = (_make_absolute_hid if absolute else _make_relative_hid) return maker(horizontal_wheel, report_id) @@ -42,7 +40,7 @@ _HORIZONTAL_WHEEL = [ ] -def _make_absolute_hid(horizontal_wheel: bool, report_id: Optional[int]) -> Hid: +def _make_absolute_hid(horizontal_wheel: bool, report_id: (int | None)) -> Hid: return Hid( protocol=0, # None protocol subclass=0, # No subclass @@ -106,7 +104,7 @@ def _make_absolute_hid(horizontal_wheel: bool, report_id: Optional[int]) -> Hid: ) -def _make_relative_hid(horizontal_wheel: bool, report_id: Optional[int]) -> Hid: +def _make_relative_hid(horizontal_wheel: bool, report_id: (int | None)) -> Hid: return Hid( protocol=2, # Mouse protocol subclass=1, # Boot interface subclass |