Show More
@@ -21,4 +21,4 b' import clearcmd # %clear' | |||
|
21 | 21 | |
|
22 | 22 | import ipy_stock_completers |
|
23 | 23 | |
|
24 |
i |
|
|
24 | ip.load('IPython.history') |
@@ -2,9 +2,6 b'' | |||
|
2 | 2 | |
|
3 | 3 | """ History related magics and functionality """ |
|
4 | 4 | |
|
5 | import IPython.ipapi | |
|
6 | ip = IPython.ipapi.get(allow_dummy = True) | |
|
7 | ||
|
8 | 5 | import fnmatch |
|
9 | 6 | |
|
10 | 7 | def magic_history(self, parameter_s = ''): |
@@ -81,13 +78,13 b" def magic_history(self, parameter_s = ''):" | |||
|
81 | 78 | print '%s:%s' % (str(in_num).ljust(width),line_sep[multiline]), |
|
82 | 79 | print inline, |
|
83 | 80 | |
|
84 | ip.expose_magic("history",magic_history) | |
|
81 | ||
|
85 | 82 | |
|
86 | 83 | def magic_hist(self, parameter_s=''): |
|
87 | 84 | """Alternate name for %history.""" |
|
88 | 85 | return self.magic_history(parameter_s) |
|
89 | 86 | |
|
90 | ip.expose_magic("hist",magic_hist) | |
|
87 | ||
|
91 | 88 | |
|
92 | 89 | def rep_f(self, arg): |
|
93 | 90 | r""" Repeat a command, or get command to input line for editing |
@@ -116,7 +113,7 b' def rep_f(self, arg):' | |||
|
116 | 113 | |
|
117 | 114 | |
|
118 | 115 | opts,args = self.parse_options(arg,'',mode='list') |
|
119 | ||
|
116 | ip = self.api | |
|
120 | 117 | if not args: |
|
121 | 118 | ip.set_next_input(str(ip.user_ns["_"])) |
|
122 | 119 | return |
@@ -134,7 +131,6 b' def rep_f(self, arg):' | |||
|
134 | 131 | print "lines",lines |
|
135 | 132 | ip.runlines(lines) |
|
136 | 133 | |
|
137 | ip.expose_magic("rep",rep_f) | |
|
138 | 134 | |
|
139 | 135 | _sentinel = object() |
|
140 | 136 | |
@@ -168,5 +164,10 b' def test_shist():' | |||
|
168 | 164 | s.add('hello') |
|
169 | 165 | s.add('world') |
|
170 | 166 | print "all",s.all() |
|
167 | ||
|
168 | def init_ipython(ip): | |
|
169 | ip.expose_magic("rep",rep_f) | |
|
170 | ip.expose_magic("hist",magic_hist) | |
|
171 | ip.expose_magic("history",magic_history) | |
|
171 | 172 | |
|
172 | 173 | # test_shist() |
@@ -378,6 +378,14 b' class IPApi:' | |||
|
378 | 378 | """ |
|
379 | 379 | |
|
380 | 380 | self.IP.rl_next_input = s |
|
381 | ||
|
382 | def load(self, mod): | |
|
383 | if mod in sys.modules: | |
|
384 | return | |
|
385 | __import__(mod) | |
|
386 | m = sys.modules[mod] | |
|
387 | if hasattr(m,'init_ipython'): | |
|
388 | m.init_ipython(self) | |
|
381 | 389 | |
|
382 | 390 | |
|
383 | 391 | def launch_new_instance(user_ns = None): |
General Comments 0
You need to be logged in to leave comments.
Login now