Fix some flake8 warnings

$> flake8-3 tools/ratbagctl.devel.in tools/ratbagctl.in tools/ratbagctl.test.in .
tools/ratbagctl.in:166:1: E302 expected 2 blank lines, found 1
tools/ratbagctl.in:173:25: E201 whitespace after '['
tools/ratbagctl.in:173:68: E202 whitespace before ']'
tools/ratbagctl.in:314:1: E302 expected 2 blank lines, found 1
tools/ratbagctl.in:318:1: E302 expected 2 blank lines, found 1
tools/ratbagctl.test.in:281:43: E261 at least two spaces before inline comment
tools/ratbagctl.test.in:302:31: E261 at least two spaces before inline comment
tools/ratbagctl.test.in:306:43: E261 at least two spaces before inline comment
tools/ratbagctl.test.in:337:43: E261 at least two spaces before inline comment
tools/ratbagctl.test.in:576:1: E302 expected 2 blank lines, found 1

Signed-off-by: Benjamin Tissoires <benjamin.tissoires@gmail.com>
This commit is contained in:
Benjamin Tissoires
2017-10-16 19:00:00 +02:00
parent f1d20f1f35
commit 366fbc3fda
2 changed files with 9 additions and 5 deletions

View File

@@ -163,6 +163,7 @@ def print_led(d, p, l, level):
l.effect_rate,
l.brightness))
def print_led_caps(d, p, l, level):
leds = {
RatbagdLed.MODE_BREATHING: "breathing",
@@ -170,7 +171,7 @@ def print_led_caps(d, p, l, level):
RatbagdLed.MODE_OFF: "off",
RatbagdLed.MODE_ON: "on",
}
supported = sorted([ v for k, v in leds.items() if k in l.modes ])
supported = sorted([v for k, v in leds.items() if k in l.modes])
print(" " * level + "Modes: {}".format(", ".join(supported)))
@@ -311,10 +312,12 @@ def func_led_get(r, args):
l, p, d = find_led(r, args)
print_led(d, p, l, 0)
def func_led_caps(r, args):
l, p, d = find_led(r, args)
print_led_caps(d, p, l, 0)
def func_led_set(r, args):
l, p, d = find_led(r, args)
try:

View File

@@ -278,7 +278,7 @@ class TestRatbagCtlDPI(TestRatbagCtl):
def test_dpi_get(self):
command = "DPI get"
r = self.launch_good_test(command + " test_device")
self.assertEqual(int(r[:-3]), 200) # drop 'dpi' suffix
self.assertEqual(int(r[:-3]), 200) # drop 'dpi' suffix
self.setProfile(1)
r = self.launch_good_test(command + " test_device")
self.assertEqual(r, "1300x1400dpi")
@@ -299,11 +299,11 @@ class TestRatbagCtlDPI(TestRatbagCtl):
command = "DPI set"
self.setProfile(0)
r = self.launch_good_test("DPI get test_device")
res = int(r[:-3]) + 50 # drop 'dpi' suffix
res = int(r[:-3]) + 50 # drop 'dpi' suffix
r = self.launch_good_test(command + " {} test_device".format(res))
self.assertEqual(r, '')
r = self.launch_good_test("DPI get test_device")
self.assertEqual(int(r[:-3]), res) # drop 'dpi' suffix
self.assertEqual(int(r[:-3]), res) # drop 'dpi' suffix
self.launch_fail_test(command)
self.launch_fail_test(command + " X test_device")
self.launch_fail_test(command + " 100 test_device X")
@@ -334,7 +334,7 @@ class TestRatbagCtlDPI(TestRatbagCtl):
r = self.launch_good_test("Profile 1 Resolution 1 DPI get test_device")
self.assertEqual(r, "1200x1300dpi")
r = self.launch_good_test("Resolution 2 DPI get test_device")
self.assertEqual(int(r[:-3]), 300) # drop 'dpi' suffix
self.assertEqual(int(r[:-3]), 300) # drop 'dpi' suffix
self.launch_fail_test("Profile 1 Profile 1 DPI get test_device")
self.launch_fail_test("Profile 1 Resolution 1 Resolution 2 DPI get test_device")
@@ -573,6 +573,7 @@ class TestRatbagCtlLED(TestRatbagCtl):
r = self.launch_good_test("led 1 capabilities test_device")
self.assertEqual(r, "Modes: breathing, cycle, off, on")
def setUpModule():
global ratbagd_process, ratbagd, parser