Skip to content

Commit 26d4e04

Browse files
committed
keyword arguments, $variables, improved macro docs
1 parent f812710 commit 26d4e04

File tree

11 files changed

+746
-312
lines changed

11 files changed

+746
-312
lines changed

.pylintrc

+3
Original file line numberDiff line numberDiff line change
@@ -11,3 +11,6 @@ disable=
1111
# using """ for comments highlights them in green for me and makes it
1212
# a great way to separate stuff into multiple sections
1313
pointless-string-statement
14+
15+
# https://github.com/psf/black/blob/main/docs/compatible_configs/pylint/pylintrc
16+
C0330, C0326

keymapper/gui/window.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def check_add_row(self):
337337
num_maps = len(custom_mapping)
338338
if num_rows < num_maps or num_rows > num_maps + 1:
339339
logger.error(
340-
"custom_mapping contains %d rows, " "but %d are displayed",
340+
"custom_mapping contains %d rows, but %d are displayed",
341341
len(custom_mapping),
342342
num_rows,
343343
)

keymapper/injection/injector.py

+11-10
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,15 @@ def is_in_capabilities(key, capabilities):
6868
return False
6969

7070

71+
def get_udev_name(name, suffix):
72+
"""Make sure the generated name is not longer than 80 chars."""
73+
max_len = 80 # based on error messages
74+
remaining_len = max_len - len(DEV_NAME) - len(suffix) - 2
75+
middle = name[:remaining_len]
76+
name = f"{DEV_NAME} {middle} {suffix}"
77+
return name
78+
79+
7180
class Injector(multiprocessing.Process):
7281
"""Initializes, starts and stops injections.
7382
@@ -310,14 +319,6 @@ async def _msg_listener(self):
310319
loop.stop()
311320
return
312321

313-
def get_udev_name(self, name, suffix):
314-
"""Make sure the generated name is not longer than 80 chars."""
315-
max_len = 80 # based on error messages
316-
remaining_len = max_len - len(DEV_NAME) - len(suffix) - 2
317-
middle = name[:remaining_len]
318-
name = f"{DEV_NAME} {middle} {suffix}"
319-
return name
320-
321322
def run(self):
322323
"""The injection worker that keeps injecting until terminated.
323324
@@ -374,7 +375,7 @@ def run(self):
374375
# where mapped events go to.
375376
# See the Context docstring on why this is needed.
376377
self.context.uinput = evdev.UInput(
377-
name=self.get_udev_name(self.group.key, "mapped"),
378+
name=get_udev_name(self.group.key, "mapped"),
378379
phys=DEV_NAME,
379380
events=self._construct_capabilities(GAMEPAD in self.group.types),
380381
)
@@ -384,7 +385,7 @@ def run(self):
384385
# EV_ABS capability, EV_REL won't move the mouse pointer anymore.
385386
# so don't merge all InputDevices into one UInput device.
386387
forward_to = evdev.UInput(
387-
name=self.get_udev_name(source.name, "forwarded"),
388+
name=get_udev_name(source.name, "forwarded"),
388389
phys=DEV_NAME,
389390
events=self._copy_capabilities(source),
390391
)

0 commit comments

Comments
 (0)