1. Pypy
  2. Untitled project
  3. pypy

Commits

Brian Kearns  committed 5369e4d

update app-level code for _numpypy submodules

  • Participants
  • Parent commits b8c9382
  • Branches cleanup-numpypy-namespace

Comments (0)

Files changed (10)

File lib_pypy/numpypy/core/__init__.py

View file
-import _numpypy
-from _numpypy import *
 import numeric
 from numeric import *
 import fromnumeric
 from shape_base import *
 
 from fromnumeric import amax as max, amin as min
-from _numpypy import absolute as abs
+from numeric import absolute as abs
 
 __all__ = []
-__all__ += _numpypy.__all__
 __all__ += numeric.__all__
 __all__ += fromnumeric.__all__
 __all__ += shape_base.__all__

File lib_pypy/numpypy/core/_methods.py

View file
 # Array methods which are called by the both the C-code for the method
 # and the Python code for the NumPy-namespace function
 
-#from numpy.core import multiarray as mu
-#from numpy.core import umath as um
-import _numpypy as mu
-um = mu
-from numpy.core.numeric import asanyarray
+import multiarray as mu
+import umath as um
+from numeric import asanyarray
 
 def _amax(a, axis=None, out=None, keepdims=False):
     return um.maximum.reduce(a, axis=axis,

File lib_pypy/numpypy/core/arrayprint.py

View file
 # and by Travis Oliphant  2005-8-22 for numpy
 
 import sys
-import _numpypy as _nt
-from _numpypy import maximum, minimum, absolute, not_equal, isnan, isinf
-#from _numpypy import format_longfloat, datetime_as_string, datetime_data
+import numerictypes as _nt
+from umath import maximum, minimum, absolute, not_equal, isnan, isinf
+#from multiarray import format_longfloat, datetime_as_string, datetime_data
 from fromnumeric import ravel
 
 

File lib_pypy/numpypy/core/multiarray.py

View file
-from _numpypy import set_string_function, typeinfo
+from _numpypy.multiarray import *

File lib_pypy/numpypy/core/numeric.py

View file
 __all__ = [
-           'ufunc',
-           'asanyarray', 'base_repr',
+           'newaxis', 'ufunc',
+           'asarray', 'asanyarray', 'base_repr',
            'array_repr', 'array_str', 'set_string_function',
-           'array_equal', 'asarray', 'outer', 'identity', 'little_endian',
+           'array_equal', 'outer', 'identity', 'little_endian',
            'Inf', 'inf', 'infty', 'Infinity', 'nan', 'NaN', 'False_', 'True_',
           ]
 
-from _numpypy import array, ndarray, int_, float_, bool_, flexible #, complex_# , longlong
-from _numpypy import concatenate, sin
-from .fromnumeric import any
 import sys
 import multiarray
+from multiarray import *
+del set_string_function
+del typeinfo
 import umath
 from umath import *
-from numpypy.core.arrayprint import array2string
-
-ufunc = type(sin)
+import numerictypes
+from numerictypes import *
 
 def extend_all(module):
     adict = {}
         if a not in adict:
             __all__.append(a)
 
+extend_all(multiarray)
+__all__.remove('typeinfo')
 extend_all(umath)
+extend_all(numerictypes)
 
 newaxis = None
+ufunc = type(sin)
 
 # XXX this file to be reviewed
 def seterr(**args):
         res.append('-')
     return ''.join(reversed(res or '0'))
 
+
+#Use numarray's printing function
+from arrayprint import array2string
+
 _typelessdata = [int_, float_]#, complex_]
 # XXX
 #if issubclass(intc, int):
     else:
         return multiarray.set_string_function(f, repr)
 
+set_string_function(array_str, 0)
+set_string_function(array_repr, 1)
+
+little_endian = (sys.byteorder == 'little')
+
 def array_equal(a1, a2):
     """
     True if two arrays have the same shape and elements, False otherwise.
     """
     return array(a, dtype, copy=False, order=order)
 
-set_string_function(array_str, 0)
-set_string_function(array_repr, 1)
-
-little_endian = (sys.byteorder == 'little')
-
-Inf = inf = infty = Infinity = PINF
-nan = NaN = NAN
-False_ = bool_(False)
-True_ = bool_(True)
-
 def outer(a,b):
     """
     Compute the outer product of two vectors.
     """
     from numpy import eye
     return eye(n, dtype=dtype)
+
+Inf = inf = infty = Infinity = PINF
+nan = NaN = NAN
+False_ = bool_(False)
+True_ = bool_(True)
+
+import fromnumeric
+from fromnumeric import *
+extend_all(fromnumeric)

File lib_pypy/numpypy/core/shape_base.py

View file
 __all__ = ['atleast_1d', 'atleast_2d', 'atleast_3d', 'vstack', 'hstack']
 
-import _numpypy
+import numeric as _nx
 from numeric import array, asanyarray, newaxis
 
 def atleast_1d(*arys):
            [4]])
 
     """
-    return _numpypy.concatenate(map(atleast_2d,tup),0)
+    return _nx.concatenate(map(atleast_2d,tup),0)
 
 def hstack(tup):
     """
     arrs = map(atleast_1d,tup)
     # As a special case, dimension 0 of 1-dimensional arrays is "horizontal"
     if arrs[0].ndim == 1:
-        return _numpypy.concatenate(arrs, 0)
+        return _nx.concatenate(arrs, 0)
     else:
-        return _numpypy.concatenate(arrs, 1)
+        return _nx.concatenate(arrs, 1)

File lib_pypy/numpypy/core/umath.py

View file
+from _numpypy.umath import *
+
 import math
 e = math.e
 pi = math.pi

File lib_pypy/numpypy/lib/function_base.py

View file
 __all__ = ['average']
 
-from _numpypy import array
+from ..core.numeric import array
 
 def average(a):
     # This implements a weighted average, for now we don't implement the

File lib_pypy/numpypy/lib/shape_base.py

View file
 __all__ = ['dstack']
 
-import numpypy.core.numeric as _nx
-from numpypy.core import atleast_3d
+from ..core import numeric as _nx
+from ..core import atleast_3d
 
 def dstack(tup):
     """

File lib_pypy/numpypy/lib/twodim_base.py

View file
 __all__ = ['eye']
 
-from _numpypy import zeros
+from ..core.numeric import zeros
 
 def eye(N, M=None, k=0, dtype=float):
     """