code: def editor(self, filename, linenum=None, wait=True):
      """Open the default editor at the given filename and linenumber.
  
      This is IPython's default editor hook, you can use it as an example to
      write your own modified one.  To set your own editor function as the
      new editor hook, call ip.set_hook('editor',yourfunc)."""
  
      # IPython configures a default editor at startup by reading $EDITOR from
      # the environment, and falling back on vi (unix) or notepad (win32).
      editor = self.editor
  
      # marker for at which line to open the file (for existing objects)
      if linenum is None or editor == "notepad":
          linemark = ""
      else:
          linemark = "+%d" % int(linenum)
  
      # Enclose in quotes if necessary and legal
      if " " in editor and os.path.isfile(editor) and editor[0] != '"':
          editor = '"%s"' % editor
  
      # Call the actual editor
      proc = subprocess.Popen(
          "%s %s %s" % (editor, linemark, filename), shell=True
      )
      if wait and proc.wait() != 0:
          raise TryNext()
  
file_path: catboost/contrib/python/ipython/py3/IPython/core/hooks.py
imports: import os
  import subprocess
  import sys
  from .error import TryNext
label_desc: Use image node_id 1 for calling a global function with example usage: editor(filename, linenum, wait) without return types