Don't use dict.has_key()
authorGuido Günther <agx@sigxcpu.org>
Thu, 19 Feb 2015 15:02:23 +0000 (16:02 +0100)
committerGuido Günther <agx@sigxcpu.org>
Fri, 20 Feb 2015 11:41:12 +0000 (12:41 +0100)
Not existent in Python3

gbp/deb/changelog.py
gbp/patch_series.py
gbp/scripts/buildpackage.py
gbp/scripts/import_dsc.py
gbp/scripts/import_dscs.py

index 631b5a66d41ed922ff8f20dd313da248685e8b9e..725e8bae320500bd4b87b8de9aaeeda351fb34b4 100644 (file)
@@ -168,7 +168,7 @@ class ChangeLog(object):
         @return: C{True} if the version has an epoch, C{False} otherwise
         @rtype: C{bool}
         """
-        return self._cp.has_key('Epoch')
+        return 'Epoch' in self._cp
 
     @property
     def author(self):
index 327997f58c02902fcb1b9b37c869bcb3f1a2f373..ca45cab5a0b2a75dedaa48bd35359e97d655004c 100644 (file)
@@ -130,7 +130,7 @@ class Patch(object):
         if self.info == None:
             self._read_info()
 
-        if self.info.has_key(key):
+        if key in self.info:
             return self.info[key]
         else:
             return get_val() if get_val else None
index 0eff51502c5c7ca64b20dd79a342e6f16a238704..419f01de05c3e92d69753aa21fd89766a9d11d8e 100755 (executable)
@@ -293,7 +293,7 @@ def guess_comp_type(repo, comp_type, cp, tarball_dir):
 
     if comp_type != 'auto':
         comp_type = compressor_aliases.get(comp_type, comp_type)
-        if not compressor_opts.has_key(comp_type):
+        if comp_type not in compressor_opts:
             gbp.log.warn("Unknown compression type - guessing.")
             comp_type = 'auto'
 
index 4c5747e7ff1e06a3360fa5591b7ff05150f3a144..3f10d3f65cabfcee4ad7d698c946f81189fae58d 100644 (file)
@@ -412,7 +412,7 @@ def main(argv):
         os.chdir(dirs['top'])
 
     for d in [ 'tmp', 'download' ]:
-        if dirs.has_key(d):
+        if d in dirs:
             gbpc.RemoveTree(dirs[d])()
 
     if not ret and not skipped:
index 440cec2c7020f2ee622aaad0e08dceebc2a98c83..4e445c311253b6d30efd5f76aef010ef8d163647 100644 (file)
@@ -159,7 +159,7 @@ def main(argv):
             gbp.log.err(err)
         ret = 1
     finally:
-        if dirs.has_key('tmp'):
+        if 'tmp' in dirs:
             gbpc.RemoveTree(dirs['tmp'])()
         os.chdir(dirs['top'])