diff --git a/IPython/Extensions/ipy_stock_completers.py b/IPython/Extensions/ipy_stock_completers.py index 3beafc5..1c60ac3 100755 --- a/IPython/Extensions/ipy_stock_completers.py +++ b/IPython/Extensions/ipy_stock_completers.py @@ -45,39 +45,19 @@ def apt_completers(self, event): ip.set_hook('complete_command', apt_completers, re_key = '.*apt-get') ip.set_hook('complete_command', apt_completers, re_key = '.*yum') -py_std_modules = """\ -BaseHTTPServer Bastion CGIHTTPServer ConfigParser Cookie -DocXMLRPCServer HTMLParser MimeWriter Queue SimpleHTTPServer -SimpleXMLRPCServer SocketServer StringIO UserDict UserList UserString -_LWPCookieJar _MozillaCookieJar __future__ __phello__.foo _strptime -_threading_local aifc anydbm asynchat asyncore atexit audiodev base64 -bdb binhex bisect cProfile calendar cgi cgitb chunk cmd code codecs -codeop colorsys commands compileall contextlib cookielib copy copy_reg -csv dbhash decimal difflib dircache dis doctest dumbdbm dummy_thread -dummy_threading filecmp fileinput fnmatch formatter fpformat ftplib -functools getopt getpass gettext glob gopherlib gzip hashlib heapq -hmac htmlentitydefs htmllib httplib ihooks imaplib imghdr imputil -inspect keyword linecache locale macpath macurl2path mailbox mailcap -markupbase md5 mhlib mimetools mimetypes mimify modulefinder multifile -mutex netrc new nntplib ntpath nturl2path opcode optparse os -os2emxpath pdb pickle pickletools pipes pkgutil platform popen2 poplib -posixfile posixpath pprint profile pstats pty py_compile pyclbr pydoc -quopri random re repr rexec rfc822 rlcompleter robotparser runpy sched -sets sgmllib sha shelve shlex shutil site smtpd smtplib sndhdr socket -sre sre_compile sre_constants sre_parse stat statvfs string stringold -stringprep struct subprocess sunau sunaudio symbol symtable tabnanny -tarfile telnetlib tempfile textwrap this threading timeit toaiff token -tokenize trace traceback tty types unittest urllib urllib2 urlparse -user uu uuid warnings wave weakref webbrowser whichdb xdrlib xmllib -xmlrpclib zipfile""" - def module_completer(self,event): """ Give completions after user has typed 'import' """ - import pkgutil - return [m[1] for m in pkgutil.iter_modules()] + import pkgutil,imp,time + for ld, name, ispkg in pkgutil.walk_packages(): + if ispkg: + yield name + '.' + else: + yield name + return ip.set_hook('complete_command', module_completer, str_key = 'import') +ip.set_hook('complete_command', module_completer, str_key = 'from') svn_commands = """\ add blame praise annotate ann cat checkout co cleanup commit ci copy