##// END OF EJS Templates
use pkgutil.walk_packages for import completion
vivainio -
Show More
@@ -45,39 +45,19 b' def apt_completers(self, event):'
45 ip.set_hook('complete_command', apt_completers, re_key = '.*apt-get')
45 ip.set_hook('complete_command', apt_completers, re_key = '.*apt-get')
46 ip.set_hook('complete_command', apt_completers, re_key = '.*yum')
46 ip.set_hook('complete_command', apt_completers, re_key = '.*yum')
47
47
48 py_std_modules = """\
49 BaseHTTPServer Bastion CGIHTTPServer ConfigParser Cookie
50 DocXMLRPCServer HTMLParser MimeWriter Queue SimpleHTTPServer
51 SimpleXMLRPCServer SocketServer StringIO UserDict UserList UserString
52 _LWPCookieJar _MozillaCookieJar __future__ __phello__.foo _strptime
53 _threading_local aifc anydbm asynchat asyncore atexit audiodev base64
54 bdb binhex bisect cProfile calendar cgi cgitb chunk cmd code codecs
55 codeop colorsys commands compileall contextlib cookielib copy copy_reg
56 csv dbhash decimal difflib dircache dis doctest dumbdbm dummy_thread
57 dummy_threading filecmp fileinput fnmatch formatter fpformat ftplib
58 functools getopt getpass gettext glob gopherlib gzip hashlib heapq
59 hmac htmlentitydefs htmllib httplib ihooks imaplib imghdr imputil
60 inspect keyword linecache locale macpath macurl2path mailbox mailcap
61 markupbase md5 mhlib mimetools mimetypes mimify modulefinder multifile
62 mutex netrc new nntplib ntpath nturl2path opcode optparse os
63 os2emxpath pdb pickle pickletools pipes pkgutil platform popen2 poplib
64 posixfile posixpath pprint profile pstats pty py_compile pyclbr pydoc
65 quopri random re repr rexec rfc822 rlcompleter robotparser runpy sched
66 sets sgmllib sha shelve shlex shutil site smtpd smtplib sndhdr socket
67 sre sre_compile sre_constants sre_parse stat statvfs string stringold
68 stringprep struct subprocess sunau sunaudio symbol symtable tabnanny
69 tarfile telnetlib tempfile textwrap this threading timeit toaiff token
70 tokenize trace traceback tty types unittest urllib urllib2 urlparse
71 user uu uuid warnings wave weakref webbrowser whichdb xdrlib xmllib
72 xmlrpclib zipfile"""
73
74 def module_completer(self,event):
48 def module_completer(self,event):
75 """ Give completions after user has typed 'import' """
49 """ Give completions after user has typed 'import' """
76
50
77 import pkgutil
51 import pkgutil,imp,time
78 return [m[1] for m in pkgutil.iter_modules()]
52 for ld, name, ispkg in pkgutil.walk_packages():
53 if ispkg:
54 yield name + '.'
55 else:
56 yield name
57 return
79
58
80 ip.set_hook('complete_command', module_completer, str_key = 'import')
59 ip.set_hook('complete_command', module_completer, str_key = 'import')
60 ip.set_hook('complete_command', module_completer, str_key = 'from')
81
61
82 svn_commands = """\
62 svn_commands = """\
83 add blame praise annotate ann cat checkout co cleanup commit ci copy
63 add blame praise annotate ann cat checkout co cleanup commit ci copy
General Comments 0
You need to be logged in to leave comments. Login now