[pypy-svn] r5088 - in pypy/trunk/src/pypy: appspace appspace/test interpreter module/test/impsubdir module/test/impsubdir/pkg module/test/impsubdir/pkg_r module/test/impsubdir/pkg_r/x module/test/impsubdir/pkg_relative_a module/test/impsubdir/x objspace objspace/std objspace/std/test tool tool/tb_server translator/test

arigo at codespeak.net arigo at codespeak.net
Tue Jun 15 19:06:35 CEST 2004


Author: arigo
Date: Tue Jun 15 19:06:29 2004
New Revision: 5088

Modified:
   pypy/trunk/src/pypy/appspace/exceptions.py   (props changed)
   pypy/trunk/src/pypy/appspace/imp.py   (props changed)
   pypy/trunk/src/pypy/appspace/operator.py   (props changed)
   pypy/trunk/src/pypy/appspace/random.py   (props changed)
   pypy/trunk/src/pypy/appspace/test/test_exceptions.py   (props changed)
   pypy/trunk/src/pypy/interpreter/pytraceback.py   (props changed)
   pypy/trunk/src/pypy/interpreter/typedef.py   (props changed)
   pypy/trunk/src/pypy/module/test/impsubdir/b.py   (props changed)
   pypy/trunk/src/pypy/module/test/impsubdir/pkg/abs_b.py   (props changed)
   pypy/trunk/src/pypy/module/test/impsubdir/pkg/abs_x_y.py   (props changed)
   pypy/trunk/src/pypy/module/test/impsubdir/pkg_r/   (props changed)
   pypy/trunk/src/pypy/module/test/impsubdir/pkg_r/__init__.py   (props changed)
   pypy/trunk/src/pypy/module/test/impsubdir/pkg_r/inpkg.py   (props changed)
   pypy/trunk/src/pypy/module/test/impsubdir/pkg_r/x/   (props changed)
   pypy/trunk/src/pypy/module/test/impsubdir/pkg_r/x/__init__.py   (props changed)
   pypy/trunk/src/pypy/module/test/impsubdir/pkg_relative_a/   (props changed)
   pypy/trunk/src/pypy/module/test/impsubdir/pkg_relative_a/__init__.py   (props changed)
   pypy/trunk/src/pypy/module/test/impsubdir/pkg_relative_a/a.py   (props changed)
   pypy/trunk/src/pypy/module/test/impsubdir/x/   (props changed)
   pypy/trunk/src/pypy/module/test/impsubdir/x/__init__.py   (props changed)
   pypy/trunk/src/pypy/module/test/impsubdir/x/y.py   (props changed)
   pypy/trunk/src/pypy/objspace/descroperation.py   (props changed)
   pypy/trunk/src/pypy/objspace/std/longobject.py   (props changed)
   pypy/trunk/src/pypy/objspace/std/longtype.py   (props changed)
   pypy/trunk/src/pypy/objspace/std/stdtypedef.py   (props changed)
   pypy/trunk/src/pypy/objspace/std/test/test_stringformat.py   (props changed)
   pypy/trunk/src/pypy/tool/bltinchecker.py   (props changed)
   pypy/trunk/src/pypy/tool/stdprofile.py   (props changed)
   pypy/trunk/src/pypy/tool/tb_server/render.py   (props changed)
   pypy/trunk/src/pypy/translator/test/run_snippet.py   (contents, props changed)
Log:
fixeol.


