diff options
author | Valentin Rothberg <valentinrothberg@gmail.com> | 2016-08-28 02:51:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2016-08-28 05:08:34 -0400 |
commit | 36c79c7face54ca10e2b57f42cfc956a53246c10 (patch) | |
tree | 0fcadeb632e65ad462ca2a68e876fd722f32dc78 /scripts/checkkconfigsymbols.py | |
parent | 14390e31641e6fb482ad75b7f46bc54d798f8b87 (diff) |
checkkconfigsymbols.py: fix pylint and pep8 warnings
Fix pylint and pep8 warnings to have a consistent syntax and style.
Signed-off-by: Valentin Rothberg <valentinrothberg@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'scripts/checkkconfigsymbols.py')
-rwxr-xr-x | scripts/checkkconfigsymbols.py | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/scripts/checkkconfigsymbols.py b/scripts/checkkconfigsymbols.py index 322c5e817b4c..4111746b5110 100755 --- a/scripts/checkkconfigsymbols.py +++ b/scripts/checkkconfigsymbols.py | |||
@@ -16,7 +16,6 @@ import signal | |||
16 | import subprocess | 16 | import subprocess |
17 | import sys | 17 | import sys |
18 | from multiprocessing import Pool, cpu_count | 18 | from multiprocessing import Pool, cpu_count |
19 | from subprocess import Popen, PIPE, STDOUT | ||
20 | 19 | ||
21 | 20 | ||
22 | # regex expressions | 21 | # regex expressions |
@@ -118,8 +117,8 @@ def main(): | |||
118 | """Main function of this module.""" | 117 | """Main function of this module.""" |
119 | args = parse_options() | 118 | args = parse_options() |
120 | 119 | ||
121 | global color | 120 | global COLOR |
122 | color = args.color and sys.stdout.isatty() | 121 | COLOR = args.color and sys.stdout.isatty() |
123 | 122 | ||
124 | if args.sim and not args.commit and not args.diff: | 123 | if args.sim and not args.commit and not args.diff: |
125 | sims = find_sims(args.sim, args.ignore) | 124 | sims = find_sims(args.sim, args.ignore) |
@@ -160,7 +159,7 @@ def main(): | |||
160 | # report cases that are present for the commit but not before | 159 | # report cases that are present for the commit but not before |
161 | for feature in sorted(undefined_b): | 160 | for feature in sorted(undefined_b): |
162 | # feature has not been undefined before | 161 | # feature has not been undefined before |
163 | if not feature in undefined_a: | 162 | if feature not in undefined_a: |
164 | files = sorted(undefined_b.get(feature)) | 163 | files = sorted(undefined_b.get(feature)) |
165 | undefined[feature] = files | 164 | undefined[feature] = files |
166 | # check if there are new files that reference the undefined feature | 165 | # check if there are new files that reference the undefined feature |
@@ -200,21 +199,21 @@ def main(): | |||
200 | print("\t- %s (\"%s\")" % (yel(commit[0]), commit[1])) | 199 | print("\t- %s (\"%s\")" % (yel(commit[0]), commit[1])) |
201 | else: | 200 | else: |
202 | print("\t- no commit found") | 201 | print("\t- no commit found") |
203 | print() # new line | 202 | print() # new line |
204 | 203 | ||
205 | 204 | ||
206 | def yel(string): | 205 | def yel(string): |
207 | """ | 206 | """ |
208 | Color %string yellow. | 207 | Color %string yellow. |
209 | """ | 208 | """ |
210 | return "\033[33m%s\033[0m" % string if color else string | 209 | return "\033[33m%s\033[0m" % string if COLOR else string |
211 | 210 | ||
212 | 211 | ||
213 | def red(string): | 212 | def red(string): |
214 | """ | 213 | """ |
215 | Color %string red. | 214 | Color %string red. |
216 | """ | 215 | """ |
217 | return "\033[31m%s\033[0m" % string if color else string | 216 | return "\033[31m%s\033[0m" % string if COLOR else string |
218 | 217 | ||
219 | 218 | ||
220 | def execute(cmd): | 219 | def execute(cmd): |
@@ -261,7 +260,7 @@ def init_worker(): | |||
261 | signal.signal(signal.SIGINT, signal.SIG_IGN) | 260 | signal.signal(signal.SIGINT, signal.SIG_IGN) |
262 | 261 | ||
263 | 262 | ||
264 | def find_sims(symbol, ignore, defined = []): | 263 | def find_sims(symbol, ignore, defined=[]): |
265 | """Return a list of max. ten Kconfig symbols that are string-similar to | 264 | """Return a list of max. ten Kconfig symbols that are string-similar to |
266 | @symbol.""" | 265 | @symbol.""" |
267 | if defined: | 266 | if defined: |
@@ -335,7 +334,6 @@ def check_symbols_helper(pool, ignore): | |||
335 | for res in pool.map(parse_source_files, arglist): | 334 | for res in pool.map(parse_source_files, arglist): |
336 | referenced_features.update(res) | 335 | referenced_features.update(res) |
337 | 336 | ||
338 | |||
339 | # parse kconfig files | 337 | # parse kconfig files |
340 | arglist = [] | 338 | arglist = [] |
341 | for part in partition(kconfig_files, cpu_count()): | 339 | for part in partition(kconfig_files, cpu_count()): |
@@ -389,7 +387,7 @@ def parse_source_file(sfile): | |||
389 | lines = stream.readlines() | 387 | lines = stream.readlines() |
390 | 388 | ||
391 | for line in lines: | 389 | for line in lines: |
392 | if not "CONFIG_" in line: | 390 | if "CONFIG_" not in line: |
393 | continue | 391 | continue |
394 | features = REGEX_SOURCE_FEATURE.findall(line) | 392 | features = REGEX_SOURCE_FEATURE.findall(line) |
395 | for feature in features: | 393 | for feature in features: |