From patchwork Mon Oct 26 01:04:23 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1387366 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: 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=E/BTdJxr; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CKGrq1TJVz9sTD for ; Mon, 26 Oct 2020 12:07:06 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id C2FB6824EF; Mon, 26 Oct 2020 02:05:32 +0100 (CET) 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="E/BTdJxr"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 220CC824BB; Mon, 26 Oct 2020 02:05:16 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-2.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mail-io1-xd43.google.com (mail-io1-xd43.google.com [IPv6:2607:f8b0:4864:20::d43]) (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 913EE824AE for ; Mon, 26 Oct 2020 02:05:12 +0100 (CET) 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-io1-xd43.google.com with SMTP id q25so8343214ioh.4 for ; Sun, 25 Oct 2020 18:05:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=7j7xAVjDEf20+UR70X+XI6nZn5zlQxEfmVv02WXqnUQ=; b=E/BTdJxr368yXjMvJHRUAp+OIkie5aJv2KqeEYDmRhzt02oDwOlz0j+4x/xOzNi9kI wod+sEsypBXeyeem6UJArsP/dfN4Qkn5pYwVHS+bgbDJkbvEv+8TgaWo9yudZz8JUXR8 WN1pHi2TmtiyyiMkol/WOQaOMO1LTHBo1+T08= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=7j7xAVjDEf20+UR70X+XI6nZn5zlQxEfmVv02WXqnUQ=; b=p8yfyVDkD/xf6YumYzCYuy1A55hBIH1Ji/aKwPh87rgLE7gTIVQFB6nMgpBKjeCm0F lbSB8jogPcj3oUJCa8ICexX6lDCZKIM8A3xYDikCKraKX1Z6NPyoRi2XZR+D0lahUKxj 1pCqUzC8vgi5Wmn9p4e26vYubjwTGVwu7hBirh2TBb+X6HwoR8WjH69lTqUjHE4fAiIT llYWEhAGo99eODfWafvMljeKIuyGC9tmpXKaL6yRo/b2HMNulr+Vf6tY/GNWHvg9lULU igiRRdFg3TsLD2ApXVQAagH2tzRWBlujjKbqot1SPqIdMvYKMfm0gdB5NRIk2OKOKt1R 2PJw== X-Gm-Message-State: AOAM532nTKlhVLgFNDbnb8lVTaExWMoO7gHy5Ytu4DbMoiemCgarBD/7 MFq4zNLHfyyONyEjoeR703bzPvbYtKFqcGp3 X-Google-Smtp-Source: ABdhPJz6n+tvnYN2gMXVCOV7RsxjMNzQSULw3CwNrWzSZ8XokWTOeV86rPP1OVqr2ZWZEwgqfP3MDQ== X-Received: by 2002:a5e:de01:: with SMTP id e1mr8862859iok.17.1603674311273; Sun, 25 Oct 2020 18:05:11 -0700 (PDT) Received: from localhost.localdomain (c-73-14-175-90.hsd1.co.comcast.net. [73.14.175.90]) by smtp.gmail.com with ESMTPSA id a6sm5231162ili.11.2020.10.25.18.05.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 25 Oct 2020 18:05:10 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Cc: Tom Rini , Doug Anderson , patchwork@lists.ozlabs.org, Simon Glass Subject: [PATCH v2 11/30] patman: Rename variables in patchstream Date: Sun, 25 Oct 2020 19:04:23 -0600 Message-Id: <20201026010442.1606893-12-sjg@chromium.org> X-Mailer: git-send-email 2.29.0.rc2.309.g374f81d7ae-goog In-Reply-To: <20201026010442.1606893-1-sjg@chromium.org> References: <20201026010442.1606893-1-sjg@chromium.org> MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 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.102.3 at phobos.denx.de X-Virus-Status: Clean Some variables are too short or shadow other variables or types. Fix these to keep pylint3 happy. Signed-off-by: Simon Glass --- (no changes since v1) tools/patman/patchstream.py | 52 ++++++++++++++++++------------------- 1 file changed, 26 insertions(+), 26 deletions(-) diff --git a/tools/patman/patchstream.py b/tools/patman/patchstream.py index 5487799bbee..3a057fbd6c4 100644 --- a/tools/patman/patchstream.py +++ b/tools/patman/patchstream.py @@ -149,7 +149,7 @@ class PatchStream: """ try: return int(value) - except ValueError as str: + except ValueError: raise ValueError("%s: Cannot decode version info '%s'" % (self.commit.hash, line)) @@ -385,10 +385,10 @@ class PatchStream: # Well that means this is an ordinary line else: # Look for space before tab - m = RE_SPACE_BEFORE_TAB.match(line) - if m: + mat = RE_SPACE_BEFORE_TAB.match(line) + if mat: self.warn.append('Line %d/%d has space before tab' % - (self.linenum, m.start())) + (self.linenum, mat.start())) # OK, we have a valid non-blank line out = [line] @@ -527,10 +527,10 @@ def get_metadata_for_list(commit_range, git_dir=None, count=None, params = gitutil.LogCmd(commit_range, reverse=True, count=count, git_dir=git_dir) stdout = command.RunPipe([params], capture=True).stdout - ps = PatchStream(series, is_log=True) + pst = PatchStream(series, is_log=True) for line in stdout.splitlines(): - ps.process_line(line) - ps.finalise() + pst.process_line(line) + pst.finalise() return series def get_metadata(branch, start, count): @@ -554,13 +554,13 @@ def get_metadata_for_test(text): text: """ series = Series() - ps = PatchStream(series, is_log=True) + pst = PatchStream(series, is_log=True) for line in text.splitlines(): - ps.process_line(line) - ps.finalise() + pst.process_line(line) + pst.finalise() return series -def fix_patch(backup_dir, fname, series, commit): +def fix_patch(backup_dir, fname, series, cmt): """Fix up a patch file, by adding/removing as required. We remove our tags from the patch file, insert changes lists, etc. @@ -571,16 +571,16 @@ def fix_patch(backup_dir, fname, series, commit): Args: fname: Filename to patch file to process series: Series information about this patch set - commit: Commit object for this patch file + cmt: Commit object for this patch file Return: A list of errors, or [] if all ok. """ handle, tmpname = tempfile.mkstemp() outfd = os.fdopen(handle, 'w', encoding='utf-8') infd = open(fname, 'r', encoding='utf-8') - ps = PatchStream(series) - ps.commit = commit - ps.process_stream(infd, outfd) + pst = PatchStream(series) + pst.commit = cmt + pst.process_stream(infd, outfd) infd.close() outfd.close() @@ -588,7 +588,7 @@ def fix_patch(backup_dir, fname, series, commit): if backup_dir: shutil.copy(fname, os.path.join(backup_dir, os.path.basename(fname))) shutil.move(tmpname, fname) - return ps.warn + return pst.warn def fix_patches(series, fnames): """Fix up a list of patches identified by filenames @@ -603,10 +603,10 @@ def fix_patches(series, fnames): backup_dir = None #tempfile.mkdtemp('clean-patch') count = 0 for fname in fnames: - commit = series.commits[count] - commit.patch = fname - commit.count = count - result = fix_patch(backup_dir, fname, series, commit) + cmt = series.commits[count] + cmt.patch = fname + cmt.count = count + result = fix_patch(backup_dir, fname, series, cmt) if result: print('%d warnings for %s:' % (len(result), fname)) for warn in result: @@ -623,11 +623,11 @@ def insert_cover_letter(fname, series, count): series: Series object count: Number of patches in the series """ - fd = open(fname, 'r') - lines = fd.readlines() - fd.close() + fil = open(fname, 'r') + lines = fil.readlines() + fil.close() - fd = open(fname, 'w') + fil = open(fname, 'w') text = series.cover prefix = series.GetPatchPrefix() for line in lines: @@ -647,5 +647,5 @@ def insert_cover_letter(fname, series, count): # Now the change list out = series.MakeChangeLog(None) line += '\n' + '\n'.join(out) - fd.write(line) - fd.close() + fil.write(line) + fil.close()