
    f                         d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl	m
Z
 ddZddZddZdd	Zdd
ZddZddZddZddZddZddZy)z 'editor' hooks for common editors that work well with ipython

They should honor the line number argument, at least.

Contributions are *very* welcome.
    N)get_ipython)TryNext)	py3compatc                 h     d fd	}t               j                  d|        t               _        y)ay  Installs the editor that is called by IPython for the %edit magic.

    This overrides the default editor, which is generally set by your EDITOR
    environment variable or is notepad (windows) or vi (linux). By supplying a
    template string `run_template`, you can control how the editor is invoked
    by IPython -- (e.g. the format in which it accepts command line options)

    Parameters
    ----------
    template : basestring
        run_template acts as a template for how your editor is invoked by
        the shell. It should contain '{filename}', which will be replaced on
        invocation with the file name, and '{line}', $line by line number
        (or 0) to invoke the file with.
    wait : bool
        If `wait` is true, wait until the user presses enter before returning,
        to facilitate non-blocking editors that exit immediately after
        the call.
    c                 r   |d}j                  t        j                  |      |      }t        d|       t        j
                  j                  d      rt        j                  |      }t        j                  |d      }|j                         dk7  r
t               rt        j                  d       y y )Nr   )filenameline>winT)shellzPress Enter when done editing:)formatshlexquoteprintsysplatform
startswithsplit
subprocessPopenwaitr   r   input)selfr   r	   cmdproctemplater   s        R/var/www/cvtools/html/venv/lib/python3.12/site-packages/IPython/lib/editorhooks.pycall_editorz#install_editor.<locals>.call_editor.   s    <Doou{{8'<4oHc3<<""5)++c"C4099;!)OOO<=     editorN)r   )r   set_hookr    )r   r   r   s   `` r   install_editorr"      s&    8> M8[1#KMr   c                 $    t        | dz   d       y)z Activestate Komodo [Edit] z -l {line} {filename}T)r   Nr"   exes    r   komodor'   B   s    311=r   c                      t        | dz          y)z SciTE or Sc1 z {filename} -goto:{line}Nr$   r%   s    r   sciter)   G   s    3445r   c                      t        | dz          y)z/ Notepad++ http://notepad-plus.sourceforge.net z -n{line} {filename}Nr$   r%   s    r   notepadplusplusr+   L   s    3001r   c                      t        | dz          y)z& JED, the lightweight emacsish editor  +{line} {filename}Nr$   r%   s    r   jedr.   Q   s    3//0r   c                     | Mddl }t        j                  j                  |j                        }t        j                  j                  |d      } t        | dz          y)z Idle, the editor bundled with python

    Parameters
    ----------
    exe : str, None
        If none, should be pretty smart about finding the executable.
    Nr   zidle.pyz {filename})idlelibospathdirname__filename__joinr"   )r&   r0   ps      r   idler7   V   sG     {GGOOG001 ggll1i(3'(r   c                      t        | dz          y)z TextMate, the missing editorz -w -l {line} {filename}Nr$   r%   s    r   mater9   g   s     3445r   c                      t        | dz          y )Nr-   r$   r%   s    r   emacsr;   r   s    3//0r   c                      t        | dz          y )Nz -nw +{line} {filename}r$   r%   s    r   	gnuclientr=   v   s    3334r   c                      t        | dz          y )Nz /L:{line} {filename}r$   r%   s    r   crimson_editorr?   z   s    3112r   c                      t        | dz          y )Nz -u -l {line} {filename}r$   r%   s    r   katerA   ~   s    3445r   )F)r'   )r)   )z	notepad++)r.   )r7   )r9   )r;   )r=   )zcedt.exe)rA   )__doc__r1   r   r   r   IPythonr   IPython.core.errorr   IPython.utilsr   r"   r'   r)   r+   r.   r7   r9   r;   r=   r?   rA    r   r   <module>rG      sY    
   
  & #+$`>
6
2
1
)"61536r   