gen_external : * fix unused variable in get_all_func_names_from_lib * use proper python syntax : 'is' and 'not in'
Showing the changes to python/lib (1 of 1 file). Show all
Unified · Split
| @@ -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 | break | 120 | 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 | ||
| 139 | def get_cpp_objects_from_c_declarations(c_declarations, skip_objects=None): | 139 | def 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_objects | 141 | 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_filtered | 145 | return cpp_objects_filtered |
| 146 | 146 | ||
| 147 | 147 | ||
| 148 | def get_all_func_names_from_lib(lib, depth=0): | 148 | def get_all_func_names_from_lib(lib): |
| 149 | ''' return flat string of all function used in lib | 149 | ''' return flat string of all function used in lib |
| 150 | ''' | 150 | ''' |
| 151 | res = [] | 151 | res = [] |
| 152 | indent = " " * depth | 152 | 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('(') |