Modified: pypy/trunk/src/pypy/translator/test/run_snippet.py
==============================================================================
--- pypy/trunk/src/pypy/translator/test/run_snippet.py	(original)
+++ pypy/trunk/src/pypy/translator/test/run_snippet.py	Tue Jun 15 19:06:29 2004
@@ -1,107 +1,107 @@
-""" 
-
-    Use all functions in snippet to test translation to pyrex
-    
-"""
-import autopath
-import traceback
-import sys
-from pypy.tool import testit
-from pypy.translator.translator import Translator
-
-from pypy.translator.test import snippet
-
-class Result:
-    def __init__(self, func, argtypes):
-        self.func = func 
-        self.argtypes = argtypes
-        self.r_flow = self.r_annotate = self.r_compile = None 
-        for name in 'flow', 'annotate', 'compile':
-            method = getattr(self, name)
-            resname = 'r_' + name 
-            try:
-                method()
-            except (KeyboardInterrupt, SystemExit):
-                raise
-            except:
-                self.excinfo = sys.exc_info()
-                setattr(self, resname, False) 
-            else:
-                setattr(self, resname, True) 
-                
-    def flow(self):
-        self.translator = Translator(func)
-        self.translator.simplify()
-
-    def annotate(self):
-        self.translator.annotate(self.argtypes)
-
-    def compile(self):
-        compiled_function = self.translator.compile()
-        return compiled_function
-    
-def collect_functions(module, specnamelist):
-    l = []
-    for funcname, value in vars(module).items():
-        if not hasattr(value, 'func_code'):
-            continue
-        for specname in specnamelist:
-            if funcname.startswith(specname):
-                l.append(value)
-                break
-        if not specnamelist:
-            l.append(value) 
-    return l
-  
- 
-def combine(lists):
-    if not lists:
-        yield []
-    else:
-        head = lists[0]
-        if not isinstance(head, tuple):
-            head = (head,)
-        tail = lists[1:]
-        for item in head:
-            for com in combine(tail):
-                yield [item] + com 
-
-def get_arg_types(func):
-    # func_defaults e.g.:  ([int, float], [str, int], int) 
-    if func.func_defaults:
-        for argtypeslist in combine(func.func_defaults):
-            yield argtypeslist 
-    else:
-        yield []
-
-# format string for result-lines 
-format_str = "%-30s %10s %10s %10s" 
-
-def repr_result(res):
-    name = res.func.func_name 
-    argtypes = res.argtypes 
-    funccall = "%s(%s)" % (name, ", ".join([x.__name__ for x in argtypes]))
-    flow = res.r_flow and 'ok' or 'fail' 
-    ann = res.r_annotate and 'ok' or 'fail'
-    comp = res.r_compile and 'ok' or 'fail'
-    return format_str %(funccall, flow, ann, comp)
-     
-if __name__=='__main__':
-    specnamelist = sys.argv[1:]
-    funcs = collect_functions(snippet, specnamelist) 
-    results = []
-    print format_str %("functioncall", "flowed", "annotated", "compiled")
-    for func in funcs:
-        for argtypeslist in get_arg_types(func):
-            #print "trying %s %s" %(func, argtypeslist)
-            result = Result(func, argtypeslist) 
-            results.append(result) 
-            print repr_result(result) 
-            if specnamelist and getattr(result, 'excinfo', None): 
-                traceback.print_exception(*result.excinfo) 
-                raise SystemExit, 1
-    
-    #for res in results:
-    #    print repr_result(res) 
-   
-     
+""" 
+
+    Use all functions in snippet to test translation to pyrex
+    
+"""
+import autopath
+import traceback
+import sys
+from pypy.tool import testit
+from pypy.translator.translator import Translator
+
+from pypy.translator.test import snippet
+
+class Result:
+    def __init__(self, func, argtypes):
+        self.func = func 
+        self.argtypes = argtypes
+        self.r_flow = self.r_annotate = self.r_compile = None 
+        for name in 'flow', 'annotate', 'compile':
+            method = getattr(self, name)
+            resname = 'r_' + name 
+            try:
+                method()
+            except (KeyboardInterrupt, SystemExit):
+                raise
+            except:
+                self.excinfo = sys.exc_info()
+                setattr(self, resname, False) 
+            else:
+                setattr(self, resname, True) 
+                
+    def flow(self):
+        self.translator = Translator(func)
+        self.translator.simplify()
+
+    def annotate(self):
+        self.translator.annotate(self.argtypes)
+
+    def compile(self):
+        compiled_function = self.translator.compile()
+        return compiled_function
+    
+def collect_functions(module, specnamelist):
+    l = []
+    for funcname, value in vars(module).items():
+        if not hasattr(value, 'func_code'):
+            continue
+        for specname in specnamelist:
+            if funcname.startswith(specname):
+                l.append(value)
+                break
+        if not specnamelist:
+            l.append(value) 
+    return l
+  
+ 
+def combine(lists):
+    if not lists:
+        yield []
+    else:
+        head = lists[0]
+        if not isinstance(head, tuple):
+            head = (head,)
+        tail = lists[1:]
+        for item in head:
+            for com in combine(tail):
+                yield [item] + com 
+
+def get_arg_types(func):
+    # func_defaults e.g.:  ([int, float], [str, int], int) 
+    if func.func_defaults:
+        for argtypeslist in combine(func.func_defaults):
+            yield argtypeslist 
+    else:
+        yield []
+
+# format string for result-lines 
+format_str = "%-30s %10s %10s %10s" 
+
+def repr_result(res):
+    name = res.func.func_name 
+    argtypes = res.argtypes 
+    funccall = "%s(%s)" % (name, ", ".join([x.__name__ for x in argtypes]))
+    flow = res.r_flow and 'ok' or 'fail' 
+    ann = res.r_annotate and 'ok' or 'fail'
+    comp = res.r_compile and 'ok' or 'fail'
+    return format_str %(funccall, flow, ann, comp)
+     
+if __name__=='__main__':
+    specnamelist = sys.argv[1:]
+    funcs = collect_functions(snippet, specnamelist) 
+    results = []
+    print format_str %("functioncall", "flowed", "annotated", "compiled")
+    for func in funcs:
+        for argtypeslist in get_arg_types(func):
+            #print "trying %s %s" %(func, argtypeslist)
+            result = Result(func, argtypeslist) 
+            results.append(result) 
+            print repr_result(result) 
+            if specnamelist and getattr(result, 'excinfo', None): 
+                traceback.print_exception(*result.excinfo) 
+                raise SystemExit, 1
+    
+    #for res in results:
+    #    print repr_result(res) 
+   
+     



More information about the Pypy-commit mailing list