History

python/lib/aubio/__init__.py: make sure length is not zero and float_type is imported

Paul Brossier committed 10 years ago

Commit b96a7b81 parent 0df6e9e1 file · +3 −0Browse files

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

Unified · Split

python/lib/aubio/__init__.py+3−0
@@ -2,6 +2,7 @@ · 1 unmodified line
22
33 import numpy
44 from ._aubio import *
5+from ._aubio import float_type
56 from .midiconv import *
67 from .slicing import *
78
@@ -10,6 +11,8 @@ class fvec(numpy.ndarray): · 2 unmodified lines
1011
1112 def __new__(cls, input_arg=1024, **kwargs):
1213 if isinstance(input_arg, int):
14+ if input_arg == 0:
15+ raise ValueError("vector length of 1 or more expected")
1316 return numpy.zeros(input_arg, dtype=float_type, **kwargs)
1417 else:
1518 return numpy.array(input_arg, dtype=float_type, **kwargs)

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