Author: Brian Kearns <bdkea...@gmail.com> Branch: Changeset: r69938:be547e30df19 Date: 2014-03-13 18:01 -0400 http://bitbucket.org/pypy/pypy/changeset/be547e30df19/
Log: cleanup diff --git a/pypy/module/micronumpy/base.py b/pypy/module/micronumpy/base.py --- a/pypy/module/micronumpy/base.py +++ b/pypy/module/micronumpy/base.py @@ -58,10 +58,10 @@ elif owning: # Will free storage when GCd impl = concrete.ConcreteArray(shape, dtype, order, strides, - backstrides, storage=storage) + backstrides, storage=storage) else: impl = concrete.ConcreteArrayNotOwning(shape, dtype, order, strides, - backstrides, storage) + backstrides, storage) if w_subtype: w_ret = space.allocate_instance(W_NDimArray, w_subtype) W_NDimArray.__init__(w_ret, impl) diff --git a/pypy/module/micronumpy/boxes.py b/pypy/module/micronumpy/boxes.py --- a/pypy/module/micronumpy/boxes.py +++ b/pypy/module/micronumpy/boxes.py @@ -87,7 +87,8 @@ value[0] = self.value builder = StringBuilder() - builder.append_charpsize(rffi.cast(rffi.CCHARP, value), rffi.sizeof(lltype.typeOf(self.value))) + builder.append_charpsize(rffi.cast(rffi.CCHARP, value), + rffi.sizeof(lltype.typeOf(self.value))) ret = builder.build() lltype.free(value, flavor="raw") @@ -117,7 +118,8 @@ value[1] = self.imag builder = StringBuilder() - builder.append_charpsize(rffi.cast(rffi.CCHARP, value), rffi.sizeof(lltype.typeOf(self.real)) * 2) + builder.append_charpsize(rffi.cast(rffi.CCHARP, value), + rffi.sizeof(lltype.typeOf(self.real)) * 2) ret = builder.build() lltype.free(value, flavor="raw") @@ -186,27 +188,27 @@ dtype = self.get_dtype(space) return space.wrap(dtype.itemtype.bool(self)) + def _unaryop_impl(ufunc_name): + def impl(self, space, w_out=None): + from pypy.module.micronumpy import ufuncs + return getattr(ufuncs.get(space), ufunc_name).call( + space, [self, w_out]) + return func_with_new_name(impl, "unaryop_%s_impl" % ufunc_name) + def _binop_impl(ufunc_name): def impl(self, space, w_other, w_out=None): from pypy.module.micronumpy import ufuncs - return getattr(ufuncs.get(space), ufunc_name).call(space, - [self, w_other, w_out]) + return getattr(ufuncs.get(space), ufunc_name).call( + space, [self, w_other, w_out]) return func_with_new_name(impl, "binop_%s_impl" % ufunc_name) def _binop_right_impl(ufunc_name): def impl(self, space, w_other, w_out=None): from pypy.module.micronumpy import ufuncs - return getattr(ufuncs.get(space), ufunc_name).call(space, - [w_other, self, w_out]) + return getattr(ufuncs.get(space), ufunc_name).call( + space, [w_other, self, w_out]) return func_with_new_name(impl, "binop_right_%s_impl" % ufunc_name) - def _unaryop_impl(ufunc_name): - def impl(self, space, w_out=None): - from pypy.module.micronumpy import ufuncs - return getattr(ufuncs.get(space), ufunc_name).call(space, - [self, w_out]) - return func_with_new_name(impl, "unaryop_%s_impl" % ufunc_name) - descr_add = _binop_impl("add") descr_sub = _binop_impl("subtract") descr_mul = _binop_impl("multiply") _______________________________________________ pypy-commit mailing list pypy-commit@python.org https://mail.python.org/mailman/listinfo/pypy-commit