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

Torben Hohn torben.hohn at linutronix.de
Wed Aug 22 11:28:57 CEST 2018


pylint complains, when built-in names are shadowed by parameter names.

rename them.

Signed-off-by: Torben Hohn <torben.hohn at linutronix.de>
---
 elbepack/efilesystem.py    | 12 ++++++------
 elbepack/pbuilderaction.py |  4 ++--
 elbepack/rfs.py            |  4 ++--
 elbepack/updated.py        |  4 ++--
 4 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/elbepack/efilesystem.py b/elbepack/efilesystem.py
index e70de442..f8ee8d30 100644
--- a/elbepack/efilesystem.py
+++ b/elbepack/efilesystem.py
@@ -136,15 +136,15 @@ class ElbeFilesystem(Filesystem):
 
     def write_licenses(self, f, log, xml_fname=None):
         licence_xml = copyright_xml()
-        for dir in self.listdir("usr/share/doc/", skiplinks=True):
+        for d in self.listdir("usr/share/doc/", skiplinks=True):
             try:
-                with io.open(os.path.join(dir, "copyright"), "rb") as lic:
+                with io.open(os.path.join(d, "copyright"), "rb") as lic:
                     lic_text = lic.read()
             except IOError as e:
                 log.printo("Error while processing license file %s: '%s'" %
-                           (os.path.join(dir, "copyright"), e.strerror))
+                           (os.path.join(d, "copyright"), e.strerror))
                 lic_text = "Error while processing license file %s: '%s'" % (
-                    os.path.join(dir, "copyright"), e.strerror)
+                    os.path.join(d, "copyright"), e.strerror)
 
             try:
                 lic_text = unicode(lic_text, encoding='utf-8')
@@ -152,7 +152,7 @@ class ElbeFilesystem(Filesystem):
                 lic_text = unicode(lic_text, encoding='iso-8859-1')
 
             if f is not None:
-                f.write(unicode(os.path.basename(dir)))
+                f.write(unicode(os.path.basename(d)))
                 f.write(u":\n======================================"
                         "==========================================")
                 f.write(u"\n")
@@ -160,7 +160,7 @@ class ElbeFilesystem(Filesystem):
                 f.write(u"\n\n")
 
             if xml_fname is not None:
-                licence_xml.add_copyright_file(os.path.basename(dir), lic_text)
+                licence_xml.add_copyright_file(os.path.basename(d), lic_text)
 
         if xml_fname is not None:
             licence_xml.write(xml_fname)
diff --git a/elbepack/pbuilderaction.py b/elbepack/pbuilderaction.py
index 7accaaae..a822c5ca 100644
--- a/elbepack/pbuilderaction.py
+++ b/elbepack/pbuilderaction.py
@@ -29,8 +29,8 @@ def ensure_outdir(opt):
 
 
 class PBuilderError(Exception):
-    def __init__(self, str):
-        Exception.__init__(self, str)
+    def __init__(self, msg):
+        Exception.__init__(self, msg)
 
 
 class PBuilderAction(object):
diff --git a/elbepack/rfs.py b/elbepack/rfs.py
index 1e1e411f..28f96483 100644
--- a/elbepack/rfs.py
+++ b/elbepack/rfs.py
@@ -80,8 +80,8 @@ class BuildEnv ():
         self.rfs.__enter__()
         return self
 
-    def __exit__(self, type, value, traceback):
-        self.rfs.__exit__(type, value, traceback)
+    def __exit__(self, typ, value, traceback):
+        self.rfs.__exit__(typ, value, traceback)
         self.cdrom_umount()
         if os.path.exists(self.path + '/repo'):
             self.log.do("mv %s/repo %s/../" % (self.path, self.path))
diff --git a/elbepack/updated.py b/elbepack/updated.py
index 717d51ac..aee90451 100644
--- a/elbepack/updated.py
+++ b/elbepack/updated.py
@@ -162,10 +162,10 @@ class rw_access_file:
         self.f = open(self.filename, 'w')
         return self.f
 
-    def __exit__(self, type, value, traceback):
+    def __exit__(self, typ, value, traceback):
         if os.path.isfile(self.filename):
             self.f.close()
-        self.rw.__exit__(type, value, traceback)
+        self.rw.__exit__(typ, value, traceback)
 
 
 class rw_access:
-- 
2.11.0




More information about the elbe-devel mailing list