From a691568eede855e584b5675004f3706fa5e20454 Mon Sep 17 00:00:00 2001 From: sezanzeb Date: Sun, 14 Feb 2021 12:34:56 +0100 Subject: [PATCH] minor cleanup --- .pylintrc | 4 ++++ keymapper/injection/injector.py | 20 +++++++------------- keymapper/key.py | 2 +- keymapper/logger.py | 3 +++ readme/pylint.svg | 4 ++-- 5 files changed, 17 insertions(+), 16 deletions(-) diff --git a/.pylintrc b/.pylintrc index 6df8f536..e865c706 100644 --- a/.pylintrc +++ b/.pylintrc @@ -3,3 +3,7 @@ disable= # that is the standard way to import GTK afaik wrong-import-position + + # using """ for comments highlights them in green for me and makes it + # a great way to separate stuff into multiple sections + pointless-string-statement \ No newline at end of file diff --git a/keymapper/injection/injector.py b/keymapper/injection/injector.py index e844f011..90b1b93f 100644 --- a/keymapper/injection/injector.py +++ b/keymapper/injection/injector.py @@ -98,7 +98,7 @@ class Injector(multiprocessing.Process): super().__init__() - # Functions to interact with the running process: + """Functions to interact with the running process""" def get_state(self): """Get the state of the injection. @@ -141,7 +141,7 @@ class Injector(multiprocessing.Process): self._msg_pipe[1].send(CLOSE) self._state = STOPPED - # Process internal stuff: + """Process internal stuff""" def _grab_device(self, path): """Try to grab the device, return None if not needed/possible.""" @@ -206,7 +206,10 @@ class Injector(multiprocessing.Process): ---------- input_device : evdev.InputDevice gamepad : bool - if ABS capabilities should be removed in favor of REL + If ABS capabilities should be removed in favor of REL. + This parameter is somewhat redundant and could be derived + from input_device, but it is very useful to control this in + tests. Returns ------- @@ -383,12 +386,6 @@ class Injector(multiprocessing.Process): # reached otherwise. logger.debug('asyncio coroutines ended') - def _macro_write(self, code, value, uinput): - """Handler for macros.""" - logger.spam('macro writes %s', (EV_KEY, code, value)) - uinput.write(EV_KEY, code, value) - uinput.syn() - async def _event_consumer(self, source, uinput): """Reads input events to inject keycodes or talk to the event_producer. @@ -440,7 +437,4 @@ class Injector(multiprocessing.Process): uinput.write(event.type, event.code, event.value) # this already includes SYN events, so need to syn here again - logger.error( - 'The consumer for "%s" stopped early', - source.path - ) + logger.error('The consumer for "%s" stopped early', source.path) diff --git a/keymapper/key.py b/keymapper/key.py index 4d31bb7e..52b8a697 100644 --- a/keymapper/key.py +++ b/keymapper/key.py @@ -76,7 +76,7 @@ class Key: flattened = () for key in keys: if isinstance(key, Key): - flattened += key.keys + flattened += key.keys # pylint: disable=no-member else: flattened += (key,) keys = flattened diff --git a/keymapper/logger.py b/keymapper/logger.py index 59e039ec..ab18ae9e 100644 --- a/keymapper/logger.py +++ b/keymapper/logger.py @@ -174,6 +174,9 @@ def update_verbosity(debug): Also enable rich tracebacks in debug mode. """ + # pylint really doesn't like what I'm doing with rich.traceback here + # pylint: disable=broad-except,import-error,import-outside-toplevel + if debug: logger.setLevel(SPAM) diff --git a/readme/pylint.svg b/readme/pylint.svg index bde3a939..a8977660 100644 --- a/readme/pylint.svg +++ b/readme/pylint.svg @@ -17,7 +17,7 @@ pylint - 9.76 - 9.76 + 9.81 + 9.81 \ No newline at end of file