summaryrefslogtreecommitdiff
path: root/numpy/numarray/util.py
diff options
context:
space:
mode:
authorAlan McIntyre <alan.mcintyre@local>2008-09-13 03:40:57 +0000
committerAlan McIntyre <alan.mcintyre@local>2008-09-13 03:40:57 +0000
commite091c840e101eb620307747e0e4cd1b939d8abe6 (patch)
tree378e691843fe1d56e224266b0c8e5478e1327433 /numpy/numarray/util.py
parentb1e2466272fa0c2ee08701c3d86a03088218b69e (diff)
downloadnumpy-e091c840e101eb620307747e0e4cd1b939d8abe6.tar.gz
Removed unused/duplicate imports.
Removed repeated members of __all__. Fixed reference to undefined "out" in functions.py:take function. Fixed references to undefined "N" in functions.py. Rewrapped lines to conform to PEP8. Fixed references to undefined FPE_* constants (from numpy) in util.py.
Diffstat (limited to 'numpy/numarray/util.py')
-rw-r--r--numpy/numarray/util.py19
1 files changed, 9 insertions, 10 deletions
diff --git a/numpy/numarray/util.py b/numpy/numarray/util.py
index 2a7efb60d..01002f194 100644
--- a/numpy/numarray/util.py
+++ b/numpy/numarray/util.py
@@ -1,7 +1,8 @@
-from numpy import geterr
+import os
+import numpy
-__all__ = ['MathDomainError', 'UnderflowError', 'NumOverflowError', 'handleError',
- 'get_numarray_include_dirs']
+__all__ = ['MathDomainError', 'UnderflowError', 'NumOverflowError',
+ 'handleError', 'get_numarray_include_dirs']
class MathDomainError(ArithmeticError): pass
class UnderflowError(ArithmeticError): pass
@@ -9,31 +10,29 @@ class NumOverflowError(OverflowError, ArithmeticError): pass
def handleError(errorStatus, sourcemsg):
"""Take error status and use error mode to handle it."""
- modes = geterr()
- if errorStatus & FPE_INVALID:
+ modes = numpy.geterr()
+ if errorStatus & numpy.FPE_INVALID:
if modes['invalid'] == "warn":
print "Warning: Encountered invalid numeric result(s)", sourcemsg
if modes['invalid'] == "raise":
raise MathDomainError(sourcemsg)
- if errorStatus & FPE_DIVIDEBYZERO:
+ if errorStatus & numpy.FPE_DIVIDEBYZERO:
if modes['dividebyzero'] == "warn":
print "Warning: Encountered divide by zero(s)", sourcemsg
if modes['dividebyzero'] == "raise":
raise ZeroDivisionError(sourcemsg)
- if errorStatus & FPE_OVERFLOW:
+ if errorStatus & numpy.FPE_OVERFLOW:
if modes['overflow'] == "warn":
print "Warning: Encountered overflow(s)", sourcemsg
if modes['overflow'] == "raise":
raise NumOverflowError(sourcemsg)
- if errorStatus & FPE_UNDERFLOW:
+ if errorStatus & numpy.FPE_UNDERFLOW:
if modes['underflow'] == "warn":
print "Warning: Encountered underflow(s)", sourcemsg
if modes['underflow'] == "raise":
raise UnderflowError(sourcemsg)
-import os
-import numpy
def get_numarray_include_dirs():
base = os.path.dirname(numpy.__file__)
newdirs = [os.path.join(base, 'numarray')]