Author: Alex Gaynor <[email protected]>
Branch: kill-someobject
Changeset: r57888:ff4dd9fb4bad
Date: 2012-10-08 12:00 +0200
http://bitbucket.org/pypy/pypy/changeset/ff4dd9fb4bad/

Log:    remove some import * and other general cleanups

diff --git a/pypy/rpython/test/test_exception.py 
b/pypy/rpython/test/test_exception.py
--- a/pypy/rpython/test/test_exception.py
+++ b/pypy/rpython/test/test_exception.py
@@ -1,10 +1,11 @@
 import py
+
 from pypy.translator.translator import TranslationContext
-from pypy.rpython.lltypesystem.lltype import *
 from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
 from pypy.rpython.llinterp import LLException
 from pypy.rpython.error import MissingRTypeOperation
 
+
 class MyException(Exception):
     pass
 
diff --git a/pypy/rpython/test/test_llann.py b/pypy/rpython/test/test_llann.py
--- a/pypy/rpython/test/test_llann.py
+++ b/pypy/rpython/test/test_llann.py
@@ -1,20 +1,18 @@
 import py
+
+from pypy.annotation import model as annmodel
+from pypy.conftest import option
+from pypy.objspace.flow.objspace import FlowObjSpace
+from pypy.rpython.annlowlevel import (annotate_lowlevel_helper,
+    MixLevelHelperAnnotator, PseudoHighLevelCallable, llhelper,
+    cast_instance_to_base_ptr, cast_base_ptr_to_instance, base_ptr_lltype)
+from pypy.rpython.llinterp import LLInterpreter
 from pypy.rpython.lltypesystem.lltype import *
 from pypy.rpython.ootypesystem import ootype
-from pypy.rpython.lltypesystem.rclass import OBJECTPTR
 from pypy.rpython.rclass import fishllattr
+from pypy.rpython.test.test_llinterp import interpret
 from pypy.translator.translator import TranslationContext
-from pypy.annotation import model as annmodel
-from pypy.rpython.annlowlevel import annotate_lowlevel_helper
-from pypy.rpython.annlowlevel import MixLevelHelperAnnotator
-from pypy.rpython.annlowlevel import PseudoHighLevelCallable
-from pypy.rpython.annlowlevel import llhelper, cast_instance_to_base_ptr
-from pypy.rpython.annlowlevel import cast_base_ptr_to_instance
-from pypy.rpython.annlowlevel import base_ptr_lltype
-from pypy.rpython.llinterp import LLInterpreter
-from pypy.rpython.test.test_llinterp import interpret
-from pypy.objspace.flow.objspace import FlowObjSpace 
-from pypy.conftest import option
+
 
 # helpers
 
@@ -24,15 +22,17 @@
             if op.opname in ops:
                 yield op
 
+
 def derived(op, orig):
     if op.args[0].value.__name__.startswith(orig):
         return op.args[0].value
     else:
         return None
 
+
 class TestLowLevelAnnotateTestCase:
-    def setup_class(cls): 
-        cls.space = FlowObjSpace() 
+    def setup_class(cls):
+        cls.space = FlowObjSpace()
 
     from pypy.annotation.annrpython import RPythonAnnotator
 
@@ -53,7 +53,7 @@
 
     def test_simple2(self):
         S = Struct("s", ('v', Signed))
-        S2 = GcStruct("s2", ('a',S), ('b',S))
+        S2 = GcStruct("s2", ('a', S), ('b', S))
         def llf():
             s = malloc(S2)
             return s.a.v+s.b.v
@@ -93,8 +93,8 @@
             a[0] = 3
             return a[0]
         s = self.annotate(llf, [])
-        assert s.knowntype == int        
-        
+        assert s.knowntype == int
+
     def test_cast_simple_widening(self):
         S2 = Struct("s2", ('a', Signed))
         S1 = Struct("s1", ('sub1', S2), ('sub2', S2))
