
    Mh                         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dS )'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)	py3compatFc                      d fd	}t                                          d|            t                      _        dS )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.
    r   c                    |d}                     t          j        |          |          }t          d|           t          j                            d          rt          j        |          }t          j	        |d          }|
                                dk    rt                      rt          j        d           d S d S )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        W/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/IPython/lib/editorhooks.pycall_editorz#install_editor.<locals>.call_editor.   s    <Doou{8'<'<4oHHc3<""5)) 	#+c""C400099;;!))O 	>O<=====	> 	>    editorN)r   )r   set_hookr    )r   r   r   s   `` r   install_editorr"      sU    8> > > > > > > MM8[111#KMMr   komodoc                 .    t          | dz   d           dS )z Activestate Komodo [Edit] z -l {line} {filename}T)r   Nr"   exes    r   r#   r#   B   s!    311======r   scitec                 *    t          | dz              dS )z SciTE or Sc1 z {filename} -goto:{line}Nr%   r&   s    r   r(   r(   G   s    34455555r   	notepad++c                 *    t          | dz              dS )z/ Notepad++ http://notepad-plus.sourceforge.net z -n{line} {filename}Nr%   r&   s    r   notepadplusplusr,   L   s    30011111r   jedc                 *    t          | dz              dS )z& JED, the lightweight emacsish editor  +{line} {filename}Nr%   r&   s    r   r-   r-   Q   s    3//00000r   idlec                     | Hddl }t          j                            |j                  }t          j                            |d          } t          | dz              dS )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'   r2   ps      r   r0   r0   V   sX     {GOOG011 gll1i((3'(((((r   matec                 *    t          | dz              dS )z TextMate, the missing editorz -w -l {line} {filename}Nr%   r&   s    r   r9   r9   g   s     34455555r   emacsc                 *    t          | dz              d S )Nr/   r%   r&   s    r   r;   r;   r   s    3//00000r   	gnuclientc                 *    t          | dz              d S )Nz -nw +{line} {filename}r%   r&   s    r   r=   r=   v   s    33344444r   cedt.exec                 *    t          | dz              d S )Nz /L:{line} {filename}r%   r&   s    r   crimson_editorrA   z   s    31122222r   katec                 *    t          | dz              d S )Nz -u -l {line} {filename}r%   r&   s    r   rB   rB   ~   s    34455555r   )F)r#   )r(   )r*   )r-   )r0   )r9   )r;   )r=   )r?   )rB   )__doc__r3   r   r   r   IPythonr   IPython.core.errorr   IPython.utilsr   r"   r#   r(   r,   r-   r0   r9   r;   r=   rA   rB    r   r   <module>rI      sU    
			      



       & & & & & & # # # # # #+$ +$ +$ +$`> > > >
6 6 6 6
2 2 2 2
1 1 1 1
) ) ) )"6 6 6 61 1 1 15 5 5 53 3 3 36 6 6 6 6 6r   