Commit Graph

115 Commits

Author SHA1 Message Date
Barry Warsaw 00decd7835 Patch #1520294: Support for getset and member descriptors in types.py,
inspect.py, and pydoc.py.  Specifically, this allows for querying the type of
an object against these built-in C types and more importantly, for getting
their docstrings printed in the interactive interpreter's help() function.

This patch includes a new built-in module called _types which provides
definitions of getset and member descriptors for use by the types.py module.
These types are exposed as types.GetSetDescriptorType and
types.MemberDescriptorType.  Query functions are provided as
inspect.isgetsetdescriptor() and inspect.ismemberdescriptor().  The
implementations of these are robust enough to work with Python implementations
other than CPython, which may not have these fundamental types.

The patch also includes documentation and test suite updates.

I commit these changes now under these guiding principles:

1. Silence is assent.  The release manager has not said "no", and of the few
   people that cared enough to respond to the thread, the worst vote was "0".

2. It's easier to ask for forgiveness than permission.

3. It's so dang easy to revert stuff in svn, that you could view this as a
   forcing function. :)

Windows build patches will follow.
2006-07-27 23:43:15 +00:00
Phillip J. Eby ceb3087e1c Second phase of refactoring for runpy, pkgutil, pydoc, and setuptools
to share common PEP 302 support code, as described here:

http://mail.python.org/pipermail/python-dev/2006-April/063724.html

