summaryrefslogtreecommitdiffstats
path: root/Lib/pydoc.py
diff options
context:
space:
mode:
authorGuido van Rossum <guido@python.org>2007-05-15 18:46:22 (GMT)
committerGuido van Rossum <guido@python.org>2007-05-15 18:46:22 (GMT)
commit1bc535dc7854b6be009a6bf3413a3a470e3fe749 (patch)
tree7a43646468849a9ae624bd4314ff26b7b0e30f21 /Lib/pydoc.py
parent360e4b8fb19f34360093bc15ef9aad13115a6069 (diff)
downloadcpython-1bc535dc7854b6be009a6bf3413a3a470e3fe749.zip
cpython-1bc535dc7854b6be009a6bf3413a3a470e3fe749.tar.gz
cpython-1bc535dc7854b6be009a6bf3413a3a470e3fe749.tar.bz2
Merged revisions 55328-55341 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/p3yk ........ r55329 | brett.cannon | 2007-05-14 16:36:56 -0700 (Mon, 14 May 2007) | 3 lines Implement the removal of tuple parameter unpacking (PEP 3113). Thanks, Tony Lownds for the patch. ........ r55331 | neal.norwitz | 2007-05-14 16:40:30 -0700 (Mon, 14 May 2007) | 1 line Update to use Python 3.0 ........ r55332 | brett.cannon | 2007-05-14 16:47:18 -0700 (Mon, 14 May 2007) | 2 lines Mention PEP 3113. And thanks to Tony Lownds for the PEP 3113 patch. ........ r55333 | neal.norwitz | 2007-05-14 16:57:06 -0700 (Mon, 14 May 2007) | 1 line Fix exception printing (no more exceptions module) ........ r55334 | neal.norwitz | 2007-05-14 17:11:10 -0700 (Mon, 14 May 2007) | 1 line Remove popen* functions from os ........ r55335 | neal.norwitz | 2007-05-14 18:03:38 -0700 (Mon, 14 May 2007) | 1 line Get rid of most of popen. There are still some uses I need to cleanup. ........ r55336 | neal.norwitz | 2007-05-14 21:11:34 -0700 (Mon, 14 May 2007) | 1 line Remove a few more remnants of the compiler package ........ r55337 | neal.norwitz | 2007-05-14 22:28:27 -0700 (Mon, 14 May 2007) | 1 line Get test_[cx]pickle working on 64-bit platforms (avoid overflow int/long) ........
Diffstat (limited to 'Lib/pydoc.py')
-rwxr-xr-xLib/pydoc.py34
1 files changed, 19 insertions, 15 deletions
diff --git a/Lib/pydoc.py b/Lib/pydoc.py
index 5e91ad2..0716a3a 100755
--- a/Lib/pydoc.py
+++ b/Lib/pydoc.py
@@ -171,11 +171,12 @@ def visiblename(name, all=None):
def classify_class_attrs(object):
"""Wrap inspect.classify_class_attrs, with fixup for data descriptors."""
- def fixup((name, kind, cls, value)):
+ results = []
+ for (name, kind, cls, value) in inspect.classify_class_attrs(object):
if inspect.isdatadescriptor(value):
kind = 'data descriptor'
- return name, kind, cls, value
- return map(fixup, inspect.classify_class_attrs(object))
+ results.append((name, kind, cls, value))
+ return results
# ----------------------------------------------------- module manipulation
@@ -228,11 +229,9 @@ def synopsis(filename, cache={}):
class ErrorDuringImport(Exception):
"""Errors that occurred while trying to import something to document it."""
- def __init__(self, filename, (exc, value, tb)):
+ def __init__(self, filename, exc_info):
self.filename = filename
- self.exc = exc
- self.value = value
- self.tb = tb
+ self.exc, self.value, self.tb = exc_info
def __str__(self):
exc = self.exc
@@ -502,8 +501,9 @@ class HTMLDoc(Doc):
"""Make a link for a module."""
return '<a href="%s.html">%s</a>' % (object.__name__, object.__name__)
- def modpkglink(self, (name, path, ispackage, shadowed)):
+ def modpkglink(self, modpkginfo):
"""Make a link for a module or package to display in an index."""
+ name, path, ispackage, shadowed = modpkginfo
if shadowed:
return self.grey(name)
if path:
@@ -662,12 +662,12 @@ class HTMLDoc(Doc):
'Package Contents', '#ffffff', '#aa55cc', contents)
elif modules:
contents = self.multicolumn(
- modules, lambda (key, value), s=self: s.modulelink(value))
+ modules, lambda t: self.modulelink(t[1]))
result = result + self.bigsection(
'Modules', '#fffff', '#aa55cc', contents)
if classes:
- classlist = map(lambda (key, value): value, classes)
+ classlist = [value for (key, value) in classes]
contents = [
self.formattree(inspect.getclasstree(classlist, 1), name)]
for key, value in classes:
@@ -768,8 +768,10 @@ class HTMLDoc(Doc):
push('\n')
return attrs
- attrs = filter(lambda (name, kind, cls, value): visiblename(name),
- classify_class_attrs(object))
+ attrs = [(name, kind, cls, value)
+ for name, kind, cls, value in classify_class_attrs(object)
+ if visiblename(name)]
+
mdict = {}
for key, kind, homecls, value in attrs:
mdict[key] = anchor = '#' + name + '-' + key
@@ -1071,7 +1073,7 @@ class TextDoc(Doc):
'PACKAGE CONTENTS', '\n'.join(modpkgs))
if classes:
- classlist = map(lambda (key, value): value, classes)
+ classlist = [value for key, value in classes]
contents = [self.formattree(
inspect.getclasstree(classlist, 1), name)]
for key, value in classes:
@@ -1175,8 +1177,10 @@ class TextDoc(Doc):
name, mod, maxlen=70, doc=doc) + '\n')
return attrs
- attrs = filter(lambda (name, kind, cls, value): visiblename(name),
- classify_class_attrs(object))
+ attrs = [(name, kind, cls, value)
+ for name, kind, cls, value in classify_class_attrs(object)
+ if visiblename(name)]
+
while attrs:
if mro:
thisclass = mro.popleft()