From patchwork Thu Aug 10 16:31:44 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1819959 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.a=rsa-sha256 header.s=google header.b=Qf8lgMwn; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4RMCF61yfJz1yfB for ; Fri, 11 Aug 2023 02:34:34 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 9E8D78691E; Thu, 10 Aug 2023 18:32:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Qf8lgMwn"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 45B68867D0; Thu, 10 Aug 2023 18:32:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-il1-x12d.google.com (mail-il1-x12d.google.com [IPv6:2607:f8b0:4864:20::12d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 24433868BB for ; Thu, 10 Aug 2023 18:32:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@chromium.org Received: by mail-il1-x12d.google.com with SMTP id e9e14a558f8ab-34995e5b4bfso1645735ab.1 for ; Thu, 10 Aug 2023 09:32:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; t=1691685149; x=1692289949; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=oo4YSQGppuq29LbLOMdht4HDyrJxIP7Xa0+KZE7BtJI=; b=Qf8lgMwnabYNiKgQ+cEesaU5Pk23ii/NXA29UyxyidAov8JoyJd0XGn/WiMdBOdkyf pteUr7NxnkiHnha+buUQgLj2VI0TS7yNI7otp+U+jHvew+ST1PKizYra8Edp1tqbLzUh GFvpgtiQuTa7FoUSAYZX5ematEc4wRn5asAl0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1691685149; x=1692289949; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=oo4YSQGppuq29LbLOMdht4HDyrJxIP7Xa0+KZE7BtJI=; b=jJBBnrw4CFfMfr2TcBrPBEQZuxpAbHM/Ay70toawqsHSspACPPEzfFgfjkYbqHApvR cNhHn/5ReP3h01bKqnllQ6Xk+531Yjq87iV/Pp6AsyjtNBaogCMNHfMVRhj7laDRi4OH Mfhm5jhgFwFkjhxQ53/9Jjgd7qgaCsu/4jOFr3xEGmZWcB9ky5N9JhBnY+hzmEUGfGs0 kIf+omK7j8QnTf5OfNcb7Fc4BSEpTYN+z0zakob58E/40lc5rMtwouBRMPfDNxIvqfS3 nR2m4VsB+wLNVFAE5K5PHJHkuD3PVI5aryKA1wVwPJuy5N6XV0DM91qqVIXEsL8ANNun N21A== X-Gm-Message-State: AOJu0Yz3EtOqYj0fzG0ILQ9hD2UhM6/wilpMivNGcHw4+Q9lvCQlHiz+ 9u9+Fpc2+EByqL9SOkeA8fVrJKuJl9zFAUS+p5s= X-Google-Smtp-Source: AGHT+IHFmDccdzV43eOtIPkZXVU0jIKzkyctOrMJmNOUyunwbrz37J/q1c1bCgrztgiwME8u2eFzcg== X-Received: by 2002:a92:cd81:0:b0:349:785:adad with SMTP id r1-20020a92cd81000000b003490785adadmr4057539ilb.10.1691685149672; Thu, 10 Aug 2023 09:32:29 -0700 (PDT) Received: from kea.bld.corp.google.com ([2620:15c:183:200:e0a2:950d:33f0:fddc]) by smtp.gmail.com with ESMTPSA id u21-20020a02aa95000000b0042b28813816sm487309jai.14.2023.08.10.09.32.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Aug 2023 09:32:29 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Masahiro Yamada , Simon Glass Subject: [PATCH 12/28] moveconfig: Correct unused variables Date: Thu, 10 Aug 2023 10:31:44 -0600 Message-ID: <20230810163212.2368374-13-sjg@chromium.org> X-Mailer: git-send-email 2.41.0.640.ga95def55d0-goog In-Reply-To: <20230810163212.2368374-1-sjg@chromium.org> References: <20230810163212.2368374-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.8 at phobos.denx.de X-Virus-Status: Clean Fix pylint warnings about unused variables. Signed-off-by: Simon Glass --- tools/moveconfig.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/tools/moveconfig.py b/tools/moveconfig.py index cc35c4bce9d..02c1d13f865 100755 --- a/tools/moveconfig.py +++ b/tools/moveconfig.py @@ -620,7 +620,7 @@ class Slots: self.slots = [] devnull = subprocess.DEVNULL make_cmd = get_make_cmd() - for i in range(args.jobs): + for _ in range(args.jobs): self.slots.append(Slot(toolchains, args, progress, devnull, make_cmd, reference_src_dir, db_queue)) @@ -772,7 +772,7 @@ def find_kconfig_rules(kconf, config, imply_config): """ sym = kconf.syms.get(imply_config) if sym: - for sel, cond in (sym.selects + sym.implies): + for sel, _ in (sym.selects + sym.implies): if sel.name == config: return sym return None @@ -941,7 +941,7 @@ def do_imply_config(config_list, add_imply, imply_flags, skip_added, if add_imply and add_imply != 'all': add_imply = add_imply.split(',') - all_configs, all_defconfigs, config_db, defconfig_db = read_database() + all_configs, all_defconfigs, _, defconfig_db = read_database() # Work through each target config option in turn, independently for config in config_list: @@ -1101,7 +1101,7 @@ def do_find_config(config_list): is preceded by a tilde (~) then it must be false, otherwise it must be true) """ - all_configs, all_defconfigs, config_db, defconfig_db = read_database() + _, all_defconfigs, config_db, _ = read_database() # Start with all defconfigs out = all_defconfigs @@ -1199,9 +1199,7 @@ def scan_makefiles(fnames): fname_uses = {} for fname, rest in fnames: m_iter = RE_MK_CONFIGS.finditer(rest) - found = False for m in m_iter: - found = True real_opt = m.group(2) if real_opt == '': continue @@ -1242,9 +1240,11 @@ def scan_src_files(fnames): >>> RE_CONFIG_IS.search('#if CONFIG_IS_ENABLED(OF_PLATDATA)').groups() ('OF_PLATDATA',) """ + fname = None + rest = None + def add_uses(m_iter, is_spl): for m in m_iter: - found = True real_opt = m.group(1) if real_opt == '': continue @@ -1302,7 +1302,7 @@ def do_scan_source(path, do_update): """ # Make sure we know about all the options not_found = collections.defaultdict(list) - for use, rest in all_uses.items(): + for use, _ in all_uses.items(): name = use.cfg if name in IGNORE_SYMS: continue @@ -1314,7 +1314,6 @@ def do_scan_source(path, do_update): # If it is an SPL symbol, try prepending all SPL_ prefixes to # find at least one SPL symbol if use.is_spl: - add_to_dict = False for prefix in SPL_PREFIXES: try_name = prefix + name sym = kconf.syms.get(try_name) @@ -1332,7 +1331,6 @@ def do_scan_source(path, do_update): elif not use.is_spl: check = False else: # MODE_NORMAL - debug = False sym = kconf.syms.get(name) if not sym: proper_name = is_not_proper(name) @@ -1373,7 +1371,7 @@ def do_scan_source(path, do_update): print(f'Scanning source in {path}') args = ['git', 'grep', '-E', r'IS_ENABLED|\bCONFIG'] with subprocess.Popen(args, stdout=subprocess.PIPE) as proc: - out, err = proc.communicate() + out, _ = proc.communicate() lines = out.splitlines() re_fname = re.compile('^([^:]*):(.*)') src_list = [] @@ -1407,7 +1405,7 @@ def do_scan_source(path, do_update): print(f'Not sure how to handle file {fname}') # Scan the Makefiles - all_uses, fname_uses = scan_makefiles(mk_list) + all_uses, _ = scan_makefiles(mk_list) spl_not_found = set() proper_not_found = set() @@ -1428,7 +1426,7 @@ def do_scan_source(path, do_update): proper_not_found |= set([key for key in not_found.keys()]) # Scan the source code - all_uses, fname_uses = scan_src_files(src_list) + all_uses, _ = scan_src_files(src_list) # Make sure we know about all the options print('\nCONFIG options present in source but not Kconfig:') @@ -1527,7 +1525,7 @@ doc/develop/moveconfig.rst for documentation.''' if args.test: sys.argv = [sys.argv[0]] - fail, count = doctest.testmod() + fail, _ = doctest.testmod() if fail: return 1 unittest.main()