summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
authorKaleb S. KEITHLEY <kkeithle@redhat.com>2018-06-19 10:56:37 -0400
committerAmar Tumballi <amarts@redhat.com>2018-06-21 05:45:08 +0000
commitfe9b72485697a035b3dbb11b83048dd31de5863e (patch)
tree8b265ee06edbe83c762d0124efd76cdcecebe1cf /xlators
parent2bab841316025c402b97c877ccc4ee9188c929e0 (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/, https://review.gluster.org/#/c/20207/, https://review.gluster.org/#/c/20227/, and https://review.gluster.org/#/c/20307/ This patch fixes more selected comma white space (ws_comma) as suggested by the 2to3 utility. Note: Fedora packaging guidelines and SUSE rpmlint require explicit shebangs, so popular practices like #!/usr/bin/env python and or #!/usr/bin/python3 Note: Selected small fixes from 2to3 utility. Specifically apply, basestring, funcattrs, has_key, idioms, map, numliterals, raise, set_literal, types, urllib, and zip 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. Change-Id: I60932030813484803f73733a9b2b7b23c7a843fd updates: #411 Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Diffstat (limited to 'xlators')
-rwxr-xr-xxlators/experimental/fdl/src/gen_dumper.py12
-rwxr-xr-xxlators/experimental/fdl/src/gen_recon.py18
2 files changed, 15 insertions, 15 deletions
diff --git a/xlators/experimental/fdl/src/gen_dumper.py b/xlators/experimental/fdl/src/gen_dumper.py
index 363ba6ce63f..95313adefcc 100755
--- a/xlators/experimental/fdl/src/gen_dumper.py
+++ b/xlators/experimental/fdl/src/gen_dumper.py
@@ -67,8 +67,8 @@ def get_special_subs (args):
if (arg[0] != 'fop-arg') or (len(arg) < 4):
continue
recon_type, recon_fmt = typemap[arg[2]]
- code += fragments[recon_type].replace("@ARGNAME@",arg[3]) \
- .replace("@FORMAT@",recon_fmt)
+ code += fragments[recon_type].replace("@ARGNAME@", arg[3]) \
+ .replace("@FORMAT@", recon_fmt)
return code
def gen_functions ():
@@ -78,7 +78,7 @@ def gen_functions ():
continue
fop_subs[name]["@FUNCTION_BODY@"] = get_special_subs(value)
# Print the FOP fragment with @FUNCTION_BODY@ in the middle.
- code += generate(fragments["FOP"],name,fop_subs)
+ code += generate(fragments["FOP"], name, fop_subs)
return code
def gen_cases ():
@@ -87,7 +87,7 @@ def gen_cases ():
if "journal" not in [ x[0] for x in value ]:
continue
# Add the CASE fragment for this fop.
- code += generate(fragments["CASE"],name,fop_subs)
+ code += generate(fragments["CASE"], name, fop_subs)
return code
def load_fragments (path="recon-tmpl.c"):
@@ -95,7 +95,7 @@ def load_fragments (path="recon-tmpl.c"):
cur_symbol = None
cur_value = ""
result = {}
- for line in open(path,"r").readlines():
+ for line in open(path, "r").readlines():
m = pragma_re.search(line)
if m:
if cur_symbol:
@@ -113,5 +113,5 @@ if __name__ == "__main__":
print("/* BEGIN GENERATED CODE - DO NOT MODIFY */")
print(fragments["PROLOG"])
print(gen_functions())
- print(fragments["EPILOG"].replace("@SWITCH_BODY@",gen_cases()))
+ print(fragments["EPILOG"].replace("@SWITCH_BODY@", gen_cases()))
print("/* END GENERATED CODE */")
diff --git a/xlators/experimental/fdl/src/gen_recon.py b/xlators/experimental/fdl/src/gen_recon.py
index 69e45698703..ff5b5e16066 100755
--- a/xlators/experimental/fdl/src/gen_recon.py
+++ b/xlators/experimental/fdl/src/gen_recon.py
@@ -74,8 +74,8 @@ def get_special_subs (name, args, fop_type):
s_args.append(arg[3])
continue
if arg[0] == 'link':
- links += fragments["LINK"].replace("@INODE_ARG@",arg[1]) \
- .replace("@IATT_ARG@",arg[2])
+ links += fragments["LINK"].replace("@INODE_ARG@", arg[1]) \
+ .replace("@IATT_ARG@", arg[2])
continue
if arg[0] != 'fop-arg':
continue
@@ -98,11 +98,11 @@ def get_special_subs (name, args, fop_type):
if (name != "link") or (arg[1] != "oldloc"):
# print "/* change to PARENT_LOC */"
recon_type = "PARENT_LOC"
- code += fragments[recon_type].replace("@ARGNAME@",arg[1]) \
- .replace("@ARGTYPE@",arg[2])
+ code += fragments[recon_type].replace("@ARGNAME@", arg[1]) \
+ .replace("@ARGTYPE@", arg[2])
cleanup_key = recon_type + "_CLEANUP"
if cleanup_key in fragments:
- new_frag = fragments[cleanup_key].replace("@ARGNAME@",arg[1])
+ 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
# through to the cleanup code for a variable associated with a
@@ -179,7 +179,7 @@ def gen_functions ():
else:
fop_subs[name]["@SUCCESS_VALUE@"] = "GFAPI_SUCCESS"
# Print the FOP fragment with @FUNCTION_BODY@ in the middle.
- code += generate(fragments["FOP"],name,fop_subs)
+ code += generate(fragments["FOP"], name, fop_subs)
return code
def gen_cases ():
@@ -188,7 +188,7 @@ def gen_cases ():
if "journal" not in [ x[0] for x in value ]:
continue
# Add the CASE fragment for this fop.
- code += generate(fragments["CASE"],name,fop_subs)
+ code += generate(fragments["CASE"], name, fop_subs)
return code
def load_fragments (path="recon-tmpl.c"):
@@ -196,7 +196,7 @@ def load_fragments (path="recon-tmpl.c"):
cur_symbol = None
cur_value = ""
result = {}
- for line in open(path,"r").readlines():
+ for line in open(path, "r").readlines():
m = pragma_re.search(line)
if m:
if cur_symbol:
@@ -214,5 +214,5 @@ if __name__ == "__main__":
print("/* BEGIN GENERATED CODE - DO NOT MODIFY */")
print(fragments["PROLOG"])
print(gen_functions())
- print(fragments["EPILOG"].replace("@SWITCH_BODY@",gen_cases()))
+ print(fragments["EPILOG"].replace("@SWITCH_BODY@", gen_cases()))
print("/* END GENERATED CODE */")