diff options
-rwxr-xr-x | contrib/ipaddr-py/ipaddr_test.py | 24 | ||||
-rwxr-xr-x | extras/prot_filter.py | 2 | ||||
-rwxr-xr-x | xlators/experimental/fdl/src/gen_recon.py | 2 | ||||
-rw-r--r-- | xlators/features/glupy/examples/negative.py | 8 |
4 files changed, 18 insertions, 18 deletions
diff --git a/contrib/ipaddr-py/ipaddr_test.py b/contrib/ipaddr-py/ipaddr_test.py index c56ecb5c4b1..322bf98762e 100755 --- a/contrib/ipaddr-py/ipaddr_test.py +++ b/contrib/ipaddr-py/ipaddr_test.py @@ -1035,9 +1035,9 @@ class IpaddrUnitTest(unittest.TestCase): def testNetworkElementCaching(self): # V4 - make sure we're empty - self.assertFalse(self.ipv4._cache.has_key('network')) - self.assertFalse(self.ipv4._cache.has_key('broadcast')) - self.assertFalse(self.ipv4._cache.has_key('hostmask')) + self.assertFalse('network' in self.ipv4._cache) + self.assertFalse('broadcast' in self.ipv4._cache) + self.assertFalse('hostmask' in self.ipv4._cache) # V4 - populate and test self.assertEqual(self.ipv4.network, ipaddr.IPv4Address('1.2.3.0')) @@ -1045,14 +1045,14 @@ class IpaddrUnitTest(unittest.TestCase): self.assertEqual(self.ipv4.hostmask, ipaddr.IPv4Address('0.0.0.255')) # V4 - check we're cached - self.assertTrue(self.ipv4._cache.has_key('network')) - self.assertTrue(self.ipv4._cache.has_key('broadcast')) - self.assertTrue(self.ipv4._cache.has_key('hostmask')) + self.assertTrue('network' in self.ipv4._cache) + self.assertTrue('broadcast' in self.ipv4._cache) + self.assertTrue('hostmask' in self.ipv4._cache) # V6 - make sure we're empty - self.assertFalse(self.ipv6._cache.has_key('network')) - self.assertFalse(self.ipv6._cache.has_key('broadcast')) - self.assertFalse(self.ipv6._cache.has_key('hostmask')) + self.assertFalse('network' in self.ipv6._cache) + self.assertFalse('broadcast' in self.ipv6._cache) + self.assertFalse('hostmask' in self.ipv6._cache) # V6 - populate and test self.assertEqual(self.ipv6.network, @@ -1063,9 +1063,9 @@ class IpaddrUnitTest(unittest.TestCase): ipaddr.IPv6Address('::ffff:ffff:ffff:ffff')) # V6 - check we're cached - self.assertTrue(self.ipv6._cache.has_key('network')) - self.assertTrue(self.ipv6._cache.has_key('broadcast')) - self.assertTrue(self.ipv6._cache.has_key('hostmask')) + self.assertTrue('network' in self.ipv6._cache) + self.assertTrue('broadcast' in self.ipv6._cache) + self.assertTrue('hostmask' in self.ipv6._cache) def testTeredo(self): # stolen from wikipedia diff --git a/extras/prot_filter.py b/extras/prot_filter.py index bc61c097faf..099832fc08a 100755 --- a/extras/prot_filter.py +++ b/extras/prot_filter.py @@ -126,7 +126,7 @@ if __name__ == "__main__": volume_list.append(extra) graph, last = load(path) for v in volume_list: - if graph.has_key(v): + if v in graph: break else: print("No configured volumes found - aborting.") diff --git a/xlators/experimental/fdl/src/gen_recon.py b/xlators/experimental/fdl/src/gen_recon.py index 75323ea3dd9..69e45698703 100755 --- a/xlators/experimental/fdl/src/gen_recon.py +++ b/xlators/experimental/fdl/src/gen_recon.py @@ -101,7 +101,7 @@ def get_special_subs (name, args, fop_type): code += fragments[recon_type].replace("@ARGNAME@",arg[1]) \ .replace("@ARGTYPE@",arg[2]) cleanup_key = recon_type + "_CLEANUP" - if fragments.has_key(cleanup_key): + if cleanup_key in fragments: new_frag = fragments[cleanup_key].replace("@ARGNAME@",arg[1]) # Make sure these get added in *reverse* order. Otherwise, a # failure for an earlier argument might goto a label that falls diff --git a/xlators/features/glupy/examples/negative.py b/xlators/features/glupy/examples/negative.py index 543f3109502..836008682ba 100644 --- a/xlators/features/glupy/examples/negative.py +++ b/xlators/features/glupy/examples/negative.py @@ -35,7 +35,7 @@ class xlator (Translator): pargfid = uuid2str(loc.contents.pargfid) print("lookup FOP: %s:%s" % (pargfid, loc.contents.name)) # Check the cache. - if cache.has_key(pargfid): + if pargfid in cache: if loc.contents.name in cache[pargfid]: print("short-circuiting for %s:%s" % (pargfid, loc.contents.name)) @@ -55,11 +55,11 @@ class xlator (Translator): # Update the cache. if op_ret == 0: print("found %s, removing from cache" % name) - if cache.has_key(pargfid): + if pargfid in cache: cache[pargfid].discard(name) elif op_errno == 2: # ENOENT print("failed to find %s, adding to cache" % name) - if cache.has_key(pargfid): + if pargfid in cache: cache[pargfid].add(name) else: cache[pargfid] = {name} @@ -85,7 +85,7 @@ class xlator (Translator): # Update the cache. if op_ret == 0: print("created %s, removing from cache" % name) - if cache.has_key(pargfid): + if pargfid in cache: cache[pargfid].discard(name) del self.requests[key] dl.unwind_create(frame,cookie,this,op_ret,op_errno,fd,inode,buf, |