Fix flake8 warnings (#678)

The only notable one here is the regex that had an escape sequence

Signed-off-by: Peter Hutterer <peter.hutterer@who-t.net>
This commit is contained in:
Peter Hutterer
2019-03-12 15:49:54 +10:00
committed by Jente Hidskes
parent 836922b133
commit 11db35edba
3 changed files with 8 additions and 11 deletions

View File

@@ -26,9 +26,9 @@
#
import argparse
import os
import configparser
def assertIn(element, l):
if element not in l:
raise AssertionError('{} must be in {}'.format(element, l))
@@ -61,7 +61,7 @@ def check_ledtypes_str(string):
types = string.split(';')
for t in types:
if not t: # emtpy string if trailing ;
if not t: # emtpy string if trailing ;
continue
assertIn(t, permitted_types)
@@ -88,7 +88,7 @@ def check_section_device(section):
def check_dpi_range_str(string):
import re
m = re.search('^([0-9]+):([0-9]+)@([0-9\.]+)$', string)
m = re.search('^([0-9]+):([0-9]+)@([0-9.]+)$', string)
assert(m is not None)
min = int(m.group(1))
max = int(m.group(2))

View File

@@ -152,6 +152,3 @@ texinfo_documents = [
author, '@PACKAGE_NAME@', 'One line description of project.',
'Miscellaneous'),
]

View File

@@ -31,8 +31,8 @@ import sys
def print_ratbagctl(ratbagctl_path, ratbagd_path, version_string):
with open(ratbagctl_path, 'r', encoding='utf-8') as ratbagctl, open(ratbagd_path, 'r', encoding='utf-8') as ratbagd:
for l in ratbagctl.readlines():
if l.startswith("from ratbagd import "):
for line in ratbagctl.readlines():
if line.startswith("from ratbagd import "):
headers = True
for r in ratbagd.readlines():
if not r.startswith('#') and r.strip():
@@ -40,9 +40,9 @@ def print_ratbagctl(ratbagctl_path, ratbagd_path, version_string):
if not headers:
print(r.rstrip('\n'))
else:
if '@version@' in l:
l = l.replace('@version@', version_string)
print(l.rstrip('\n'))
if '@version@' in line:
line = line.replace('@version@', version_string)
print(line.rstrip('\n'))
def main(argv):