Skip to content
Snippets Groups Projects
Commit bb81b7e2 authored by Peter Hutterer's avatar Peter Hutterer
Browse files

flake8: a whole bunch of mostly whitespace fixes

parent f9968087
No related branches found
No related tags found
1 merge request!11Add a gitlab CI to run flake8
......@@ -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):
......
......@@ -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)
......@@ -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')
......@@ -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.
......
......@@ -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)
......
......@@ -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))
......
......@@ -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):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment