MCPcopy Create free account
hub / github.com/ipython/ipython / _edit_macro

Method _edit_macro

IPython/core/magics/code.py:509–517  ·  view source on GitHub ↗

open an editor with the macro data in a file

(self,mname,macro)

Source from the content-addressed store, hash-verified

507 return filename, lineno, use_temp
508
509 def _edit_macro(self,mname,macro):
510 """open an editor with the macro data in a file"""
511 filename = self.shell.mktempfile(macro.value)
512 self.shell.hooks.editor(filename)
513
514 # and make a new macro object, to replace the old one
515 with open(filename) as mfile:
516 mvalue = mfile.read()
517 self.shell.user_ns[mname] = Macro(mvalue)
518
519 @skip_doctest
520 @line_magic

Callers 1

editMethod · 0.95

Calls 3

MacroClass · 0.90
mktempfileMethod · 0.80
readMethod · 0.80

Tested by

no test coverage detected