diff options
| -rwxr-xr-x | extras/create_new_xlator/generate_xlator.py | 8 | ||||
| -rw-r--r-- | libglusterfs/src/gen-defaults.py | 12 | ||||
| -rwxr-xr-x | libglusterfs/src/generator.py | 30 | 
3 files changed, 25 insertions, 25 deletions
diff --git a/extras/create_new_xlator/generate_xlator.py b/extras/create_new_xlator/generate_xlator.py index a0b1e691c17..0a54089080c 100755 --- a/extras/create_new_xlator/generate_xlator.py +++ b/extras/create_new_xlator/generate_xlator.py @@ -111,8 +111,8 @@ def gen_xlator():                  print("        .{0:20} = {1}_{2},".format(dops, fop_prefix, dops), file=xl)          print("};", file=xl) -        xlator_methods = fragments["XLATOR_METHODS"].replace("@XL_NAME@",xl_name) -        xlator_methods = xlator_methods.replace("@FOP_PREFIX@",fop_prefix) +        xlator_methods = fragments["XLATOR_METHODS"].replace("@XL_NAME@", xl_name) +        xlator_methods = xlator_methods.replace("@FOP_PREFIX@", fop_prefix)  	print(xlator_methods, file=xl)          xl.close() @@ -155,7 +155,7 @@ def gen_makefiles():          m = open(src_dir_path+"/Makefile.am", 'w+')          txt = MAKEFILE_FMT.replace("@XL_NAME@", xl_name)          txt = txt.replace("@XL_NAME_NO_HYPHEN@", xl_name_no_hyphen) -        txt = txt.replace("@XL_TYPE@",xlator_type) +        txt = txt.replace("@XL_TYPE@", xlator_type)          print(txt, file=m)          m.close() @@ -170,7 +170,7 @@ def load_fragments ():          result = {}          basepath = os.path.abspath(os.path.dirname(__file__))          fragpath = basepath + "/new-xlator-tmpl.c" -        for line in open(fragpath,"r").readlines(): +        for line in open(fragpath, "r").readlines():                  m = pragma_re.search(line)                  if m:                          if cur_symbol: diff --git a/libglusterfs/src/gen-defaults.py b/libglusterfs/src/gen-defaults.py index e577eb71863..ccd5f5fc6c9 100644 --- a/libglusterfs/src/gen-defaults.py +++ b/libglusterfs/src/gen-defaults.py @@ -62,17 +62,17 @@ default_@NAME@ (  def gen_defaults ():  	for name in ops.iterkeys(): -		print(generate(FAILURE_CBK_TEMPLATE,name,cbk_subs)) +		print(generate(FAILURE_CBK_TEMPLATE, name, cbk_subs))  	for name in ops.iterkeys(): -		print(generate(CBK_RESUME_TEMPLATE,name,cbk_subs)) +		print(generate(CBK_RESUME_TEMPLATE, name, cbk_subs))  	for name in ops.iterkeys(): -		print(generate(CBK_TEMPLATE,name,cbk_subs)) +		print(generate(CBK_TEMPLATE, name, cbk_subs))  	for name in ops.iterkeys(): -		print(generate(RESUME_TEMPLATE,name,fop_subs)) +		print(generate(RESUME_TEMPLATE, name, fop_subs))  	for name in ops.iterkeys(): -		print(generate(FOP_TEMPLATE,name,fop_subs)) +		print(generate(FOP_TEMPLATE, name, fop_subs)) -for l in open(sys.argv[1],'r').readlines(): +for l in open(sys.argv[1], 'r').readlines():  	if l.find('#pragma generate') != -1:  		print("/* BEGIN GENERATED CODE - DO NOT MODIFY */")  		gen_defaults() diff --git a/libglusterfs/src/generator.py b/libglusterfs/src/generator.py index e73cb0cb0b1..3b7df986f1f 100755 --- a/libglusterfs/src/generator.py +++ b/libglusterfs/src/generator.py @@ -213,9 +213,9 @@ ops['rename'] = (  	('fop-arg',	'xdata',		'dict_t *',			'xdata'),  	('cbk-arg',	'buf',			'struct iatt *'),  	('cbk-arg',	'preoldparent',	'struct iatt *'), -	('cbk-arg',	'postoldparent','struct iatt *'), +	('cbk-arg',	'postoldparent', 'struct iatt *'),  	('cbk-arg',	'prenewparent',	'struct iatt *'), -	('cbk-arg',	'postnewparent','struct iatt *'), +	('cbk-arg',	'postnewparent', 'struct iatt *'),  	('cbk-arg',	'xdata',		'dict_t *'),  	('journal',	'entry-op'),  ) @@ -716,31 +716,31 @@ def get_error_arg (type_str):  def get_subs (names, types, cbktypes=None):  	sdict = {} -	sdict["@SHORT_ARGS@"] = string.join(names,", ") +	sdict["@SHORT_ARGS@"] = string.join(names, ", ")  	# Convert two separate tuples to one of (name, type) sub-tuples. -	as_tuples = list(zip(types,names)) +	as_tuples = list(zip(types, names))  	# Convert each sub-tuple into a "type name" string. -	as_strings = list(map(string.join,as_tuples)) +	as_strings = list(map(string.join, as_tuples))  	# Join all of those into one big string. -	sdict["@LONG_ARGS@"] = string.join(as_strings,",\n\t") +	sdict["@LONG_ARGS@"] = string.join(as_strings, ",\n\t")  	# So much more readable than string.join(map(string.join,zip(...)))) -	sdict["@ERROR_ARGS@"] = string.join(list(map(get_error_arg,types)),", ") +	sdict["@ERROR_ARGS@"] = string.join(list(map(get_error_arg, types)), ", ")          if cbktypes is not None:                  sdict["@CBK_ERROR_ARGS@"] = string.join(list(map( -                                            get_error_arg,cbktypes)),", ") +                                            get_error_arg, cbktypes)), ", ")  	return sdict  def generate (tmpl, name, subs): -	text = tmpl.replace("@NAME@",name) +	text = tmpl.replace("@NAME@", name)  	if name == "writev":  		# More spurious inconsistency. -		text = text.replace("@UPNAME@","WRITE") +		text = text.replace("@UPNAME@", "WRITE")          elif name == "readv": -                text = text.replace("@UPNAME@","READ") +                text = text.replace("@UPNAME@", "READ")  	else: -		text = text.replace("@UPNAME@",name.upper()) +		text = text.replace("@UPNAME@", name.upper())  	for old, new in subs[name].iteritems(): -		text = text.replace(old,new) +		text = text.replace(old, new)  	# TBD: reindent/reformat the result for maximum readability.  	return  text @@ -753,12 +753,12 @@ for name, args in ops.iteritems():  	arg_names = [ a[1] for a in args if a[0] == 'fop-arg']  	arg_types = [ a[2] for a in args if a[0] == 'fop-arg']          cbk_types = [ a[2] for a in args if a[0] == 'cbk-arg'] -	fop_subs[name] = get_subs(arg_names,arg_types,cbk_types) +	fop_subs[name] = get_subs(arg_names, arg_types, cbk_types)  	# Same thing for callbacks.  	arg_names = [ a[1] for a in args if a[0] == 'cbk-arg']  	arg_types = [ a[2] for a in args if a[0] == 'cbk-arg'] -	cbk_subs[name] = get_subs(arg_names,arg_types) +	cbk_subs[name] = get_subs(arg_names, arg_types)  	# Callers can add other subs to these tables, or even create their  	# own tables, using these same techniques, and then pass the result  | 
