summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2018-06-11 10:55:42 -0400
committerPrashanth Pai <ppai@redhat.com>2018-06-13 15:23:04 +0000
commit8e63ca9bba888df0965f0beeed51a5336e6cb8cd (patch)
treeb0d9e2bc9aa4b24153fa2f92ae0a6a8bdef5f1b7 /xlators
parent81701e4d92ae7b1d97e5bc955703719f2e9e773a (diff)
core/various: python3 compat, prepare for python2 -> python3
see https://review.gluster.org/#/c/19788/, https://review.gluster.org/#/c/19871/, https://review.gluster.org/#/c/19952/, https://review.gluster.org/#/c/20104/, https://review.gluster.org/#/c/20162/, https://review.gluster.org/#/c/20185/, and https://review.gluster.org/#/c/20207/ This patch changes uses of has_key() as suggested by the 2to3 utility. Note: Fedora packaging guidelines require explicit shebangs, so popular practices like #!/usr/bin/env python and #!/usr/bin/python are not allowed; they must be #!/usr/bin/python2 or #!/usr/bin/python3 Note: Selected small fixes from 2to3 utility. Specifically apply, basestring, funcattrs, idioms, numliterals, set_literal, types, urllib, zip, map, and raise have already been applied. Also version agnostic imports for urllib, cpickle, socketserver, _thread, queue, etc., suggested by Aravinda in https://review.gluster.org/#/c/19767/1 Note: these 2to3 fixes report no changes are necessary: asserts, buffer, exec, execfile, exitfunc, filter, getcwdu, imports2, input, intern, itertools, metaclass, methodattrs, ne, next, nonzero, operator, paren, raw_input, reduce, reload, renames, repr, standarderror, sys_exc, throw, tuple_params, xreadlines. Updates: #411 Change-Id: I79bda20f1583a0a1bb0320667498f4c137de93b3 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators')
-rwxr-xr-xxlators/experimental/fdl/src/gen_recon.py2
-rw-r--r--xlators/features/glupy/examples/negative.py8
2 files changed, 5 insertions, 5 deletions
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,