Skip to content

Commit cc3f412

Browse files
committed
docs galore, enable test_descr.descrdoc
1 parent 5502077 commit cc3f412

26 files changed

+248
-189
lines changed

Lib/test/test_descr.py

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4396,9 +4396,6 @@ def test_main():
43964396
# takes 1 arg)
43974397
specials,
43984398

4399-
# Jython file lacks doc strings
4400-
descrdoc,
4401-
44024399
# New style classes don't support __del__:
44034400
# http://bugs.jython.org/issue1057
44044401
delhook,

Misc/make_pydocs.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,21 @@
22
import __builtin__
33

44
def print_doc(out, obj, meth):
5-
doc = (getattr(obj, meth)).__doc__
6-
if doc == None:
5+
if meth == '__doc__':
6+
doc = getattr(obj, meth)
7+
bdname = '%s_doc' % obj.__name__
8+
else:
9+
doc = getattr(obj, meth).__doc__
10+
bdname = '%s_%s_doc' % (obj.__name__, meth)
11+
12+
if doc is None:
713
doc = ""
814
lines = doc.split("\n")
9-
outstring = '\\n" + \n "'.join(lines)
10-
print >> out, (' public final static String %s_%s_doc = '
11-
% (obj.__name__, meth))
15+
outstring = '\\n" + \n "'.join(format(line) for line in lines)
16+
print >> out, (' public final static String %s = ' % bdname)
1217
print >> outfile, ' "%s";\n' % outstring
1318

19+
format = lambda line: line.replace('\\', '\\\\').replace('"', r'\"')
1420
opt = lambda n: getattr(__builtin__, n, None)
1521

1622
def f(): pass
@@ -58,13 +64,13 @@ class C:
5864
]
5965

6066
outfile = open("BuiltinDocs.java", "w")
61-
print >> outfile, '//generated by make_pydocs.py\n'
67+
print >> outfile, '// generated by make_pydocs.py\n'
6268
print >> outfile, 'package org.python.core;\n'
6369
print >> outfile, 'public class BuiltinDocs {\n'
6470

6571

6672
for obj in types_list:
67-
print >> outfile, ' //Docs for %s' % obj
73+
print >> outfile, ' // Docs for %s' % obj
6874
for meth in dir(obj):
6975
print_doc(outfile, obj, meth)
7076

0 commit comments

Comments
 (0)