summaryrefslogtreecommitdiffstats
path: root/Lib/pydoc.py
Commit message (Collapse)AuthorAgeFilesLines
* SF bug [#472347] pydoc and properties.Tim Peters2001-10-181-3/+4
| | | | | | | | | | | | | | | The GUI-mode code to display properties blew up if the property functions (get, set, etc) weren't simply methods (or functions). "The problem" here is really that the generic document() method dispatches to one of .doc{routine, class, module, other}(), but all of those require a different(!) number of arguments. Thus document isn't general-purpose at all: you have to know exactly what kind of thing is it you're going to document first, in order to pass the correct number of arguments to .document for it to pass on. As an expedient hack, just tacked "*ignored" on to the end of the formal argument lists for the .docXXX routines so that .document's caller doesn't have to know in advance which path .document is going to take.
* docroutine() (both instances): Docstrings for class methods weren'tTim Peters2001-09-271-2/+0
| | | | | | | | | | | | | | | | getting displayed, due to a special case here whose purpose I didn't understand. So just disabled the doc suppression here. Another special case here skips the docs when picking apart a method and finding that the im_func is also in the class __dict__ under the same name. That one I understood. It has a curious consequence, though, wrt inherited properties: a static class copies inherited stuff into the inheriting class's dict, and that affects whether or not this special case triggers. The upshoot is that pydoc doesn't show the function docstrings of getter/setter/deleter functions of inherited properties in the property section when the class is static, but does when the class is dynamic (bring up Lib/test/pydocfodder.py under GUI pydoc to see this).
* List class attrs in MRO order of defining class instead of by alphabeticTim Peters2001-09-271-23/+12
| | | | order of defining class's name.
* Removed no-longer-true comment about pydoc working under all versions ofTim Peters2001-09-261-4/+0
| | | | | Python since 1.5 (virtually everything I changed over the last week relies on "modern" features, particularly nested scopes).
* Display a class's method resolution order, if it's non-trivial. "Trivial"Tim Peters2001-09-261-1/+22
| | | | | here means it has no more than one base class to rummage through (in which cases there's no potential confusion about resolution order).
* + Display property functions in the same order they're specified toTim Peters2001-09-251-7/+7
| | | | | | | | | | | | | | property() (get, set, del; not set, get, del). + Change "Data defined/inherited in ..." header lines to "Data and non-method functions defined/inherited in ...". Things like the value of __class__, and __new__, and class vrbls like the i in class C: i = int show up in this section too. I don't think it's worth a separate section to distinguish them from non-callable attrs, and there's no obvious reliable way to distinguish callable from non-callable attrs anyway.
* + Got rid of all instances of <small>. Under IE5, GUI-mode pydoc hasTim Peters2001-09-251-22/+19
| | | | | | | | | | | | | always been close to useless, because the <small>-ified docstrings were too small to read, even after cranking up my default font size just for pydoc. Now it reads fine under my defaults (as does most of the web <0.5 wink>). If it's thought important to play tricks with font size, tough, then someone should rework pydoc to use style sheets, and (more) predictable percentage-of-default size controls. + Tried to ensure that all <dt> and <dd> tags are closed. I've read (but don't know) that some browsers get confused if they're not, and esp. when style sheets are in use too.
* GUI mode now displays useful stuff for properties. This is usually betterTim Peters2001-09-251-4/+14
| | | | | than text mode, since here we can hyperlink from the getter etc methods back to their definitions.
* + Text-mode (but not yet GUI mode) pydoc now produces useful stuff forTim Peters2001-09-241-9/+35
| | | | | | | | | | properties: the docstring (if any) is displayed, and the getter, setter and deleter (if any) functions are named. All that is shown indented after the property name. + Text-mode pydoc class display now draws a horizontal line between class attribute groups (similar to GUI mode -- while visually more intrusive in text mode, it's still an improvement).
* More work on class display:Tim Peters2001-09-241-43/+61
| | | | | | | | | + Minor code cleanup, generalization and simplification. + "Do something" to make the attribute aggregation more apparent: - In text mode, stick a "* " at the front of subgroup header lines. - In GUI mode, display a horizontal rule between subgroups. For GUI mode, this is a huge improvement, at least under IE.
* Try to do for pydoc's GUI mode what the earlier checkin did for textTim Peters2001-09-241-9/+92
| | | | | | | | | | | | | | | | | | | | mode (identify the source class for class attrs; segregate attrs according to source class, and whether class method, static method, property, plain method, or data; display data attrs; display docstrings for data attrs when possible). Alas, this is mondo ugly, and I'm no HTML guy. Part of the problem is that pydoc's GUI mode has always been ugly under IE, largely because <small> under IE renders docstrings unreadably small (while sometimes non-docstring text is painfully large). Another part is that these segregated listings of attrs would *probably* look much better as bulleted lists. Alas, when I tried that, the bullets all ended up on lines by themselves, before the method names; this is apparently because pydoc (ab?)uses definition lists for format effects, and at least under IE if a definition list is the first chunk of a list item, it gets rendered on a line after the <li> bullet. An HTML wizard would certainly be welcomed here.
* Part of a partial solution to SF bugs 463378, 463381, 463383, 463384.Tim Peters2001-09-231-8/+87
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This almost entirely replaces how pydoc pumps out class docs, but only in text mode (like help(whatever) from a Python shell), not in GUI mode. A class C's attrs are now grouped by the class in which they're defined, attrs defined by C first, then inherited attrs grouped by alphabetic order of the defining classes' names. Within each of those groups, the attrs are subgrouped according to whether they're plain methods, class methods, static methods, properties, or data. Note that pydoc never dumped class data attrs before. If a class data attr is implemented via a data descriptor, the data docstring (if any) is also displayed (e.g., file.softspace). Within a subgroup, the attrs are listed alphabetically. This is a friggin' mess, and there are bound to be glitches. Please beat on it and complain! Here are three glitches: 1. __new__ gets classifed as 'data', for some reason. This will have to get fixed in inspect.py, but since the latter is already looking for any clue that something is a method, pydoc will almost certainly not know what to do with it when its classification changes. 2. properties are special-cased to death. Unlike any other kind of function or method, they don't have a __name__ attr, so none of pydoc's usual code can deal with them. Worse, the getter and setter and del'er methods associated with a property don't appear to be discoverable from Python, so there's really nothing I can think of to do here beyond just listing their names. Note that a property can't be given a docstring, either (or at least I've been unable to sneak one in) -- perhaps the property() constructor could take an optional doc argument? 3. In a nested-scopes world, pydoc still doesn't know anything about nesting, so e.g. classes nested in functions are effectively invisible.
* Since inspect.isfunction(obj) is a precondition for callingTim Peters2001-09-201-6/+6
| | | | | | | | inspect.getargspec(obj), test isfunction() directly in pydoc.py instead of trying to indirectly deduce isfunction() in pydoc by virtue of failing a combination of other tests. This shouldn't have any visible effect, except perhaps to squash a TypeError death if there was some path thru this code that was inferring isfunction() by mistake.
* After much thrashing, I believe this is a truly minimal patch to teachTim Peters2001-09-201-3/+6
| | | | | pydoc how to do something sensible with 2.2 descriptors. To see the difference, browse __builtin__ via pydoc before and after the patch.
* Oh, ok, so plainpager is probably marginally better.Fred Drake2001-07-231-1/+1
|
* If $TERM is "dumb" or "emacs", just dump the text instead of trying to runFred Drake2001-07-231-0/+2
| | | | | | "less". Patch contributed by Alex Convertry. This closes SF patch #443551.
* Change some text just a little to avoid font-lock hell.Fred Drake2001-05-101-1/+1
|
* One-character style change to appease Netscape stylesheets.Ka-Ping Yee2001-04-131-1/+1
|
* Use nturl2path to generate a file: URL to source files in Windows.Ka-Ping Yee2001-04-131-3/+7
|
* Use inspect.stack()[1][3] to tell if Helper.__repr__ is called interactively.Ka-Ping Yee2001-04-131-2/+2
|
* Add inode checks to detect circular symbolic links (so that theKa-Ping Yee2001-04-131-3/+7
| | | | Tools/idle/idlelib link doesn't cause an infinite loop -- aack!)
* Small style change to accommodate Netscape.Ka-Ping Yee2001-04-131-1/+1
|
* Word-wrap the list of cross-references.Ka-Ping Yee2001-04-131-1/+5
|
* Another pass through the topic table to fill in cross references.Ka-Ping Yee2001-04-131-20/+27
| | | | Restore Helper.__repr__ for now.
* Make force-loading optional; don't force-load in interactive mode.Ka-Ping Yee2001-04-131-133/+147
| | | | | | | | Make synopsis() load modules as '__temp__' so they don't clobber anything. Change "constants" section to "data" section. Don't show __builtins__ or __doc__ in "data" section. For Bob Weiner: don't boldface text in Emacs shells or dumb terminals. Remove Helper.__repr__ (it really belongs in site.py, and should be guarded by a check for len(inspect.stack) <= 2).
* Fix linking to classes (in class tree, and add links on unbound methods).Ka-Ping Yee2001-04-121-24/+23
|
* Fix call to ModuleScanner from GUI search interface.Ka-Ping Yee2001-04-121-8/+10
| | | | Fix handling of unbound top-level methods.
* Added a big new Helper class to provide interactive help!Ka-Ping Yee2001-04-121-12/+276
|
* Give up trying to keep dynamically loaded extensions up to date:Ka-Ping Yee2001-04-121-1/+7
| | | | the import.c machinery has soundly defeated my every attempt.
* Remove forking. Doesn't work in Windows.Ka-Ping Yee2001-04-121-2/+2
|
* Typo fixes and small touches.Ka-Ping Yee2001-04-121-13/+16
|
* Properly qualify methods inherited from classes in other modules.Ka-Ping Yee2001-04-121-152/+130
| | | | | | | | | | Fix so that docother() doesn't blow up. Eliminate man() function since doc() and man() did nearly the same thing. Various other code cleanup and refactoring to reduce duplication. Simplify and rewrite freshimport() so modules are always up to date, even within packages (where reload() doesn't work). Add finalization callback to the server (so that if the server fails to start for some reason, the main thread isn't left hanging).
* Fix typo in instantiation of ErrorDuringImport.Ka-Ping Yee2001-04-101-1/+1
|
* Fix synopsis() so it can handle binary module files.Ka-Ping Yee2001-04-101-85/+85
| | | | | | | | | Avoid ever using popen on Windows, since it's broken there. Factor out the business of getting the summary line into splitdoc(). Use the modulename() routine in inspect. Show all members of modules and classes rather than filtering on leading '_'. Small typo and formtating fixes. Don't show warnings when running "pydoc -k".
* Fix some reloading problems (still more work needed).Ka-Ping Yee2001-03-271-6/+16
| | | | | Add hyperlinks to PEPs at http://www.python.org/peps/pep-%04d.html Remove script directory (dirname of sys.argv[0]) from sys.path.
* Browser compatibility fixes.Ka-Ping Yee2001-03-231-7/+8
| | | | Show methods aliased into a class from other classes.
* Small formatting improvements.Ka-Ping Yee2001-03-231-10/+13
|
* Show inherited methods, with hyperlinks to the base class they came from.Ka-Ping Yee2001-03-231-112/+168
| | | | | | | | | | | Font adjustment to improve viewing in Windows (the default monospaced font, Courier New, seems to have no reasonable size in IE!) Improve error handling. Try very hard to distinguish between failure to find a module and failure during the module importing process. Improve reloading behaviour. (Still needs some work.) Add '.' to sys.path when running as a script at the command-line. Don't automatically assume '-g' based on the platform. We'll just have the batch file supply -g.
* Fixes for various issues reported and discovered since Python 9:Ka-Ping Yee2001-03-231-224/+329
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Factor description of import errors into DocImportError.__str__. Add "docother" and "fail" methods to Doc class. Factor formatting of constants into "docother". Increase max string repr limit to 100 characters. Factor page generation into HTMLDoc.page. Handle aliasing of names (objects appearing under an attribute name different from their intrinsic __name__) by passing the attribute name into each doc* method. Handle methods at top level of modules (e.g. in random). Try to do reloading efficiently. Important fixes still to do: Module reloading is broken by the unfortunate property that failed imports leave an incomplete module in sys. Still need to think of a good solution. Can't document modules in the current directory, due to the other unfortunate property that sys.path gets '.' when you run 'python' but it gets the script directory when you run a script. Need to ponder to find a solution. The synopsis() routine does not work on .so modules. Aliases cause duplicate copies of documentation to appear. This is easy to fix, just more work. Classes appear as their intrinsic name, not their attribute name, in the class hierarchy. This should be fixed. Inherited methods should be listed in class descriptions.
* Whitespace normalization.Tim Peters2001-03-161-3/+1
|
* Use '127.0.0.1' only on Mac; for other, sane platforms, use 'localhost'.Ka-Ping Yee2001-03-021-2/+3
|
* The sys.platform identifier for Windows is just 'win32' (for all varieties).Ka-Ping Yee2001-03-021-8/+8
|
* Believe it or not, but "more" on Windows requires "more <file" ratherGuido van Rossum2001-03-021-1/+1
| | | | | | than "more file". Since tempfilepager() is only used on Windows, it seems, do this unconditionally -- on Unix, it always invokes something else.
* Clean up the handling of getsourcefile/getabsfile.Ka-Ping Yee2001-03-021-23/+37
| | | | | Remove __main__ from the index of built-in modules. Miscellaneous compatibility fixes.
* Use imp.get_suffixes to determine a module name in modulename(file).Ka-Ping Yee2001-03-021-7/+25
| | | | When possible, display strings containing backslashes using r'' notation.
* Also accept .so as an extension for module files.Ka-Ping Yee2001-03-011-8/+4
|
* Docstring improvements.Ka-Ping Yee2001-03-011-196/+395
| | | | | | | | | | | | | Add checks for .pyo and .pyd. Collapse docfunction, docmethod, docbuiltin into the one method docroutine. Small formatting fixes. Link the segments of a package path in the title. Link to the source file only if it exists. Allow modules (e.g. repr.py) to take precedence over built-ins (e.g. repr()). Add interruptible synopsis scanner (so we can do searches in the background). Make HTTP server quit. Add small GUI for controlling the server and launching searches (like -k). (Tested on Win2k, Win98, and Linux.)
* Normalize case of paths in sys.path to avoid duplicates on Windows.Ka-Ping Yee2001-03-011-14/+24
| | | | | | Handle <... at 001B6378> like <... at 0x120f80> (%p is platform-dependent). Fix RCS version tag handling. Move __main__ behaviour into a function, pydoc.cli().
* Whitespace normalization.Tim Peters2001-02-281-2/+2
|
* Macintosh compatibility.Ka-Ping Yee2001-02-271-1/+1
|