@@ -141,7 +141,7 @@
             return p12, p13, p21, p23, p31, p32
         s = self.annotate(llf, [])
         assert [x.ll_ptrtype for x in s.items] == [PS1, PS1, PS2, PS2, PS3, 
PS3]
-            
+
 
     def test_array_length(self):
         A = GcArray(('v', Signed))
@@ -158,7 +158,7 @@
             return p(0)
         s = self.annotate(llf, [annmodel.SomePtr(PF)])
         assert s.knowntype == int
- 
+
 
     def test_ll_calling_ll(self):
         A = GcArray(Float)
@@ -194,13 +194,13 @@
                 if (func, T) in seen:
                     continue
                 seen[func, T] = True
-                
+
                 desc = a.bookkeeper.getdesc(func)
                 g = desc.specialize([a.binding(x) for x in call.args[1:]])
 
                 args = g.getargs()
                 rv = g.getreturnvar()
-                if func is ll_get:                    
+                if func is ll_get:
                     vT, vp, vi = args
                     assert a.binding(vT) == a.bookkeeper.immutablevalue(T)
                     assert a.binding(vi).knowntype == int
@@ -218,7 +218,7 @@
         assert len(seen) == 4
 
         return a, vTs # reused by a test in test_rtyper
- 
+
     def test_ll_calling_ll2(self):
         A = GcArray(Float)
         B = GcArray(Signed)
@@ -252,7 +252,7 @@
                 return s.const
             else:
                 return s.ll_ptrtype
-        
+
         vTs = []
 
         for call in annotated_calls(a):
@@ -359,7 +359,7 @@
         s = self.annotate(llf, [annmodel.SomePtr(Ptr(S))])
         assert isinstance(s, annmodel.SomePtr)
         assert s.ll_ptrtype == Ptr(RuntimeTypeInfo)
-        
+
     def test_cast_primitive(self):
         def llf(u):
             return cast_primitive(Signed, u)
@@ -454,7 +454,7 @@
 
     F = Ptr(FuncType([Ptr(S), Signed], Signed))
     G = Ptr(FuncType([Ptr(S)], Signed))
-        
+
     def h(x, y, z):
         s = malloc(S)
         s.x = x
@@ -479,7 +479,7 @@
 
     F = ootype.StaticMethod([S, Signed], Signed)
     G = ootype.StaticMethod([S], Signed)
-        
+
     def h(x, y, z):
         s = ootype.new(S)
         s.x = x
diff --git a/pypy/rpython/test/test_rbuilder.py 
b/pypy/rpython/test/test_rbuilder.py
--- a/pypy/rpython/test/test_rbuilder.py
+++ b/pypy/rpython/test/test_rbuilder.py
@@ -1,10 +1,11 @@
 from __future__ import with_statement
+
 import py
 
 from pypy.rlib.rstring import StringBuilder, UnicodeBuilder
 from pypy.rpython.annlowlevel import llstr, hlstr
 from pypy.rpython.lltypesystem import rffi
-from pypy.rpython.lltypesystem.rbuilder import *
+from pypy.rpython.lltypesystem.rbuilder import StringBuilderRepr
 from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
 
 
@@ -23,6 +24,7 @@
         StringBuilderRepr.ll_append(sb, llstr("abc"))
         assert StringBuilderRepr.ll_build(sb) == sb.buf
 
+
 class BaseTestStringBuilder(BaseRtypingTest):
     def test_simple(self):
         def func():
diff --git a/pypy/rpython/test/test_rclass.py b/pypy/rpython/test/test_rclass.py
--- a/pypy/rpython/test/test_rclass.py
+++ b/pypy/rpython/test/test_rclass.py
@@ -1,14 +1,18 @@
+import sys
+
 import py
-import sys
+
+from pypy.objspace.flow.model import summary
+from pypy.rlib.rarithmetic import r_longlong
+from pypy.rpython.lltypesystem.lltype import (typeOf, Signed, 
getRuntimeTypeInfo,
+    identityhash)
+from pypy.rpython.ootypesystem import ootype
+from pypy.rpython.error import TyperError
+from pypy.rpython.rclass import (IR_IMMUTABLE, IR_IMMUTABLE_ARRAY,
+    IR_QUASIIMMUTABLE, IR_QUASIIMMUTABLE_ARRAY)
+from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
 from pypy.translator.translator import TranslationContext, graphof
