Revision: 5789
http://jython.svn.sourceforge.net/jython/?rev=5789&view=rev
Author: fwierzbicki
Date: 2008-12-23 01:41:45 +0000 (Tue, 23 Dec 2008)
Log Message:
-----------
more builtins processed for pydoc generation.
Modified Paths:
--------------
trunk/jython/Misc/make_pydocs.py
Modified: trunk/jython/Misc/make_pydocs.py
===================================================================
--- trunk/jython/Misc/make_pydocs.py 2008-12-23 00:35:32 UTC (rev 5788)
+++ trunk/jython/Misc/make_pydocs.py 2008-12-23 01:41:45 UTC (rev 5789)
@@ -1,26 +1,65 @@
-class PyDocGenerator(object):
- def __init__(self):
- self.out = open("BuiltinDocs.java", "w")
- print >> self.out, '//generated by make_pydocs.py\n'
- print >> self.out, 'package org.python.core;\n'
- print >> self.out, 'public class BuiltinDocs {\n'
- objects = [str, unicode]
- for obj in objects:
- print >> self.out, ' //Docs for %s' % obj
- for meth in dir(obj):
- self.print_doc(obj, meth)
- print >> self.out, '}'
+import sys
+import __builtin__
+def print_doc(out, obj, meth):
+ doc = (getattr(obj, meth)).__doc__
+ if doc == None:
+ doc = ""
+ lines = doc.split("\n")
+ outstring = '\\n" + \n "'.join(lines)
+ print >> out, (' public final static String %s_%s_doc = '
+ % (obj.__name__, meth))
+ print >> outfile, ' "%s";\n' % outstring
- def print_doc(self, obj, meth):
- doc = (getattr(obj, meth)).__doc__
- if doc == None:
- doc = ""
- lines = doc.split("\n")
- out = '\\n" + \n "'.join(lines)
- print >> self.out, (' public final static String %s_%s_doc = '
- % (obj.__name__, meth))
- print >> self.out, ' "%s";\n' % out
+opt = lambda n: getattr(__builtin__, n, None)
-if __name__ == '__main__':
- PyDocGenerator()
+def f(): pass
+try:
+ raise Exception
+except:
+ _, _, tb = sys.exc_info()
+
+class C:
+ f = f
+
+m = C.f
+
+types_list = [
+object,
+type,
+unicode,
+dict,
+list,
+slice,
+super,
+staticmethod,
+float,
+opt('enumerate'),
+#open,
+opt('basestring'),
+long,
+tuple,
+str,
+property,
+int,
+xrange,
+file,
+complex,
+opt('bool'),
+classmethod,
+]
+
+outfile = open("BuiltinDocs.java", "w")
+print >> outfile, '//generated by make_pydocs.py\n'
+print >> outfile, 'package org.python.core;\n'
+print >> outfile, 'public class BuiltinDocs {\n'
+
+
+for obj in types_list:
+ print >> outfile, ' //Docs for %s' % obj
+ for meth in dir(obj):
+ print_doc(outfile, obj, meth)
+
+print >> outfile, '}'
+
+
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|