mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-01-29 00:51:53 +08:00
new typing style
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user