[elbe-devel] [PATCH 26/28] pylint: rename variables that redefine built-in, or outer scope names

Torben Hohn torben.hohn at linutronix.de
Wed Aug 22 11:29:20 CEST 2018


Pylint complains, when a definition shadows another variable.

Rename them.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/db.py         |  6 +++---
 elbepack/licencexml.py |  8 ++++----
 elbepack/pkgarchive.py |  4 ++--
 elbepack/virtapt.py    | 10 +++++-----
 4 files changed, 14 insertions(+), 14 deletions(-)

diff --git a/elbepack/db.py b/elbepack/db.py
index c70b48d7..e4371607 100644
--- a/elbepack/db.py
+++ b/elbepack/db.py
@@ -901,13 +901,13 @@ class ElbeDB(object):
 
         # encrypt is deprecated but hash is not available in jessie
         try:
-            hash = pbkdf2_sha512.hash(password)
+            pwhash = pbkdf2_sha512.hash(password)
         except AttributeError:
-            hash = pbkdf2_sha512.encrypt(password)
+            pwhash = pbkdf2_sha512.encrypt(password)
 
         u = User(name=name,
                  fullname=fullname,
-                 pwhash=hash,
+                 pwhash=pwhash,
                  email=email,
                  admin=admin)
 
diff --git a/elbepack/licencexml.py b/elbepack/licencexml.py
index 579892cb..9c277ff5 100644
--- a/elbepack/licencexml.py
+++ b/elbepack/licencexml.py
@@ -48,17 +48,17 @@ class copyright_xml (object):
         self.outxml = etree(None)
         self.pkglist = self.outxml.setroot('pkglicenses')
 
-    def add_copyright_file(self, pkg_name, copyright):
+    def add_copyright_file(self, pkg_name, copyright_text):
 
         # pylint: disable=too-many-locals
 
-        # remove illegal characters from copyright
-        copyright, _ = remove_re.subn('', copyright)
+        # remove illegal characters from copyright_text
+        copyright_text, _ = remove_re.subn('', copyright_text)
 
         xmlpkg = self.pkglist.append('pkglicense')
         xmlpkg.et.attrib['name'] = pkg_name
         txtnode = xmlpkg.append('text')
-        txtnode.et.text = copyright
+        txtnode.et.text = copyright_text
 
         bytesio = io.StringIO(unicode(txtnode.et.text))
         try:
diff --git a/elbepack/pkgarchive.py b/elbepack/pkgarchive.py
index 4d35260f..146277a9 100644
--- a/elbepack/pkgarchive.py
+++ b/elbepack/pkgarchive.py
@@ -12,7 +12,7 @@ from elbepack.repomanager import RepoBase, RepoAttributes
 
 
 class ArchiveRepo(RepoBase):
-    def __init__(self, xml, path, log, origin, description, components,
+    def __init__(self, xml, pathname, log, origin, description, components,
                  maxsize=None):
 
         # pylint: disable=too-many-arguments
@@ -23,7 +23,7 @@ class ArchiveRepo(RepoBase):
         repo_attrs = RepoAttributes(codename, arch, components)
 
         RepoBase.__init__(self,
-                          path,
+                          pathname,
                           log,
                           None,
                           repo_attrs,
diff --git a/elbepack/virtapt.py b/elbepack/virtapt.py
index 1a383707..bffbc659 100644
--- a/elbepack/virtapt.py
+++ b/elbepack/virtapt.py
@@ -154,12 +154,12 @@ class VirtApt:
             """ mode is not set correctly """
             os.system("chmod 777 " + newdir)
 
-    def touch(self, file):
-        if os.path.exists(file):
-            os.utime(file, None)
+    def touch(self, fname):
+        if os.path.exists(fname):
+            os.utime(fname, None)
         else:
-            file = open(file, "w")
-            file.close()
+            fp = open(fname, "w")
+            fp.close()
 
     def initialize_dirs(self):
         self.mkdir_p(os.path.join(self.projectpath, "cache/archives/partial"))
-- 
2.11.0




More information about the elbe-devel mailing list