ref: 50853b0dcfe55e0ddc478f98dee3cab9d41da263
parent: ccd03272897cd28af538c5f39453f9304c71a4e3
author: MartinHN <MartinHN@users.noreply.github.com>
date: Mon Jul 24 06:08:01 EDT 2017
Update gen_external.py gen_external : * fix unused variable in get_all_func_names_from_lib * use proper python syntax : 'is' and 'not in'
--- a/python/lib/gen_external.py
+++ b/python/lib/gen_external.py
@@ -118,7 +118,7 @@
while 1:
if i >= len(cpp_output):
break
- if ('{' in cpp_output[i - 1]) and (not '}' in cpp_output[i - 1]) or (not ';' in cpp_output[i - 1]):
+ if ('{' in cpp_output[i - 1]) and ('}' not in cpp_output[i - 1]) or (';' not in cpp_output[i - 1]):
cpp_output[i] = cpp_output[i - 1] + ' ' + cpp_output[i]
cpp_output.pop(i - 1)
elif ('}' in cpp_output[i]):
@@ -137,7 +137,7 @@
def get_cpp_objects_from_c_declarations(c_declarations, skip_objects=None):
- if skip_objects == None:
+ if skip_objects is None:
skip_objects = default_skip_objects
typedefs = filter(lambda y: y.startswith('typedef struct _aubio'), c_declarations)
cpp_objects = [a.split()[3][:-1] for a in typedefs]
@@ -145,14 +145,13 @@
return cpp_objects_filtered
-def get_all_func_names_from_lib(lib, depth=0):
+def get_all_func_names_from_lib(lib):
''' return flat string of all function used in lib
'''
res = []
- indent = " " * depth
- for k, v in lib.items():
+ for _, v in lib.items():
if isinstance(v, dict):
- res += get_all_func_names_from_lib(v, depth + 1)
+ res += get_all_func_names_from_lib(v)
elif isinstance(v, list):
for elem in v:
e = elem.split('(')