From nobody Sat Feb 7 09:36:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1570625958; cv=none; d=zoho.com; s=zohoarc; b=W/rzETpiAzA6qKRIsIdVLDGIWBxBNJgF4GQuD6ZWHLJ/JrQPcPqKC7KxYgvOIHYa5u0CBGjJTqja02/F96Y2ZxohY7LzfqdmyodJOBMPY6bxf+iiUMlV6FyCJVI9eItKg+5rjayAZlJX8PylqT6ifvfK6bsN0UqFVDKrPShsUtw= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1570625958; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=7GJR5zSk7/MHwWb/VObkrACc+vOrG//08kty8WIV44o=; b=afHPrcaBMzdYAgqCcwToXQl41sXUAlm7V9MscJTFPGlUwGRG5qcn4shf63Q8biR9DlUspR35pZyysoJqnw04VM9J5jt9h/hGhE34VxKriZA7IaY+goFM/1Ng2HAviWJiAeaZT1rccCO+L/PiBSMxk21Oy6KXRnxypyRBARXt8ws= ARC-Authentication-Results: i=1; mx.zoho.com; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 15706259587901003.3842262810994; Wed, 9 Oct 2019 05:59:18 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx07.intmail.prod.int.phx2.redhat.com [10.5.11.22]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 3B12F88384B; Wed, 9 Oct 2019 12:59:17 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 11D751001B07; Wed, 9 Oct 2019 12:59:17 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id C6CA118037C9; Wed, 9 Oct 2019 12:59:16 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id x99Cx3jB002961 for ; Wed, 9 Oct 2019 08:59:03 -0400 Received: by smtp.corp.redhat.com (Postfix) id BD4675D9D6; Wed, 9 Oct 2019 12:59:03 +0000 (UTC) Received: from localhost.localdomain.com (ovpn-112-67.ams2.redhat.com [10.36.112.67]) by smtp.corp.redhat.com (Postfix) with ESMTP id CBC986762F; Wed, 9 Oct 2019 12:59:02 +0000 (UTC) From: =?UTF-8?q?Daniel=20P=2E=20Berrang=C3=A9?= To: libvir-list@redhat.com Date: Wed, 9 Oct 2019 13:58:39 +0100 Message-Id: <20191009125844.18202-6-berrange@redhat.com> In-Reply-To: <20191009125844.18202-1-berrange@redhat.com> References: <20191009125844.18202-1-berrange@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH 05/10] python: avoid variable named 'l' X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.84 on 10.5.11.22 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.6.2 (mx1.redhat.com [10.5.110.69]); Wed, 09 Oct 2019 12:59:17 +0000 (UTC) Python code style recommends avoiding a variable named 'l' as it is visually similar to '1'. docs/apibuild.py:482:13: E741 ambiguous variable name 'l' l =3D len(line) ^ docs/apibuild.py:503:21: E741 ambiguous variable name 'l' l =3D len(line) ^ ...more... Signed-off-by: Daniel P. Berrang=C3=A9 --- build-aux/syntax-check.mk | 2 +- docs/apibuild.py | 100 +++++++++++++++++++------------------- 2 files changed, 51 insertions(+), 51 deletions(-) diff --git a/build-aux/syntax-check.mk b/build-aux/syntax-check.mk index acd3f96c6d..b138220b30 100644 --- a/build-aux/syntax-check.mk +++ b/build-aux/syntax-check.mk @@ -883,7 +883,7 @@ FLAKE8_INDENTATION =3D E114,E115,E116,E121,E125,E126,E1= 27,E128,E129,E131 FLAKE8_WHITESPACE =3D E211,E221,E222,E225,E226,E231,E261 FLAKE8_BLANK_LINES =3D E301,E302,E303,E305 FLAKE8_LINE_LENGTH =3D E501 -FLAKE8_STATEMENTS =3D E722,E741 +FLAKE8_STATEMENTS =3D E722 FLAKE8_WARNINGS =3D W504 =20 FLAKE8_IGNORE =3D $(FLAKE8_INDENTATION),$\ diff --git a/docs/apibuild.py b/docs/apibuild.py index 18dc3604d0..b3ef462565 100755 --- a/docs/apibuild.py +++ b/docs/apibuild.py @@ -479,7 +479,7 @@ class CLexer: self.tokens[0] =3D ('preproc', "#" + self.tokens[1][1]) del self.tokens[1] break - l =3D len(line) + nline =3D len(line) if line[0] =3D=3D '"' or line[0] =3D=3D "'": quote =3D line[0] i =3D 1 @@ -500,12 +500,12 @@ class CLexer: tok =3D "" while found =3D=3D 0: i =3D 0 - l =3D len(line) - while i < l: - if line[i] =3D=3D '*' and i+1 < l and line[i+1] = =3D=3D '/': + nline =3D len(line) + while i < nline: + if line[i] =3D=3D '*' and i+1 < nline and line[i+1= ] =3D=3D '/': self.line =3D line[i+2:] line =3D line[:i-1] - l =3D i + nline =3D i found =3D 1 break i =3D i + 1 @@ -523,12 +523,12 @@ class CLexer: self.last =3D ('comment', line) return self.last i =3D 0 - while i < l: - if line[i] =3D=3D '/' and i+1 < l and line[i+1] =3D=3D '/': + while i < nline: + if line[i] =3D=3D '/' and i+1 < nline and line[i+1] =3D=3D= '/': self.line =3D line[i:] line =3D line[:i] break - if line[i] =3D=3D '/' and i+1 < l and line[i+1] =3D=3D '*': + if line[i] =3D=3D '/' and i+1 < nline and line[i+1] =3D=3D= '*': self.line =3D line[i:] line =3D line[:i] break @@ -537,15 +537,15 @@ class CLexer: line =3D line[:i] break i =3D i + 1 - l =3D len(line) + nline =3D len(line) i =3D 0 - while i < l: + while i < nline: if line[i] =3D=3D ' ' or line[i] =3D=3D '\t': i =3D i + 1 continue if line[i].isalnum(): s =3D i - while i < l: + while i < nline: if line[i] not in " \t(){}:;,+-*/%&!|[]=3D><": i =3D i + 1 else: @@ -557,14 +557,14 @@ class CLexer: i =3D i + 1 continue if line[i] in "+-*><=3D/%&!|.": - if line[i] =3D=3D '.' and i + 2 < l and \ + if line[i] =3D=3D '.' and i + 2 < nline and \ line[i+1] =3D=3D '.' and line[i+2] =3D=3D '.': self.tokens.append(('name', '...')) i =3D i + 3 continue =20 j =3D i + 1 - if j < l and line[j] in "+-*><=3D/%&!|": + if j < nline and line[j] in "+-*><=3D/%&!|": self.tokens.append(('op', line[i:j+1])) i =3D j + 1 else: @@ -572,7 +572,7 @@ class CLexer: i =3D i + 1 continue s =3D i - while i < l: + while i < nline: if line[i] not in " \t(){}:;,+-*/%&!|[]=3D><": i =3D i + 1 else: @@ -779,9 +779,9 @@ class CParser: while lines[0] =3D=3D '*': del lines[0] while len(lines) > 0 and lines[0][0:3] =3D=3D '* @': - l =3D lines[0][3:] + prefix =3D lines[0][3:] try: - arg, desc =3D l.split(':', 1) + arg, desc =3D prefix.split(':', 1) desc =3D desc.strip() arg =3D arg.strip() except: @@ -791,25 +791,25 @@ class CParser: del lines[0] continue del lines[0] - l =3D lines[0].strip() - while len(l) > 2 and l[0:3] !=3D '* @': - while l[0] =3D=3D '*': - l =3D l[1:] - desc =3D desc + ' ' + l.strip() + line =3D lines[0].strip() + while len(line) > 2 and line[0:3] !=3D '* @': + while line[0] =3D=3D '*': + line =3D line[1:] + desc =3D desc + ' ' + line.strip() del lines[0] if len(lines) =3D=3D 0: break - l =3D lines[0] + line =3D lines[0] args.append((arg, desc)) while len(lines) > 0 and lines[0] =3D=3D '*': del lines[0] desc =3D "" while len(lines) > 0: - l =3D lines[0] - while len(l) > 0 and l[0] =3D=3D '*': - l =3D l[1:] - l =3D l.strip() - desc =3D desc + " " + l + line =3D lines[0] + while len(line) > 0 and line[0] =3D=3D '*': + line =3D line[1:] + line =3D line.strip() + desc =3D desc + " " + line del lines[0] =20 desc =3D desc.strip() @@ -860,9 +860,9 @@ class CParser: del lines[0] nbargs =3D len(args) while len(lines) > 0 and lines[0][0:3] =3D=3D '* @': - l =3D lines[0][3:] + prefix =3D lines[0][3:] try: - arg, desc =3D l.split(':', 1) + arg, desc =3D prefix.split(':', 1) desc =3D desc.strip() arg =3D arg.strip() except: @@ -872,15 +872,15 @@ class CParser: del lines[0] continue del lines[0] - l =3D lines[0].strip() - while len(l) > 2 and l[0:3] !=3D '* @': - while l[0] =3D=3D '*': - l =3D l[1:] - desc =3D desc + ' ' + l.strip() + line =3D lines[0].strip() + while len(line) > 2 and line[0:3] !=3D '* @': + while line[0] =3D=3D '*': + line =3D line[1:] + desc =3D desc + ' ' + line.strip() del lines[0] if len(lines) =3D=3D 0: break - l =3D lines[0] + line =3D lines[0] i =3D 0 while i < nbargs: if args[i][1] =3D=3D arg: @@ -895,35 +895,35 @@ class CParser: del lines[0] desc =3D None while len(lines) > 0: - l =3D lines[0] + line =3D lines[0] i =3D 0 # Remove all leading '*', followed by at most one ' ' character # since we need to preserve correct indentation of code exampl= es - while i < len(l) and l[i] =3D=3D '*': + while i < len(line) and line[i] =3D=3D '*': i =3D i + 1 if i > 0: - if i < len(l) and l[i] =3D=3D ' ': + if i < len(line) and line[i] =3D=3D ' ': i =3D i + 1 - l =3D l[i:] - if len(l) >=3D 6 and l[0:7] =3D=3D "Returns": + line =3D line[i:] + if len(line) >=3D 6 and line[0:7] =3D=3D "Returns": try: - l =3D l.split(' ', 1)[1] + line =3D line.split(' ', 1)[1] except: - l =3D "" - retdesc =3D l.strip() + line =3D "" + retdesc =3D line.strip() del lines[0] while len(lines) > 0: - l =3D lines[0] - while len(l) > 0 and l[0] =3D=3D '*': - l =3D l[1:] - l =3D l.strip() - retdesc =3D retdesc + " " + l + line =3D lines[0] + while len(line) > 0 and line[0] =3D=3D '*': + line =3D line[1:] + line =3D line.strip() + retdesc =3D retdesc + " " + line del lines[0] else: if desc is not None: - desc =3D desc + "\n" + l + desc =3D desc + "\n" + line else: - desc =3D l + desc =3D line del lines[0] =20 if desc is None: --=20 2.21.0 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list