pydoc now supports PEP 302 importers, by way of utility functions in
pkgutil, such as 'walk_packages()'.  It will properly document
modules that are in zip files, and is backward compatible to Python
2.3 (setuptools installs for Python <2.5 will bundle it so pydoc
doesn't break when used with eggs.)

What has not changed is that pydoc command line options do not support
zip paths or other importer paths, and the webserver index does not
support sys.meta_path.  Those are probably okay as limitations.

Tasks remaining: write docs and Misc/NEWS for pkgutil/pydoc changes,
and update setuptools to use pkgutil wherever possible, then add it
to the stdlib.
2006-04-18 00:59:55 +00:00
Georg Brandl 26fd2e1dcc Fix pydoc.synopsis() so that it doesn't error out with an unreadable
module.
2006-03-08 09:34:53 +00:00
Georg Brandl 501dd0dd9d The names of lambda functions are now properly displayed in pydoc. 2006-02-17 09:45:40 +00:00
Ka-Ping Yee 9a2dcf8ac1 Fix SF bug #417833 (pydoc HTTP reload failure) by removing from
sys.modules all submodules of a the given module/package path
when trying to reload a module.
2005-11-05 05:04:41 +00:00
Ka-Ping Yee a487e4eb05 Accept patch to resolve SF bug #651124. 2005-11-05 04:49:18 +00:00
Fred Drake db390c1ad8 fix typos, mostly in comments 2005-10-28 14:39:47 +00:00
Jeremy Hylton 3e0055f8c6 Merge ast-branch to head
This change implements a new bytecode compiler, based on a
transformation of the parse tree to an abstract syntax defined in
Parser/Python.asdl.

The compiler implementation is not complete, but it is in stable
enough shape to run the entire test suite excepting two disabled
tests.
2005-10-20 19:59:25 +00:00
Georg Brandl 8b813db2ef bug [ 729103 ] Cannot retrieve name of super object 2005-10-01 16:32:31 +00:00
Georg Brandl 9443242463 That was one too much. 2005-07-22 21:52:25 +00:00
Georg Brandl 7eb4b7d177 Fix all wrong instances of "it's". 2005-07-22 21:49:32 +00:00
Ka-Ping Yee bba6acc714 Use getdoc(object) instead of object.__doc__ to fix indentation problems.
Thanks to Robert Dick <dickrp@ece.northwestern.edu> for reporting this bug
and submitting a patch.

Adjust doc(object) to display useful documentation for plain values (e.g.
help([]) now shows the methods on the list instead of just printing "[]").

(This change has been tested interactively, by generating docs for the
standard library, and by running the module documentation webserver.)
2005-02-19 22:58:26 +00:00
Raymond Hettinger dbecd93b72 Replace list of constants with tuples of constants. 2005-02-06 06:57:08 +00:00
Johannes Gijsbers 9ddb300598 Patch #936774: unify the display of data descriptors, including slots,
properties, and custom descriptors.

* removed special handling of properties

* added special handling of data descriptors - All data descriptors are grouped
  together in a section. For each item, the attribute name and doc string, if
  present, is displayed.

* disabled display of __slots__ attribute - since slots are descriptors, they
  are listed in the section described above

Thanks to John Belmonte for the patch!
2005-01-08 20:16:43 +00:00
Raymond Hettinger ed2dbe3f33 SF patch #1094007: Remove witty comment in pydoc.py
(Removed at Ping's request.)
2005-01-01 07:51:01 +00:00
Martin v. Löwis 6fe8f1928f Back out rev 1.96; see #1009389. 2004-11-14 10:21:04 +00:00
Johannes Gijsbers 8de645a176 Patch #1061931 / bug #971872: factor out part of spillproperties, so
properties are also documented if help(Class.<property>) is called
instead of help(Class).
2004-11-07 19:16:05 +00:00
Johannes Gijsbers 4c11f6088a Patch #934356: if a module defines __all__, believe that rather than using
heuristics for filtering out imported names.
2004-08-30 14:13:04 +00:00
Martin v. Löwis e09bd93685 Patch #997284: Allow pydoc to work with XP Themes (.manifest file)
Will backport to 2.3.
2004-08-22 16:13:26 +00:00
Martin v. Löwis ac37f3d001 Patch #1009389: Make __credits__ a Unicode object. 2004-08-22 16:08:04 +00:00
Johannes Gijsbers e7691d36b7 Use readline/raw_input() in pydoc.Helper.interact if available and self.input
is sys.stdin. Based on a patch (#726204) by Dmitry Vasiliev and a comment from
Guido in an older patch (#549901).
2004-08-17 13:21:53 +00:00
Brett Cannon 84601f14a3 Change pydoc.stripid() be able to match against 64-bit addresses by having
regex match from 6 to 16 characters.
2004-06-19 01:22:48 +00:00
Brett Cannon c6c1f478d9 pydoc.stripid() is now case-insensitive for its regex to support platforms that
have pointer addresses in uppercase.

Closes bug #934282.  Thanks Robin Becker.
2004-06-19 01:02:51 +00:00
Skip Montanaro a5616d2255 Respect a module's __all__ attribute. Closes #969938. 2004-06-11 04:46:12 +00:00
Skip Montanaro f2134842b4 correct name error caught by Neal Norwitz with pychecker 2004-06-07 02:40:05 +00:00
Raymond Hettinger 756b3f3c15 * Move collections.deque() in from the sandbox
* Add unittests, newsitem, and whatsnew
* Apply to Queue.py mutex.py threading.py pydoc.py and shlex.py
* Docs are forthcoming
2004-01-29 06:37:52 +00:00
Martin v. Löwis f9b08b8e60 Patch #785689: Use basename in usage. Backported to 2.3. 2003-10-31 13:05:21 +00:00
Raymond Hettinger 6b59f5f3fd Let library modules use the new keyword arguments for list.sort(). 2003-10-16 05:53:16 +00:00
Skip Montanaro 4997a69fe4 display link to module docs when it looks like the object module is a core
module
2003-09-10 16:47:51 +00:00
Skip Montanaro 0fe8fce7e3 (HTML|Text)Repr.repr1: Guard against objects whos types have no __name__
attribute. Patch and bug report from Geoff Talvola. Closes patch #672855.
2003-06-27 15:45:41 +00:00
Martin v. Löwis b8c084e82c Support keyword and topics help in cli(). Fixes #715782. 2003-06-14 09:03:46 +00:00
Brett Cannon 28a4f0f965 Have pydoc try handling an object as "other" if the object does not act the way
it expects based on what inspect classifies it as.

Closes bug #729103 .
2003-06-11 23:38:55 +00:00
Neal Norwitz 54f871e193 Fix SF bug #735694, Pydoc.py fixes links
Modified the patch some.  Fixed invalid link in UNICODE (to STRING).
Also updates some references.
2003-05-26 13:49:54 +00:00
Martin v. Löwis e59e2bab8f Patch #711902: Cause pydoc to show data descriptor __doc__ strings. 2003-05-03 09:09:02 +00:00
Neal Norwitz 742dde4ddd SF patch #706338, Fix a few broken links in pydoc by Greg Chapman 2003-03-30 20:31:34 +00:00
Ka-Ping Yee d9e213eeca Hide private names beginning with _ (but don't hide __special__ names).
Clean up section headings; make the bars on the left less fat.
Adjust the display of properties slightly.
Don't show stuff inherited from the base 'object' type.
2003-03-28 16:35:51 +00:00
Neal Norwitz 4f959d2c73 Fix SF patch #695581, "returnself" -> "return self" 2003-03-01 15:22:41 +00:00
Guido van Rossum 68468eba63 Get rid of many apply() calls. 2003-02-27 20:14:51 +00:00
Guido van Rossum 97dede0202 Fix for SF 686380, from SF patch 686771 by Ping. (errors trying to
get help on os attributes)
2003-02-16 01:12:32 +00:00
Neal Norwitz f98159c376 Fix SF bug #642168, help() fails for some builtin topics
Fix pydoc when doing help for:  and, or, not, UNICODE.

Will backport.
2003-02-07 20:49:40 +00:00
Tim Peters 550e4e5583 SF bug 666444: 'help' makes linefeed only under Win32.
Reverting one of those irritating "security fixes".  fdopen() opens
files in binary mode.  That makes pydoc skip the \r\n on Windows that's
need to make the output readable in the shell.  Screw it.
2003-02-07 01:53:46 +00:00
Martin v. Löwis 5b26abb37a Gracefully delay runtime error up to 1s. Add .willdispatch(). 2002-12-28 09:23:09 +00:00
Raymond Hettinger 4f759d8504 Correct erroneous parenthesis placement in the delta from 1.63 to 1.64. 2002-11-02 02:02:46 +00:00
Tim Peters fb05c4e5bb SF bug 630824: pydoc Helper keywords missing 'yield'
Wow, what a brittle subsystem!  Fixed, maybe, provided Fred doesn't
shuffle the docs around.

Bugfix candidate.
2002-10-30 05:21:00 +00:00
Raymond Hettinger fca3bb6a29 Explicitly use floor division 2002-10-21 04:44:11 +00:00
Skip Montanaro d404bee2e2 try executing 'less' in a parenthesized subshell - prevents systems like
Solaris from squawking if less isn't available.  See
http://python.org/sf/612111 for details.
2002-09-26 21:44:57 +00:00
Jack Jansen b2628b0f37 Added the standard MacOSX location for documentation inside a framework
to the list of places where pydoc looks for HTML documents.
2002-08-23 08:40:42 +00:00
Ka-Ping Yee 45daeb093f Extend stripid() to handle strings ending in more than one '>'.
Add resolve() to handle looking up objects and names (fix SF bug 586931).
Add a nicer error message when given a filename that doesn't exist.
2002-08-11 15:11:33 +00:00
Guido van Rossum 3b0a3293c3 Massive changes from SF 589982 (tempfile.py rewrite, by Zack
Weinberg).  This changes all uses of deprecated tempfile functions to
the recommended ones.
2002-08-09 16:38:32 +00:00
Guido van Rossum fce538c31e Add a coding cookie, because of the møøse quote. 2002-08-06 17:29:38 +00:00