-from pypy.rpython.lltypesystem.lltype import *
-from pypy.rpython.ootypesystem import ootype
-from pypy.rlib.rarithmetic import r_longlong
-from pypy.rpython.test.tool import BaseRtypingTest, LLRtypeMixin, OORtypeMixin
-from pypy.rpython.rclass import IR_IMMUTABLE, IR_IMMUTABLE_ARRAY
-from pypy.rpython.rclass import IR_QUASIIMMUTABLE, IR_QUASIIMMUTABLE_ARRAY
-from pypy.rpython.error import TyperError
-from pypy.objspace.flow.model import summary
+
 
 class EmptyBase(object):
     pass
diff --git a/pypy/rpython/test/test_rtyper.py b/pypy/rpython/test/test_rtyper.py
--- a/pypy/rpython/test/test_rtyper.py
+++ b/pypy/rpython/test/test_rtyper.py
@@ -1,26 +1,26 @@
-from pypy.annotation import model as annmodel
-from pypy.objspace.flow.model import Constant
-from pypy.translator.translator import TranslationContext, graphof
-from pypy.annotation import annrpython
-from pypy.rpython.lltypesystem.lltype import *
-from pypy.rpython.test.test_llinterp import interpret 
-from pypy.rpython.rtyper import RPythonTyper
-from pypy.rpython import rmodel
 import py
 
+from pypy.annotation import model as annmodel, annrpython
+from pypy.objspace.flow.model import Constant
+from pypy.rpython import rmodel
+from pypy.rpython.lltypesystem.lltype import Signed, Void
+from pypy.rpython.rtyper import RPythonTyper
+from pypy.rpython.test.test_llinterp import interpret
+from pypy.translator.translator import TranslationContext, graphof
 
-def setup_module(mod): 
+
+def setup_module(mod):
     mod.logstate = py.log._getstate()
     py.log.setconsumer("rtyper", py.log.STDOUT)
-    py.log.setconsumer("annrpython", None)   
+    py.log.setconsumer("annrpython", None)
 
-def teardown_module(mod): 
-    py.log._setstate(mod.logstate) 
+def teardown_module(mod):
+    py.log._setstate(mod.logstate)
 
 def test_reprkeys_dont_clash():
-    stup1 = annmodel.SomeTuple((annmodel.SomeFloat(), 
+    stup1 = annmodel.SomeTuple((annmodel.SomeFloat(),
                                 annmodel.SomeInteger()))
-    stup2 = annmodel.SomeTuple((annmodel.SomeString(), 
+    stup2 = annmodel.SomeTuple((annmodel.SomeString(),
                                 annmodel.SomeInteger()))
     rtyper = RPythonTyper(annrpython.RPythonAnnotator(None))
     key1 = rtyper.makekey(stup1)
@@ -41,7 +41,7 @@
         return g(1, x)
 
     res = interpret(f, [4])
-    assert res == -3 
+    assert res == -3
 
 def test_retval():
     def f(x):
@@ -82,7 +82,7 @@
     rt = RPythonTyper(a)
     rt.specialize()
     assert [vT.concretetype for vT in vTs] == [Void] * 3
-    
+
 
 def test_getgcflavor():
     class A:
@@ -111,7 +111,7 @@
                     raise
                 else:
                     return default
-            
+
     assert rmodel.getgcflavor(DummyClsDescDef(A)) == 'gc'
     assert rmodel.getgcflavor(DummyClsDescDef(B)) == 'gc'
     assert rmodel.getgcflavor(DummyClsDescDef(R)) == 'raw'
_______________________________________________
pypy-commit mailing list
[email protected]
http://mail.python.org/mailman/listinfo/pypy-commit

Reply via email to