style: run autopep8 on python files

This commit is contained in:
Anna Lyons
2019-03-27 10:26:39 +11:00
parent 305b5f9c3d
commit cf57914c7f
11 changed files with 1124 additions and 904 deletions

View File

@@ -30,6 +30,7 @@ WORD_SIZE = 32
FN_DECL_PREFIX = "static inline"
DEFAULT_RETURN_TYPE = "int"
def init_all_types():
"""
Return an array of all c types involved in the sel4 interface
@@ -40,6 +41,7 @@ def init_all_types():
return data_types + arch_types
def generate_prototype(interface_name, method_name, method_id, inputs, outputs, comment):
"""
Returns a string containing a commented function prototype based on its arguments
@@ -56,6 +58,7 @@ def generate_prototype(interface_name, method_name, method_id, inputs, outputs,
return "%s\n%s %s %s(%s);" % (comment, prefix, return_type, name, param_list)
def gen_invocations(input_files, output_file):
"""
Given a collection of input xml files describing sel4 interfaces,
@@ -86,7 +89,8 @@ def gen_invocations(input_files, output_file):
output_file.write("/** @} */\n")
for (interface_name, method_name, method_id, inputs, outputs, _, comment) in methods:
prototype = "/**\n * @addtogroup %s %s\n * @{\n */\n\n" % (group_id, group_name)
prototype += generate_prototype(interface_name, method_name, method_id, inputs, outputs, comment)
prototype += generate_prototype(interface_name,
method_name, method_id, inputs, outputs, comment)
prototype += "/** @} */\n"
prototypes.append(prototype)
@@ -96,10 +100,11 @@ def gen_invocations(input_files, output_file):
for prototype in prototypes:
output_file.write(prototype)
output_file.write("\n\n");
output_file.write("\n\n")
output_file.write("/** @} */\n")
def process_args():
usage_str = "%(prog)s [OPTIONS] [FILES]"
@@ -118,6 +123,7 @@ def process_args():
return parser
def main():
parser = process_args()
args = parser.parse_args()
@@ -137,5 +143,6 @@ def main():
with open(args.output, "w") as output:
gen_invocations(args.files, output)
if __name__ == "__main__":
sys.exit(main())