From d93cce86fa5a70e4b9a34ce72cff308a6d35548b Mon Sep 17 00:00:00 2001 From: sezanzeb Date: Sat, 28 Nov 2020 19:31:57 +0100 Subject: [PATCH] linting --- keymapper/data.py | 2 +- keymapper/dev/injector.py | 4 ++-- keymapper/dev/macros.py | 14 +++++++------- keymapper/dev/permissions.py | 2 +- keymapper/gtk/window.py | 2 +- readme/pylint.svg | 12 ++++++------ tests/testcases/macros.py | 4 ++-- 7 files changed, 20 insertions(+), 20 deletions(-) diff --git a/keymapper/data.py b/keymapper/data.py index 18cb6c93..f4f9fd17 100644 --- a/keymapper/data.py +++ b/keymapper/data.py @@ -33,7 +33,7 @@ def get_data_path(filename=''): # depending on where this file is installed to, make sure to use the proper # prefix path for data - # https://docs.python.org/3/distutils/setupscript.html?highlight=package_data#installing-additional-files # noqa + # https://docs.python.org/3/distutils/setupscript.html?highlight=package_data#installing-additional-files # noqa pylint: disable=line-too-long if source_path.startswith(site.USER_BASE): data_path = os.path.join(site.USER_BASE, 'share/key-mapper') elif source_path.startswith('/usr/local/'): diff --git a/keymapper/dev/injector.py b/keymapper/dev/injector.py index ba4cc955..1ca5214e 100644 --- a/keymapper/dev/injector.py +++ b/keymapper/dev/injector.py @@ -274,8 +274,8 @@ class KeycodeInjector: handler=lambda keycode, value: ( self._write( keymapper_device, - target_keycode, - event.value + keycode, + value ) ) ).run() diff --git a/keymapper/dev/macros.py b/keymapper/dev/macros.py index fc37e916..4f96f236 100644 --- a/keymapper/dev/macros.py +++ b/keymapper/dev/macros.py @@ -101,12 +101,12 @@ class _Macro: self.tasks.append(lambda: self.handler(character, 0)) return self - def wait(self, min, max=None): + def wait(self, min_time, max_time=None): """Wait a random time in milliseconds""" - if max is None: - sleeptime = min + if max_time is None: + sleeptime = min_time else: - sleeptime = random.random() * (max - min) + min + sleeptime = random.random() * (max_time - min_time) + min_time self.tasks.append(lambda: time.sleep(sleeptime / 1000)) return self @@ -188,7 +188,7 @@ def _parse_recurse(macro, handler, macro_instance=None, depth=0): } if functions.get(call) is None: - logger.error(f'Unknown function %s', call) + logger.error('Unknown function %s', call) # get all the stuff inbetween brackets = 0 @@ -203,14 +203,14 @@ def _parse_recurse(macro, handler, macro_instance=None, depth=0): if char == ')': brackets -= 1 if brackets < 0: - logger.error(f'There is one ")" too much at %s', position) + logger.error('There is one ")" too much at %s', position) return if brackets == 0: # the closing bracket of the call break if brackets != 0: - logger.error(f'There are %s closing brackets missing', brackets) + logger.error('There are %s closing brackets missing', brackets) inner = macro[2:position - 1] diff --git a/keymapper/dev/permissions.py b/keymapper/dev/permissions.py index 1dc65a74..dfab08f4 100644 --- a/keymapper/dev/permissions.py +++ b/keymapper/dev/permissions.py @@ -40,7 +40,7 @@ def can_read_devices(): def warn(group): logger.warning( 'Some devices may not be visible without being in the ' - f'"%s" user group. Try `sudo usermod -a -G %s $USER` ' + '"%s" user group. Try `sudo usermod -a -G %s $USER` ' 'and log out and back in.', group, group diff --git a/keymapper/gtk/window.py b/keymapper/gtk/window.py index 3bf58a18..3ea2076b 100755 --- a/keymapper/gtk/window.py +++ b/keymapper/gtk/window.py @@ -225,7 +225,7 @@ class Window: self.dbus.stop_injecting(self.selected_device) self.get('status_bar').push( CTX_APPLY, - f'Applied the system default' + 'Applied the system default' ) # restart reading because after injecting the device landscape # changes a bit diff --git a/readme/pylint.svg b/readme/pylint.svg index 7ba65756..bfc215bd 100644 --- a/readme/pylint.svg +++ b/readme/pylint.svg @@ -1,23 +1,23 @@ - + - + - - + + pylint pylint - 9.6 - 9.6 + 9.77 + 9.77 \ No newline at end of file diff --git a/tests/testcases/macros.py b/tests/testcases/macros.py index db1bd2cc..de2def5f 100644 --- a/tests/testcases/macros.py +++ b/tests/testcases/macros.py @@ -37,9 +37,9 @@ class TestMacros(unittest.TestCase): self.assertListEqual(self.result, [(1, 1), (1, 0)]) def test_1(self): - parse('k(1).k(a).k(3)', self.handler).run() + parse('k(1 2).k(a).k(3)', self.handler).run() self.assertListEqual(self.result, [ - (1, 1), (1, 0), + ('1 2', 1), ('1 2', 0), ('a', 1), ('a', 0), (3, 1), (3, 0), ])