Reformat type hints to use comment style syntax

Update Pipfile to add typing module and pyright
Update pyproject.toml for pyright and mypy configs
This commit is contained in:
sofubi
2021-08-27 00:33:28 -04:00
parent 9fc431e0a7
commit b202dc77d1
12 changed files with 439 additions and 311 deletions

View File

@@ -1,16 +1,21 @@
from kmk.kmk_keyboard import KMKKeyboard
class InvalidExtensionEnvironment(Exception):
pass
class Extension:
_enabled = True
_enabled = True # type: bool
def enable(self, keyboard):
# type: (KMKKeyboard) -> None
self._enabled = True
self.on_runtime_enable(keyboard)
def disable(self, keyboard):
# type (KMKKeyboard) -> None
self._enabled = False
self.on_runtime_disable(keyboard)
@@ -18,34 +23,43 @@ class Extension:
# The below methods should be implemented by subclasses
def on_runtime_enable(self, keyboard):
# type: (KMKKeyboard) -> None
raise NotImplementedError
def on_runtime_disable(self, keyboard):
# type: (KMKKeyboard) -> None
raise NotImplementedError
def during_bootup(self, keyboard):
# type: (KMKKeyboard) -> None
raise NotImplementedError
def before_matrix_scan(self, keyboard):
# type: (KMKKeyboard) -> None
'''
Return value will be injected as an extra matrix update
'''
raise NotImplementedError
def after_matrix_scan(self, keyboard):
# type: (KMKKeyboard) -> None
'''
Return value will be replace matrix update if supplied
'''
raise NotImplementedError
def before_hid_send(self, keyboard):
# type: (KMKKeyboard) -> None
raise NotImplementedError
def after_hid_send(self, keyboard):
# type: (KMKKeyboard) -> None
raise NotImplementedError
def on_powersave_enable(self, keyboard):
# type: (KMKKeyboard) -> None
raise NotImplementedError
def on_powersave_disable(self, keyboard):
# type: (KMKKeyboard) -> None
raise NotImplementedError

View File

@@ -1,6 +1,7 @@
'''Adds international keys'''
from kmk.extensions import Extension
from kmk.keys import make_key
from kmk.kmk_keyboard import KMKKeyboard
class International(Extension):
@@ -32,28 +33,37 @@ class International(Extension):
make_key(code=152, names=('LANG9',))
def on_runtime_enable(self, sandbox):
# type: (KMKKeyboard) -> None
return
def on_runtime_disable(self, sandbox):
# type: (KMKKeyboard) -> None
return
def during_bootup(self, sandbox):
# type: (KMKKeyboard) -> None
return
def before_matrix_scan(self, sandbox):
# type: (KMKKeyboard) -> None
return
def after_matrix_scan(self, sandbox):
# type: (KMKKeyboard) -> None
return
def before_hid_send(self, sandbox):
# type: (KMKKeyboard) -> None
return
def after_hid_send(self, sandbox):
# type: (KMKKeyboard) -> None
return
def on_powersave_enable(self, sandbox):
# type: (KMKKeyboard) -> None
return
def on_powersave_disable(self, sandbox):
# type: (KMKKeyboard) -> None
return