mirror of
https://github.com/python/cpython.git
synced 2025-08-24 10:45:53 +00:00
Merged revisions 77185-77188,77262,77313,77317,77331-77333,77337-77338 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk ........ r77185 | andrew.kuchling | 2009-12-31 10:17:05 -0600 (Thu, 31 Dec 2009) | 1 line Add some items ........ r77186 | benjamin.peterson | 2009-12-31 10:28:24 -0600 (Thu, 31 Dec 2009) | 1 line update expat comment ........ r77187 | andrew.kuchling | 2009-12-31 10:38:53 -0600 (Thu, 31 Dec 2009) | 1 line Add various items ........ r77188 | benjamin.peterson | 2009-12-31 10:49:37 -0600 (Thu, 31 Dec 2009) | 1 line add another advancement ........ r77262 | andrew.kuchling | 2010-01-02 19:15:21 -0600 (Sat, 02 Jan 2010) | 1 line Add a few items ........ r77313 | benjamin.peterson | 2010-01-04 18:04:19 -0600 (Mon, 04 Jan 2010) | 1 line add a test about hashing array.array ........ r77317 | georg.brandl | 2010-01-05 12:14:52 -0600 (Tue, 05 Jan 2010) | 1 line Add Stefan. ........ r77331 | georg.brandl | 2010-01-06 11:43:06 -0600 (Wed, 06 Jan 2010) | 1 line Small fixes to test_cmd: fix signature of do_shell, remove duplicate import, add option to run the custom Cmd class. ........ r77332 | georg.brandl | 2010-01-06 12:02:16 -0600 (Wed, 06 Jan 2010) | 7 lines #5991: let completion for the "help" command include help topics. This also simplifies the Cmd.get_names() method implementation; it was written at a time where dir() didn't consider base class attributes. ........ r77333 | georg.brandl | 2010-01-06 12:26:08 -0600 (Wed, 06 Jan 2010) | 1 line #5950: document that zip files with comments are unsupported in zipimport. ........ r77337 | r.david.murray | 2010-01-06 21:09:08 -0600 (Wed, 06 Jan 2010) | 3 lines Add -W to the 'basics', 'opt', and 'all' test runs so that we get verbose information if a failure happens. ........ r77338 | r.david.murray | 2010-01-06 22:04:28 -0600 (Wed, 06 Jan 2010) | 2 lines Fix inadvertent checkin of debug line. ........
This commit is contained in:
parent
46a9900e09
commit
a28e7028f9
8 changed files with 111 additions and 45 deletions
18
Lib/cmd.py
18
Lib/cmd.py
|
@ -278,19 +278,15 @@ class Cmd:
|
|||
return None
|
||||
|
||||
def get_names(self):
|
||||
# Inheritance says we have to look in class and
|
||||
# base classes; order is not important.
|
||||
names = []
|
||||
classes = [self.__class__]
|
||||
while classes:
|
||||
aclass = classes.pop(0)
|
||||
if aclass.__bases__:
|
||||
classes = classes + list(aclass.__bases__)
|
||||
names = names + dir(aclass)
|
||||
return names
|
||||
# This method used to pull in base class attributes
|
||||
# at a time dir() didn't do it yet.
|
||||
return dir(self.__class__)
|
||||
|
||||
def complete_help(self, *args):
|
||||
return self.completenames(*args)
|
||||
commands = set(self.completenames(*args))
|
||||
topics = set(a[5:] for a in self.get_names()
|
||||
if a.startswith('help_' + args[0]))
|
||||
return list(commands | topics)
|
||||
|
||||
def do_help(self, arg):
|
||||
if arg:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue