##// END OF EJS Templates
CodeMagics._find_edit_target is a static method...
MinRK -
Show More
@@ -174,7 +174,8 b' class CodeMagics(Magics):'
174 174
175 175 self.shell.set_next_input(contents)
176 176
177 def _find_edit_target(self, args, opts, last_call):
177 @staticmethod
178 def _find_edit_target(shell, args, opts, last_call):
178 179 """Utility method used by magic_edit to find what to edit."""
179 180
180 181 def make_filename(arg):
@@ -203,13 +204,13 b' class CodeMagics(Magics):'
203 204
204 205 if opts_prev:
205 206 args = '_%s' % last_call[0]
206 if not self.shell.user_ns.has_key(args):
207 if not shell.user_ns.has_key(args):
207 208 args = last_call[1]
208 209
209 210 # use last_call to remember the state of the previous call, but don't
210 211 # let it be clobbered by successive '-p' calls.
211 212 try:
212 last_call[0] = self.shell.displayhook.prompt_count
213 last_call[0] = shell.displayhook.prompt_count
213 214 if not opts_prev:
214 215 last_call[1] = args
215 216 except:
@@ -227,14 +228,14 b' class CodeMagics(Magics):'
227 228 use_temp = False
228 229 elif args:
229 230 # Mode where user specifies ranges of lines, like in %macro.
230 data = self.shell.extract_input_lines(args, opts_raw)
231 data = shell.extract_input_lines(args, opts_raw)
231 232 if not data:
232 233 try:
233 234 # Load the parameter given as a variable. If not a string,
234 235 # process it as an object instead (below)
235 236
236 237 #print '*** args',args,'type',type(args) # dbg
237 data = eval(args, self.shell.user_ns)
238 data = eval(args, shell.user_ns)
238 239 if not isinstance(data, basestring):
239 240 raise DataIsObject
240 241
@@ -293,7 +294,7 b' class CodeMagics(Magics):'
293 294 use_temp = False
294 295
295 296 if use_temp:
296 filename = self.shell.mktempfile(data)
297 filename = shell.mktempfile(data)
297 298 print 'IPython will make a temporary file named:',filename
298 299
299 300 return filename, lineno, use_temp
General Comments 0
You need to be logged in to leave comments. Login now