History

python/lib/gen_external.py: split long functions

Paul Brossier committed 8 years ago

Commit d2141241 parent 8ced1e81 file · +11 −1Browse files

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

Unified · Split

python/lib/gen_external.py+11−1
@@ -85,6 +85,12 @@ def get_preprocessor(): · 84 unmodified lines
85def get_c_declarations(header=header, usedouble=False):85def get_c_declarations(header=header, usedouble=False):
86 ''' return a dense and preprocessed string of all c declarations implied by aubio.h86 ''' return a dense and preprocessed string of all c declarations implied by aubio.h
87 '''87 '''
88 cpp_output = get_cpp_output(header=header, usedouble=usedouble)
89 return filter_cpp_output (cpp_output)
90
91
92def get_cpp_output(header=header, usedouble=False):
93 ''' find and run a C pre-processor on aubio.h '''
88 cpp_cmd = get_preprocessor()94 cpp_cmd = get_preprocessor()
89 95
90 macros = [('AUBIO_UNSTABLE', 1)]96 macros = [('AUBIO_UNSTABLE', 1)]
@@ -119,7 +125,11 @@ def get_c_declarations(header=header, usedouble=False): · 28 unmodified lines
119 if not isinstance(cpp_output, list):125 if not isinstance(cpp_output, list):
120 cpp_output = [l.strip() for l in cpp_output.decode('utf8').split('\n')]126 cpp_output = [l.strip() for l in cpp_output.decode('utf8').split('\n')]
121 127
122 cpp_output = filter(lambda y: len(y) > 1, cpp_output)128 return cpp_output
129
130def filter_cpp_output(cpp_raw_output):
131 ''' prepare cpp-output for parsing '''
132 cpp_output = filter(lambda y: len(y) > 1, cpp_raw_output)
123 cpp_output = list(filter(lambda y: not y.startswith('#'), cpp_output))133 cpp_output = list(filter(lambda y: not y.startswith('#'), cpp_output))
124 134
125 i = 1135 i = 1

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