From f297ba33e99324b30355a5e935717936fe527927 Mon Sep 17 00:00:00 2001 From: Simon Glass Date: Sat, 23 Sep 2023 13:44:05 -0600 Subject: [PATCH] moveconfig: Fix misc pylint warnings Fix various remaining pylint warnings. Signed-off-by: Simon Glass --- tools/moveconfig.py | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index 9b71659695..727a5d6df8 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -233,8 +233,7 @@ def read_file(fname, as_lines=True, skip_unicode=False): try: if as_lines: return [line.rstrip('\n') for line in inf.readlines()] - else: - return inf.read() + return inf.read() except UnicodeDecodeError as exc: if not skip_unicode: raise @@ -426,7 +425,7 @@ class Slot: If the subprocess is still running, wait until it finishes. """ if self.state != STATE_IDLE: - while self.proc.poll() == None: + while self.proc.poll() is None: pass shutil.rmtree(self.build_dir) @@ -471,7 +470,7 @@ class Slot: if self.state == STATE_IDLE: return True - if self.proc.poll() == None: + if self.proc.poll() is None: return False if self.proc.poll() != 0: @@ -494,7 +493,7 @@ class Slot: else: sys.exit('Internal Error. This should not happen.') - return True if self.state == STATE_IDLE else False + return self.state == STATE_IDLE def handle_error(self): """Handle error cases.""" @@ -521,13 +520,13 @@ class Slot: arch = self.parser.get_arch() try: - toolchain = self.toolchains.Select(arch) + tchain = self.toolchains.Select(arch) except ValueError: self.log += color_text(self.args.color, COLOR_YELLOW, f"Tool chain for '{arch}' is missing. Do nothing.\n") self.finish(False) return - env = toolchain.MakeEnvironment(False) + env = tchain.MakeEnvironment(False) cmd = list(self.make_cmd) cmd.append('KCONFIG_IGNORE_DUPLICATES=1') @@ -1004,7 +1003,7 @@ def do_imply_config(config_list, add_imply, imply_flags, skip_added, # skip imply_config because prev is a superset skip = True break - elif count > prev_count: + if count > prev_count: # delete prev because imply_config is a superset del imply_configs[prev] if not skip: @@ -1540,7 +1539,7 @@ doc/develop/moveconfig.rst for documentation.''' if args.scan_source: do_scan_source(os.getcwd(), args.update) - return + return 0 if not any((args.force_sync, args.build_db, args.imply, args.find)): parser.print_usage() @@ -1570,11 +1569,11 @@ doc/develop/moveconfig.rst for documentation.''' imply_flags |= IMPLY_FLAGS[flag][0] do_imply_config(configs, args.add_imply, imply_flags, args.skip_added) - return + return 0 if args.find: do_find_config(configs) - return + return 0 # We are either building the database or forcing a sync of defconfigs config_db = {} @@ -1610,6 +1609,8 @@ doc/develop/moveconfig.rst for documentation.''' for config in sorted(configs.keys()): outf.write(f' {config}={configs[config]}\n') outf.write('\n') + return 0 + if __name__ == '__main__': sys.exit(main()) -- 2.39.5