diff options
author | David Cournapeau <cournape@gmail.com> | 2009-09-16 07:14:48 +0000 |
---|---|---|
committer | David Cournapeau <cournape@gmail.com> | 2009-09-16 07:14:48 +0000 |
commit | 064d50496ce946cb54e0901ac10967d9e0126b20 (patch) | |
tree | 84b41e7e95bf4b9b34a0da92fa9133665e50d48e | |
parent | 1c321def2841860d97cd335a6a34fc8abed4a548 (diff) | |
download | numpy-064d50496ce946cb54e0901ac10967d9e0126b20.tar.gz |
Move finfo into core.
-rw-r--r-- | numpy/core/__init__.py | 4 | ||||
-rw-r--r-- | numpy/core/getlimits.py (renamed from numpy/lib/getlimits.py) | 17 | ||||
-rw-r--r-- | numpy/core/machar.py (renamed from numpy/lib/machar.py) | 0 | ||||
-rw-r--r-- | numpy/core/tests/test_getlimits.py (renamed from numpy/lib/tests/test_getlimits.py) | 2 | ||||
-rw-r--r-- | numpy/core/tests/test_machar.py (renamed from numpy/lib/tests/test_machar.py) | 2 | ||||
-rw-r--r-- | numpy/lib/__init__.py | 4 | ||||
-rw-r--r-- | numpy/lib/polynomial.py | 3 | ||||
-rw-r--r-- | numpy/lib/type_check.py | 4 |
8 files changed, 17 insertions, 19 deletions
diff --git a/numpy/core/__init__.py b/numpy/core/__init__.py index 39ce94ac4..1118d4c56 100644 --- a/numpy/core/__init__.py +++ b/numpy/core/__init__.py @@ -17,6 +17,8 @@ from memmap import * from defchararray import * import scalarmath from function_base import * +from machar import * +from getlimits import * del nt from fromnumeric import amax as max, amin as min, \ @@ -29,6 +31,8 @@ __all__ += fromnumeric.__all__ __all__ += rec.__all__ __all__ += char.__all__ __all__ += function_base.__all__ +__all__ += machar.__all__ +__all__ += getlimits.__all__ from numpy.testing import Tester diff --git a/numpy/lib/getlimits.py b/numpy/core/getlimits.py index ccb0e2b3d..7d9034e58 100644 --- a/numpy/lib/getlimits.py +++ b/numpy/core/getlimits.py @@ -4,10 +4,9 @@ __all__ = ['finfo','iinfo'] from machar import MachAr -import numpy.core.numeric as numeric -import numpy.core.numerictypes as ntypes -from numpy.core.numeric import array -import numpy as np +import numeric +import numerictypes as ntypes +from numeric import array def _frz(a): """fix rank-0 --> rank-1""" @@ -89,10 +88,10 @@ class finfo(object): def __new__(cls, dtype): try: - dtype = np.dtype(dtype) + dtype = numeric.dtype(dtype) except TypeError: # In case a float instance was given - dtype = np.dtype(type(dtype)) + dtype = numeric.dtype(type(dtype)) obj = cls._finfo_cache.get(dtype,None) if obj is not None: @@ -121,7 +120,7 @@ class finfo(object): return obj def _init(self, dtype): - self.dtype = np.dtype(dtype) + self.dtype = numeric.dtype(dtype) if dtype is ntypes.double: itype = ntypes.int64 fmt = '%24.16e' @@ -228,9 +227,9 @@ class iinfo: def __init__(self, int_type): try: - self.dtype = np.dtype(int_type) + self.dtype = numeric.dtype(int_type) except TypeError: - self.dtype = np.dtype(type(int_type)) + self.dtype = numeric.dtype(type(int_type)) self.kind = self.dtype.kind self.bits = self.dtype.itemsize * 8 self.key = "%s%d" % (self.kind, self.bits) diff --git a/numpy/lib/machar.py b/numpy/core/machar.py index facade612..facade612 100644 --- a/numpy/lib/machar.py +++ b/numpy/core/machar.py diff --git a/numpy/lib/tests/test_getlimits.py b/numpy/core/tests/test_getlimits.py index 325e5a444..96f5fc882 100644 --- a/numpy/lib/tests/test_getlimits.py +++ b/numpy/core/tests/test_getlimits.py @@ -4,7 +4,7 @@ from numpy.testing import * import numpy.lib reload(numpy.lib) -from numpy.lib.getlimits import finfo, iinfo +from numpy.core import finfo, iinfo from numpy import single,double,longdouble import numpy as np diff --git a/numpy/lib/tests/test_machar.py b/numpy/core/tests/test_machar.py index 64abf7236..4175ceeac 100644 --- a/numpy/lib/tests/test_machar.py +++ b/numpy/core/tests/test_machar.py @@ -1,6 +1,6 @@ from numpy.testing import * -from numpy.lib.machar import MachAr +from numpy.core.machar import MachAr import numpy.core.numerictypes as ntypes from numpy import seterr, array diff --git a/numpy/lib/__init__.py b/numpy/lib/__init__.py index 07f6d5c27..5af08b23f 100644 --- a/numpy/lib/__init__.py +++ b/numpy/lib/__init__.py @@ -11,8 +11,6 @@ from ufunclike import * import scimath as emath from polynomial import * -from machar import * -from getlimits import * #import convertcode from utils import * from arraysetops import * @@ -30,8 +28,6 @@ __all__ += stride_tricks.__all__ __all__ += twodim_base.__all__ __all__ += ufunclike.__all__ __all__ += polynomial.__all__ -__all__ += machar.__all__ -__all__ += getlimits.__all__ __all__ += utils.__all__ __all__ += arraysetops.__all__ __all__ += io.__all__ diff --git a/numpy/lib/polynomial.py b/numpy/lib/polynomial.py index 6a2b5f18a..a97c07e87 100644 --- a/numpy/lib/polynomial.py +++ b/numpy/lib/polynomial.py @@ -10,8 +10,7 @@ import re import warnings import numpy.core.numeric as NX -from numpy.core import isscalar, abs -from numpy.lib.getlimits import finfo +from numpy.core import isscalar, abs, finfo from numpy.lib.twodim_base import diag, vander from numpy.lib.shape_base import hstack, atleast_1d from numpy.lib.function_base import trim_zeros, sort_complex diff --git a/numpy/lib/type_check.py b/numpy/lib/type_check.py index 69f4f2193..5dfe6330b 100644 --- a/numpy/lib/type_check.py +++ b/numpy/lib/type_check.py @@ -275,7 +275,7 @@ def isrealobj(x): #----------------------------------------------------------------------------- def _getmaxmin(t): - import getlimits + from numpy.core import getlimits f = getlimits.finfo(t) return f.max, f.min @@ -400,7 +400,7 @@ def real_if_close(a,tol=100): if not issubclass(a.dtype.type, _nx.complexfloating): return a if tol > 1: - import getlimits + from numpy.core import getlimits f = getlimits.finfo(a.dtype.type) tol = f.eps * tol if _nx.allclose(a.imag, 0, atol=tol): |