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/lib (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
118 while 1:118 while 1:
119 if i >= len(cpp_output):119 if i >= len(cpp_output):
120 break120 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]):
122 cpp_output[i] = cpp_output[i - 1] + ' ' + cpp_output[i]122 cpp_output[i] = cpp_output[i - 1] + ' ' + cpp_output[i]
123 cpp_output.pop(i - 1)123 cpp_output.pop(i - 1)
124 elif ('}' in cpp_output[i]):124 elif ('}' in cpp_output[i]):
@@ -137,7 +137,7 @@ def get_c_declarations(header=header, usedouble=False): · 12 unmodified lines
137 137
138 138
139def get_cpp_objects_from_c_declarations(c_declarations, skip_objects=None):139def get_cpp_objects_from_c_declarations(c_declarations, skip_objects=None):
140 if skip_objects == None:140 if skip_objects is None:
141 skip_objects = default_skip_objects141 skip_objects = default_skip_objects
142 typedefs = filter(lambda y: y.startswith('typedef struct _aubio'), c_declarations)142 typedefs = filter(lambda y: y.startswith('typedef struct _aubio'), c_declarations)
143 cpp_objects = [a.split()[3][:-1] for a in typedefs]143 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
145 return cpp_objects_filtered145 return cpp_objects_filtered
146 146
147 147
148def get_all_func_names_from_lib(lib, depth=0):148def get_all_func_names_from_lib(lib):
149 ''' return flat string of all function used in lib149 ''' return flat string of all function used in lib
150 '''150 '''
151 res = []151 res = []
152 indent = " " * depth152 for _, v in lib.items():
153 for k, v in lib.items():
154 if isinstance(v, dict):153 if isinstance(v, dict):
155 res += get_all_func_names_from_lib(v, depth + 1)154 res += get_all_func_names_from_lib(v)
156 elif isinstance(v, list):155 elif isinstance(v, list):
157 for elem in v:156 for elem in v:
158 e = elem.split('(')157 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