[pypy-commit] pypy default: small cleanups

bdkearns noreply at buildbot.pypy.org
Fri Feb 15 12:00:07 CET 2013


Author: Brian Kearns <bdkearns at gmail.com>
Branch: 
Changeset: r61252:129254fd3ac3
Date: 2013-02-15 04:18 -0500
http://bitbucket.org/pypy/pypy/changeset/129254fd3ac3/

Log:	small cleanups

diff --git a/pypy/module/micronumpy/types.py b/pypy/module/micronumpy/types.py
--- a/pypy/module/micronumpy/types.py
+++ b/pypy/module/micronumpy/types.py
@@ -958,7 +958,6 @@
         swapped_value = byteswap(rffi.cast(self.T, value))
         raw_storage_setitem(storage, i + offset, swapped_value)
 
-
 class Float32(BaseType, Float):
     _attrs_ = ()
 
@@ -1505,7 +1504,6 @@
     BoxType = interp_boxes.W_Complex64Box
     ComponentBoxType = interp_boxes.W_Float32Box
 
-
 NonNativeComplex64 = Complex64
 
 class Complex128(ComplexFloating, BaseType):
@@ -1515,7 +1513,6 @@
     BoxType = interp_boxes.W_Complex128Box
     ComponentBoxType = interp_boxes.W_Float64Box
 
-
 NonNativeComplex128 = Complex128
 
 if interp_boxes.long_double_size == 12:
@@ -1537,8 +1534,7 @@
             pack_float80(result, value, 12, not native_is_bigendian)
             return self.box(unpack_float128(result.build(), native_is_bigendian))
 
-    class NonNativeFloat96(Float96):
-        pass
+    NonNativeFloat96 = Float96
 
     class Complex192(ComplexFloating, BaseType):
         _attrs_ = ()
@@ -1549,7 +1545,6 @@
 
     NonNativeComplex192 = Complex192
 
-
 elif interp_boxes.long_double_size == 16:
     class Float128(BaseType, Float):
         _attrs_ = ()
@@ -1578,7 +1573,6 @@
         BoxType = interp_boxes.W_Complex256Box
         ComponentBoxType = interp_boxes.W_Float128Box
 
-
     NonNativeComplex256 = Complex256
 
 class BaseStringType(object):
diff --git a/rpython/rlib/rstruct/test/test_ieee.py b/rpython/rlib/rstruct/test/test_ieee.py
--- a/rpython/rlib/rstruct/test/test_ieee.py
+++ b/rpython/rlib/rstruct/test/test_ieee.py
@@ -7,6 +7,7 @@
 from rpython.rlib.rfloat import isnan, NAN, INFINITY
 from rpython.translator.c.test.test_genc import compile
 
+
 class TestFloatPacking:
     def setup_class(cls):
         if sys.version_info < (2, 6):
@@ -16,11 +17,11 @@
         # check roundtrip
         Q = ieee.float_pack(x, 8)
         y = ieee.float_unpack(Q, 8)
-        assert repr(x) == repr(y)
+        assert repr(x) == repr(y), '%r != %r, Q=%r' % (x, y, Q)
 
         Q = ieee.float_pack80(x)
         y = ieee.float_unpack80(Q)
-        assert repr(x) == repr(y),'%r != %r, Q=%r'%(x, y, Q)
+        assert repr(x) == repr(y), '%r != %r, Q=%r' % (x, y, Q)
 
         # check that packing agrees with the struct module
         struct_pack8 = struct.unpack('<Q', struct.pack('<d', x))[0]
@@ -51,7 +52,7 @@
             return
 
         roundtrip = ieee.float_pack(ieee.float_unpack(float_pack2, 2), 2)
-        assert (float_pack2,x) == (roundtrip,x)
+        assert (float_pack2, x) == (roundtrip, x)
 
     def test_infinities(self):
         self.check_float(float('inf'))
@@ -140,9 +141,9 @@
 
     def test_halffloat_exact(self):
         #testcases generated from numpy.float16(x).view('uint16')
-        cases = [[0, 0], [10, 18688], [-10, 51456], [10e3, 28898], 
+        cases = [[0, 0], [10, 18688], [-10, 51456], [10e3, 28898],
                  [float('inf'), 31744], [-float('inf'), 64512]]
-        for c,h in cases:
+        for c, h in cases:
             hbit = ieee.float_pack(c, 2)
             assert hbit == h
             assert c == ieee.float_unpack(h, 2)
@@ -152,7 +153,7 @@
         cases = [[10.001, 18688, 10.], [-10.001, 51456, -10],
                  [0.027588, 10000, 0.027587890625],
                  [22001, 30047, 22000]]
-        for c,h,f in cases:
+        for c, h, f in cases:
             hbit = ieee.float_pack(c, 2)
             assert hbit == h
             assert f == ieee.float_unpack(h, 2)
@@ -169,6 +170,7 @@
             assert f_out == f2
             assert math.copysign(1., f_out) == math.copysign(1., f2)
 
+
 class TestCompiled:
     def test_pack_float(self):
         def pack(x, size):
@@ -180,6 +182,7 @@
                     l.append(str(ord(c)))
             return ','.join(l)
         c_pack = compile(pack, [float, int])
+
         def unpack(s):
             l = s.split(',')
             s = ''.join([chr(int(x)) for x in l])


More information about the pypy-commit mailing list