[py-svn] r33173 - py/branch/apigen/py/test/tracer

fijal at codespeak.net fijal at codespeak.net
Wed Oct 11 18:25:25 CEST 2006


Author: fijal
Date: Wed Oct 11 18:25:23 2006
New Revision: 33173

Modified:
   py/branch/apigen/py/test/tracer/docstorage.py
   py/branch/apigen/py/test/tracer/genrest.py
Log:
Added return type.


Modified: py/branch/apigen/py/test/tracer/docstorage.py
==============================================================================
--- py/branch/apigen/py/test/tracer/docstorage.py	(original)
+++ py/branch/apigen/py/test/tracer/docstorage.py	Wed Oct 11 18:25:23 2006
@@ -88,6 +88,9 @@
         self.module = module
         self.from_dict(module.__package__.__dict__)
         return self
+    
+    def from_module(self, func):
+        raise NotImplementedError("From module")
 
 class DocStorageAccessor(object):
     """ Set of helper functions to access DocStorage, separated in different
@@ -117,8 +120,9 @@
         code = py.code.Code(desc.code)
         return code.fullsource[code.firstlineno]
     
-    def get_function_args(self, name):
-        return self.ds.descs[name].inputcells
+    def get_function_signature(self, name):
+        desc = self.ds.descs[name]
+        return desc.inputcells, desc.retval
 
     def get_function_callpoints(self, name):
         # return list of tuple (filename, fileline, line)

Modified: py/branch/apigen/py/test/tracer/genrest.py
==============================================================================
--- py/branch/apigen/py/test/tracer/genrest.py	(original)
+++ py/branch/apigen/py/test/tracer/genrest.py	Wed Oct 11 18:25:23 2006
@@ -119,9 +119,16 @@
         lst = [Title("Function: %s" % fun_name, belowchar="-"),
             Paragraph(self.dsa.get_function_doc(fun_name)),
             BlockQuote(self.dsa.get_function_definition(fun_name))]
-        args = self.dsa.get_function_args(fun_name)
-        arg_str = "(%s)" % (",".join([str(i) for i in args]))
-        arg_quote = Paragraph("Function type:", Quote(arg_str))
+        
+        lst.append(Paragraph("Function source: XXX (to write a link here)"))
+        
+        args, retval = self.dsa.get_function_signature(fun_name)
+        # XXX: we just do "knowntype" here, but we should
+        # present some more informative way, maybe even provide a link
+        # for the type declaration (if this is known)
+        arg_str = "(%s)" % (",".join([str(i.knowntype) for i in args]))
+        ret_str = str(retval.knowntype)
+        arg_quote = Paragraph("Function type:", Quote(arg_str), '->', Quote(ret_str))
         lst.append(arg_quote)
         
         # call sites..


More information about the py-svn mailing list