Show More
@@ -12,7 +12,7 b' update upgrade' | |||||
12 |
|
12 | |||
13 | """ |
|
13 | """ | |
14 | import IPython.ipapi |
|
14 | import IPython.ipapi | |
15 | import glob,os,shlex |
|
15 | import glob,os,shlex,sys | |
16 |
|
16 | |||
17 | ip = IPython.ipapi.get() |
|
17 | ip = IPython.ipapi.get() | |
18 |
|
18 | |||
@@ -49,10 +49,16 b' pkg_cache = None' | |||||
49 |
|
49 | |||
50 | def module_completer(self,event): |
|
50 | def module_completer(self,event): | |
51 | """ Give completions after user has typed 'import' """ |
|
51 | """ Give completions after user has typed 'import' """ | |
52 |
|
52 | |||
|
53 | # only a local version for py 2.4, pkgutil has no walk_packages() there | |||
|
54 | if sys.version_info < (2,5): | |||
|
55 | for el in [f[:-3] for f in glob.glob("*.py")]: | |||
|
56 | yield el | |||
|
57 | return | |||
|
58 | ||||
53 | global pkg_cache |
|
59 | global pkg_cache | |
54 | import pkgutil,imp,time |
|
60 | import pkgutil,imp,time | |
55 | #current = |
|
61 | #current = | |
56 | if pkg_cache is None: |
|
62 | if pkg_cache is None: | |
57 | print "\n\n[Standby while scanning modules, this can take a while]\n\n" |
|
63 | print "\n\n[Standby while scanning modules, this can take a while]\n\n" | |
58 | pkg_cache = list(pkgutil.walk_packages()) |
|
64 | pkg_cache = list(pkgutil.walk_packages()) | |
@@ -121,4 +127,4 b' def cd_completer(self, event):' | |||||
121 | return [relpath] |
|
127 | return [relpath] | |
122 | return found |
|
128 | return found | |
123 |
|
129 | |||
124 | ip.set_hook('complete_command', cd_completer, str_key = '%cd') No newline at end of file |
|
130 | ip.set_hook('complete_command', cd_completer, str_key = '%cd') |
General Comments 0
You need to be logged in to leave comments.
Login now