Commits

Brian Kearns committed 12d7e32

ones lives at python-level in numpy now

Comments (0)

Files changed (3)

pypy/module/micronumpy/__init__.py

         'array': 'interp_numarray.array',
         'zeros': 'interp_numarray.zeros',
         'empty': 'interp_numarray.zeros',
-        'ones': 'interp_numarray.ones',
         'empty_like': 'interp_numarray.empty_like',
         '_reconstruct' : 'interp_numarray._reconstruct',
         'scalar' : 'interp_numarray.build_scalar',

pypy/module/micronumpy/interp_numarray.py

     shape = _find_shape(space, w_shape, dtype)
     return W_NDimArray.from_shape(space, shape, dtype=dtype, order=order)
 
-@unwrap_spec(order=str)
-def ones(space, w_shape, w_dtype=None, order='C'):
-    dtype = space.interp_w(interp_dtype.W_Dtype,
-        space.call_function(space.gettypefor(interp_dtype.W_Dtype), w_dtype))
-    shape = _find_shape(space, w_shape, dtype)
-    w_arr = W_NDimArray.from_shape(space, shape, dtype=dtype, order=order)
-    w_arr.fill(space, dtype.box(1))
-    return w_arr
-
 @unwrap_spec(subok=bool)
 def empty_like(space, w_a, w_dtype=None, w_order=None, subok=True):
     w_a = convert_to_array(space, w_a)

pypy/module/micronumpy/test/dummy_module.py

 
 True_ = bool_(True)
 False_ = bool_(False)
+
+def ones(*args, **kwargs):
+    a = zeros(*args, **kwargs)
+    a.fill(1)
+    return a