Commit 36c79c7f authored by Valentin Rothberg's avatar Valentin Rothberg Committed by Greg Kroah-Hartman

checkkconfigsymbols.py: fix pylint and pep8 warnings

Fix pylint and pep8 warnings to have a consistent syntax and style.
Signed-off-by: default avatarValentin Rothberg <valentinrothberg@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 14390e31
...@@ -16,7 +16,6 @@ import signal ...@@ -16,7 +16,6 @@ import signal
import subprocess import subprocess
import sys import sys
from multiprocessing import Pool, cpu_count from multiprocessing import Pool, cpu_count
from subprocess import Popen, PIPE, STDOUT
# regex expressions # regex expressions
...@@ -118,8 +117,8 @@ def main(): ...@@ -118,8 +117,8 @@ def main():
"""Main function of this module.""" """Main function of this module."""
args = parse_options() args = parse_options()
global color global COLOR
color = args.color and sys.stdout.isatty() COLOR = args.color and sys.stdout.isatty()
if args.sim and not args.commit and not args.diff: if args.sim and not args.commit and not args.diff:
sims = find_sims(args.sim, args.ignore) sims = find_sims(args.sim, args.ignore)
...@@ -160,7 +159,7 @@ def main(): ...@@ -160,7 +159,7 @@ def main():
# report cases that are present for the commit but not before # report cases that are present for the commit but not before
for feature in sorted(undefined_b): for feature in sorted(undefined_b):
# feature has not been undefined before # feature has not been undefined before
if not feature in undefined_a: if feature not in undefined_a:
files = sorted(undefined_b.get(feature)) files = sorted(undefined_b.get(feature))
undefined[feature] = files undefined[feature] = files
# check if there are new files that reference the undefined feature # check if there are new files that reference the undefined feature
...@@ -207,14 +206,14 @@ def yel(string): ...@@ -207,14 +206,14 @@ def yel(string):
""" """
Color %string yellow. Color %string yellow.
""" """
return "\033[33m%s\033[0m" % string if color else string return "\033[33m%s\033[0m" % string if COLOR else string
def red(string): def red(string):
""" """
Color %string red. Color %string red.
""" """
return "\033[31m%s\033[0m" % string if color else string return "\033[31m%s\033[0m" % string if COLOR else string
def execute(cmd): def execute(cmd):
...@@ -261,7 +260,7 @@ def init_worker(): ...@@ -261,7 +260,7 @@ def init_worker():
signal.signal(signal.SIGINT, signal.SIG_IGN) signal.signal(signal.SIGINT, signal.SIG_IGN)
def find_sims(symbol, ignore, defined = []): def find_sims(symbol, ignore, defined=[]):
"""Return a list of max. ten Kconfig symbols that are string-similar to """Return a list of max. ten Kconfig symbols that are string-similar to
@symbol.""" @symbol."""
if defined: if defined:
...@@ -335,7 +334,6 @@ def check_symbols_helper(pool, ignore): ...@@ -335,7 +334,6 @@ def check_symbols_helper(pool, ignore):
for res in pool.map(parse_source_files, arglist): for res in pool.map(parse_source_files, arglist):
referenced_features.update(res) referenced_features.update(res)
# parse kconfig files # parse kconfig files
arglist = [] arglist = []
for part in partition(kconfig_files, cpu_count()): for part in partition(kconfig_files, cpu_count()):
...@@ -389,7 +387,7 @@ def parse_source_file(sfile): ...@@ -389,7 +387,7 @@ def parse_source_file(sfile):
lines = stream.readlines() lines = stream.readlines()
for line in lines: for line in lines:
if not "CONFIG_" in line: if "CONFIG_" not in line:
continue continue
features = REGEX_SOURCE_FEATURE.findall(line) features = REGEX_SOURCE_FEATURE.findall(line)
for feature in features: for feature in features:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment