Changeset 4041a6d for python/lib
- Timestamp:
- Apr 18, 2016, 10:48:53 PM (9 years ago)
- Branches:
- feature/autosink, feature/cnn, feature/cnn_org, feature/constantq, feature/crepe, feature/crepe_org, feature/pitchshift, feature/pydocstrings, feature/timestretch, fix/ffmpeg5, master, pitchshift, sampler, timestretch, yinfft+
- Children:
- 2e4ae1d
- Parents:
- 7c785e6 (diff), b8ed85e (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- python/lib
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
python/lib/aubio/midiconv.py
r7c785e6 r4041a6d 7 7 _valid_octaves = range(-1, 10) 8 8 if type(note) not in (str, unicode): 9 raise TypeError , "a string is required, got %s" % note9 raise TypeError("a string is required, got %s" % note) 10 10 if not (1 < len(note) < 5): 11 raise ValueError, "string of 2 to 4 characters expected, got %d (%s)" % (len(note), note) 11 raise ValueError( 12 "string of 2 to 4 characters expected, got %d (%s)" % 13 (len(note), note)) 12 14 notename, modifier, octave = [None]*3 13 15 … … 27 29 28 30 if notename not in _valid_notenames: 29 raise ValueError , "%s is not a valid note name" % notename31 raise ValueError("%s is not a valid note name" % notename) 30 32 if modifier not in _valid_modifiers: 31 raise ValueError , "%s is not a valid modifier" % modifier33 raise ValueError("%s is not a valid modifier" % modifier) 32 34 if octave not in _valid_octaves: 33 raise ValueError , "%s is not a valid octave" % octave35 raise ValueError("%s is not a valid octave" % octave) 34 36 35 37 midi = 12 + octave * 12 + _valid_notenames[notename] + _valid_modifiers[modifier] 36 38 if midi > 127: 37 raise ValueError , "%s is outside of the range C-2 to G8" % note39 raise ValueError("%s is outside of the range C-2 to G8" % note) 38 40 return midi 39 41 … … 41 43 " convert midi note number to note name, e.g. [0, 127] -> [C-1, G9] " 42 44 if type(midi) != int: 43 raise TypeError , "an integer is required, got %s" % midi45 raise TypeError("an integer is required, got %s" % midi) 44 46 if not (-1 < midi < 128): 45 raise ValueError, "an integer between 0 and 127 is excepted, got %d" % midi 47 raise ValueError( 48 "an integer between 0 and 127 is excepted, got %d" % midi) 46 49 midi = int(midi) 47 50 _valid_notenames = ['C', 'C#', 'D', 'D#', 'E', 'F', 'F#', 'G', 'G#', 'A', 'A#', 'B'] -
python/lib/gen_pyobject.py
r7c785e6 r4041a6d 71 71 returns: [['int', 'argc'], ['char **','argv']] 72 72 """ 73 return map(split_type, get_params(proto))73 return list(map(split_type, get_params(proto))) 74 74 75 75 def get_return_type(proto): -
python/lib/generator.py
r7c785e6 r4041a6d 4 4 5 5 import os, sys, shutil 6 from gen_pyobject import write_msg, gen_new_init, gen_do, gen_members, gen_methods, gen_finish6 from .gen_pyobject import write_msg, gen_new_init, gen_do, gen_members, gen_methods, gen_finish 7 7 8 8 def get_cpp_objects(): … … 12 12 cpp_output = filter(lambda y: len(y) > 1, cpp_output) 13 13 cpp_output = filter(lambda y: not y.startswith('#'), cpp_output) 14 cpp_output = list(cpp_output) 14 15 15 16 i = 1 … … 86 87 object_methods = [a.strip() for a in object_methods] 87 88 object_methods = filter(lambda x: not x.startswith('typedef'), object_methods) 89 object_methods = list(object_methods) 88 90 #for method in object_methods: 89 91 # write_msg(method) 90 new_methods = filter(lambda x: 'new_'+object_name in x, object_methods) 92 new_methods = list(filter( 93 lambda x: 'new_'+object_name in x, object_methods)) 91 94 if len(new_methods) > 1: 92 95 write_msg("-- WARNING: more than one new method for", object_name) … … 99 102 write_msg(method) 100 103 101 del_methods = filter(lambda x: 'del_'+object_name in x, object_methods) 104 del_methods = list(filter( 105 lambda x: 'del_'+object_name in x, object_methods)) 102 106 if len(del_methods) > 1: 103 107 write_msg("-- WARNING: more than one del method for", object_name) … … 107 111 write_msg("-- WARNING: no del method for", object_name) 108 112 109 do_methods = filter(lambda x: object_name+'_do' in x, object_methods) 113 do_methods = list(filter( 114 lambda x: object_name+'_do' in x, object_methods)) 110 115 if len(do_methods) > 1: 111 116 pass … … 136 141 other_methods = filter(lambda x: x not in get_methods, other_methods) 137 142 other_methods = filter(lambda x: x not in set_methods, other_methods) 143 other_methods = list(other_methods) 138 144 139 145 if len(other_methods) > 0:
Note: See TracChangeset
for help on using the changeset viewer.