attempt to merge sofubi/static-type-checking, albeit incompletely
This commit is contained in:
@@ -1,11 +1,29 @@
|
||||
import sys
|
||||
from time import sleep
|
||||
|
||||
from kmk.consts import TYPING_PLATFORMS
|
||||
|
||||
if sys.platform in TYPING_PLATFORMS:
|
||||
from typing import Any, Optional
|
||||
|
||||
from kmk.keys import Key, KeyAttrDict
|
||||
from kmk.kmk_keyboard import KMKKeyboard # Avoid cyclical imports
|
||||
|
||||
|
||||
def passthrough(key, keyboard, *args, **kwargs):
|
||||
return keyboard
|
||||
|
||||
|
||||
def default_pressed(key, keyboard, KC, coord_int=None, coord_raw=None, *args, **kwargs):
|
||||
def default_pressed(
|
||||
key, # type: Key
|
||||
keyboard, # type: KMKKeyboard
|
||||
KC, # type: KeyAttrDict
|
||||
coord_int=None, # type: Optional[int]
|
||||
coord_raw=None, # type: Optional[str]
|
||||
*args, # type: Any
|
||||
**kwargs, # type: Any
|
||||
):
|
||||
# type: (...) -> KMKKeyboard
|
||||
keyboard.hid_pending = True
|
||||
|
||||
keyboard.keys_pressed.add(key)
|
||||
@@ -14,8 +32,15 @@ def default_pressed(key, keyboard, KC, coord_int=None, coord_raw=None, *args, **
|
||||
|
||||
|
||||
def default_released(
|
||||
key, keyboard, KC, coord_int=None, coord_raw=None, *args, **kwargs # NOQA
|
||||
key, # type: Key
|
||||
keyboard, # type: KMKKeyboard
|
||||
KC, # type: KeyAttrDict
|
||||
coord_int=None, # type: Optional[int]
|
||||
coord_raw=None, # type: Optional[str]
|
||||
*args, # type: Any
|
||||
**kwargs, # type: Any # NOQA
|
||||
):
|
||||
# type: (...) -> KMKKeyboard
|
||||
keyboard.hid_pending = True
|
||||
keyboard.keys_pressed.discard(key)
|
||||
|
||||
|
Reference in New Issue
Block a user