From bb81b7e2d3cbd18bbfb3ff72d02259bd9fb803af Mon Sep 17 00:00:00 2001 From: Peter Hutterer <peter.hutterer@who-t.net> Date: Mon, 26 Aug 2019 14:56:04 +1000 Subject: [PATCH] flake8: a whole bunch of mostly whitespace fixes --- examples/evtest.py | 18 +++++++++--------- examples/kernel-device-update.py | 2 +- setup.py | 5 ++--- test/test_clib.py | 3 +++ test/test_const.py | 1 + test/test_device.py | 14 +++++++------- test/test_events.py | 3 ++- 7 files changed, 25 insertions(+), 21 deletions(-) diff --git a/examples/evtest.py b/examples/evtest.py index 4acddf7..2ded6a2 100755 --- a/examples/evtest.py +++ b/examples/evtest.py @@ -42,16 +42,16 @@ def print_capabilities(l): def print_event(e): - print("Event: time {}.{:06d}, ".format(e.sec, e.usec), end='') - if e.matches(libevdev.EV_SYN): - if e.matches(libevdev.EV_SYN.SYN_MT_REPORT): - print("++++++++++++++ {} ++++++++++++".format(e.code.name)) - elif e.matches(libevdev.EV_SYN.SYN_DROPPED): - print(">>>>>>>>>>>>>> {} >>>>>>>>>>>>".format(e.code.name)) - else: - print("-------------- {} ------------".format(e.code.name)) + print("Event: time {}.{:06d}, ".format(e.sec, e.usec), end='') + if e.matches(libevdev.EV_SYN): + if e.matches(libevdev.EV_SYN.SYN_MT_REPORT): + print("++++++++++++++ {} ++++++++++++".format(e.code.name)) + elif e.matches(libevdev.EV_SYN.SYN_DROPPED): + print(">>>>>>>>>>>>>> {} >>>>>>>>>>>>".format(e.code.name)) else: - print("type {:02x} {} code {:03x} {:20s} value {:4d}".format(e.type.value, e.type.name, e.code.value, e.code.name, e.value)) + print("-------------- {} ------------".format(e.code.name)) + else: + print("type {:02x} {} code {:03x} {:20s} value {:4d}".format(e.type.value, e.type.name, e.code.value, e.code.name, e.value)) def main(args): diff --git a/examples/kernel-device-update.py b/examples/kernel-device-update.py index 3f10c4e..f0c17f6 100755 --- a/examples/kernel-device-update.py +++ b/examples/kernel-device-update.py @@ -8,6 +8,7 @@ import sys import libevdev + def main(args): path = args[1] axis = args[2] @@ -38,4 +39,3 @@ if __name__ == "__main__": print(" <value> .. the numeric value to set the axis field to") sys.exit(1) main(sys.argv) - diff --git a/setup.py b/setup.py index 3729316..5329711 100755 --- a/setup.py +++ b/setup.py @@ -26,7 +26,6 @@ setup(name='libevdev', 'Intended Audience :: Developers', 'License :: OSI Approved :: MIT License', 'Programming Language :: Python :: 3', - ], + ], python_requires='>=3', - keywords='evdev input uinput libevdev', -) + keywords='evdev input uinput libevdev') diff --git a/test/test_clib.py b/test/test_clib.py index 0ba00cb..f63013d 100644 --- a/test/test_clib.py +++ b/test/test_clib.py @@ -8,9 +8,11 @@ from libevdev._clib import Libevdev, UinputDevice # if properties 1-4 work the others will work too if libevdev works # correctly + def is_root(): return os.getuid() == 0 + class TestNameConversion(unittest.TestCase): def test_type_max(self): @@ -445,6 +447,7 @@ class TestAbsDevice(unittest.TestCase): l.enable_property("INPUT_PROP_ACCELEROMETER") self.assertTrue(l.has_property("INPUT_PROP_ACCELEROMETER")) + class TestMTDevice(unittest.TestCase): """ Tests various things against the first MT device found. diff --git a/test/test_const.py b/test/test_const.py index 3c9ce28..90e991e 100644 --- a/test/test_const.py +++ b/test/test_const.py @@ -25,6 +25,7 @@ import unittest import libevdev from libevdev import evbit, propbit + class TestEventBits(unittest.TestCase): def test_ev_types(self): self.assertIn(libevdev.EV_SYN, libevdev.types) diff --git a/test/test_device.py b/test/test_device.py index 2de1504..f4d9b2c 100644 --- a/test/test_device.py +++ b/test/test_device.py @@ -24,16 +24,18 @@ import os import unittest import libevdev -from libevdev import evbit, propbit, InputEvent, Device, InvalidFileError, InvalidArgumentException +from libevdev import InvalidFileError, InvalidArgumentException + def is_root(): return os.getuid() == 0 + class TestDevice(unittest.TestCase): def test_device_empty(self): d = libevdev.Device() id = {'bustype': 0, 'vendor': 0, 'product': 0, 'version': 0} - syns = { libevdev.EV_SYN : libevdev.EV_SYN.codes } + syns = {libevdev.EV_SYN: libevdev.EV_SYN.codes} self.assertEqual(d.name, '') self.assertEqual(d.id, id) @@ -55,10 +57,8 @@ class TestDevice(unittest.TestCase): for c in t.codes: self.assertFalse(d.has(c)) self.assertIsNone(d.value[c]) - - d.disable(c) # noop - - d.disable(t) # noop + d.disable(c) # noop + d.disable(t) # noop for p in libevdev.props: self.assertFalse(d.has_property(p)) @@ -232,7 +232,7 @@ class TestDevice(unittest.TestCase): self.assertEqual(d.properties, props) for p in libevdev.props: - if not p in props: + if p not in props: self.assertFalse(d.has_property(p)) else: self.assertTrue(d.has_property(p)) diff --git a/test/test_events.py b/test/test_events.py index 361b9ab..dead784 100644 --- a/test/test_events.py +++ b/test/test_events.py @@ -23,7 +23,8 @@ import unittest import libevdev -from libevdev import evbit, propbit, InputEvent +from libevdev import InputEvent + class TestEvents(unittest.TestCase): def test_event_matches_type(self): -- GitLab