Author: Brian Kearns <bdkea...@gmail.com> Branch: Changeset: r69522:3c6f3f1e357c Date: 2014-02-27 07:55 -0500 http://bitbucket.org/pypy/pypy/changeset/3c6f3f1e357c/
Log: cleanup diff --git a/pypy/module/micronumpy/sort.py b/pypy/module/micronumpy/sort.py --- a/pypy/module/micronumpy/sort.py +++ b/pypy/module/micronumpy/sort.py @@ -1,6 +1,3 @@ -""" This is the implementation of various sorting routines in numpy. It's here -because it only makes sense on a concrete array -""" from pypy.interpreter.error import OperationError, oefmt from rpython.rlib.listsort import make_timsort_class from rpython.rlib.objectmodel import specialize @@ -15,6 +12,11 @@ INT_SIZE = rffi.sizeof(lltype.Signed) +all_types = (types.all_float_types + types.all_complex_types + + types.all_int_types) +all_types = [i for i in all_types if not issubclass(i[0], types.Float16)] +all_types = unrolling_iterable(all_types) + def make_argsort_function(space, itemtype, comp_type, count=1): TP = itemtype.T @@ -317,11 +319,6 @@ "sorting of non-numeric types '%s' is not implemented", arr.dtype.get_name()) -all_types = (types.all_float_types + types.all_complex_types + - types.all_int_types) -all_types = [i for i in all_types if not issubclass(i[0], types.Float16)] -all_types = unrolling_iterable(all_types) - class ArgSortCache(object): built = False diff --git a/pypy/module/micronumpy/ufuncs.py b/pypy/module/micronumpy/ufuncs.py --- a/pypy/module/micronumpy/ufuncs.py +++ b/pypy/module/micronumpy/ufuncs.py @@ -210,7 +210,7 @@ if out: dtype = out.get_dtype() temp = W_NDimArray.from_shape(space, temp_shape, dtype, - w_instance=obj) + w_instance=obj) elif keepdims: shape = obj_shape[:axis] + [1] + obj_shape[axis + 1:] else: @@ -236,25 +236,28 @@ ) dtype = out.get_dtype() else: - out = W_NDimArray.from_shape(space, shape, dtype, w_instance=obj) + out = W_NDimArray.from_shape(space, shape, dtype, + w_instance=obj) if obj.get_size() == 0: if self.identity is not None: out.fill(space, self.identity.convert_to(space, dtype)) return out - return loop.do_axis_reduce(space, shape, self.func, obj, dtype, axis, out, - self.identity, cumulative, temp) + return loop.do_axis_reduce(space, shape, self.func, obj, dtype, + axis, out, self.identity, cumulative, + temp) if cumulative: if out: if out.get_shape() != [obj.get_size()]: raise OperationError(space.w_ValueError, space.wrap( "out of incompatible size")) else: - out = W_NDimArray.from_shape(space, [obj.get_size()], dtype, w_instance=obj) + out = W_NDimArray.from_shape(space, [obj.get_size()], dtype, + w_instance=obj) loop.compute_reduce_cumulative(space, obj, out, dtype, self.func, - self.identity) + self.identity) return out if out: - if len(out.get_shape())>0: + if len(out.get_shape()) > 0: raise oefmt(space.w_ValueError, "output parameter for reduction operation %s has " "too many dimensions", self.name) @@ -266,7 +269,8 @@ return out if keepdims: shape = [1] * len(obj_shape) - out = W_NDimArray.from_shape(space, [1] * len(obj_shape), dtype, w_instance=obj) + out = W_NDimArray.from_shape(space, [1] * len(obj_shape), dtype, + w_instance=obj) out.implementation.setitem(0, res) return out return res @@ -278,6 +282,7 @@ raise OperationError(space.w_ValueError, space.wrap( "outer product only supported for binary functions")) + class W_Ufunc1(W_Ufunc): _immutable_fields_ = ["func", "bool_result"] argcount = 1 _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit