History

Update gen_external.py

gen_external : * fix unused variable in get_all_func_names_from_lib * use proper python syntax : 'is' and 'not in'

MartinHN committed 9 years ago

Commit 50853b01 parent ccd03271 file · +5 −6Browse files

Showing the changes to python (1 of 1 file). Show all

Unified · Split

python/lib/gen_external.py+5−6
@@ -118,7 +118,7 @@ def get_c_declarations(header=header, usedouble=False): · 117 unmodified lines
118118 while 1:
119119 if i >= len(cpp_output):
120120 break
121− if ('{' in cpp_output[i - 1]) and (not '}' in cpp_output[i - 1]) or (not ';' in cpp_output[i - 1]):
121+ if ('{' in cpp_output[i - 1]) and ('}' not in cpp_output[i - 1]) or (';' not in cpp_output[i - 1]):
122122 cpp_output[i] = cpp_output[i - 1] + ' ' + cpp_output[i]
123123 cpp_output.pop(i - 1)
124124 elif ('}' in cpp_output[i]):
@@ -137,7 +137,7 @@ def get_c_declarations(header=header, usedouble=False): · 12 unmodified lines
137137
138138
139139 def get_cpp_objects_from_c_declarations(c_declarations, skip_objects=None):
140− if skip_objects == None:
140+ if skip_objects is None:
141141 skip_objects = default_skip_objects
142142 typedefs = filter(lambda y: y.startswith('typedef struct _aubio'), c_declarations)
143143 cpp_objects = [a.split()[3][:-1] for a in typedefs]
@@ -145,14 +145,13 @@ def get_cpp_objects_from_c_declarations(c_declarations, skip_objects=None): · 1 unmodified line
145145 return cpp_objects_filtered
146146
147147
148−def get_all_func_names_from_lib(lib, depth=0):
148+def get_all_func_names_from_lib(lib):
149149 ''' return flat string of all function used in lib
150150 '''
151151 res = []
152− indent = " " * depth
153− for k, v in lib.items():
152+ for _, v in lib.items():
154153 if isinstance(v, dict):
155− res += get_all_func_names_from_lib(v, depth + 1)
154+ res += get_all_func_names_from_lib(v)
156155 elif isinstance(v, list):
157156 for elem in v:
158157 e = elem.split('(')

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t