Format: application/x-python-code
⬇ Download File (3.8 KB)
   1  o
   2  
   3  ��h��@s�dZddlZddlZddlZddlZddlmZddlmZddl	m
   4  Z
   5  ddd�Zd d
   6  d	�Zd!dd�Z
   7  d"dd�Zd#dd�Zd$dd�Zd%dd�Zd&dd�Zd'dd�Zd(dd�Zd)dd�ZdS)*z� 'editor' hooks for common editors that work well with ipython
   8  
   9  They should honor the line number argument, at least.
  10  
  11  Contributions are *very* welcome.
  12  �N)�get_ipython)�TryNext)�	py3compatFcs*d��fdd�	}t��d|��t�_dS)ayInstalls the editor that is called by IPython for the %edit magic.
  13  
  14      This overrides the default editor, which is generally set by your EDITOR
  15      environment variable or is notepad (windows) or vi (linux). By supplying a
  16      template string `run_template`, you can control how the editor is invoked
  17      by IPython -- (e.g. the format in which it accepts command line options)
  18  
  19      Parameters
  20      ----------
  21      template : basestring
  22          run_template acts as a template for how your editor is invoked by
  23          the shell. It should contain '{filename}', which will be replaced on
  24          invocation with the file name, and '{line}', $line by line number
  25          (or 0) to invoke the file with.
  26      wait : bool
  27          If `wait` is true, wait until the user presses enter before returning,
  28          to facilitate non-blocking editors that exit immediately after
  29          the call.
  30      rcsv|durd}�jt�|�|d�}td|�tj�d�r t�|�}tj	|dd�}|�
  31  �dkr0t���r9t�
  32  d�dSdS)Nr)�filename�line�>�winT)�shellzPress Enter when done editing:)�format�shlex�quote�print�sys�platform�
  33  startswith�split�
  34  subprocess�Popen�waitrr�input)�selfrr�cmd�proc��templater��Mc:\Users\shubh\Videos\agent\nova\Lib\site-packages\IPython/lib/editorhooks.py�call_editor.s
  35  
  36  �z#install_editor.<locals>.call_editor�editorN)r)rZset_hookr)rrrrrr�install_editorsr�komodocCst|ddd�dS)z Activestate Komodo [Edit] z -l {line} {filename}T)rN�r��exerrrr Bs�scitecC�t|d�dS)z SciTE or Sc1 z {filename} -goto:{line}Nr!r"rrrr$G��	notepad++cCr%)z/ Notepad++ http://notepad-plus.sourceforge.net z -n{line} {filename}Nr!r"rrr�notepadplusplusLr&r(�jedcCr%)z& JED, the lightweight emacsish editor � +{line} {filename}Nr!r"rrrr)Qr&�idlecCs<|durddl}tj�|j�}tj�|d�}t|d�dS)z� Idle, the editor bundled with python
  37  
  38      Parameters
  39      ----------
  40      exe : str, None
  41          If none, should be pretty smart about finding the executable.
  42      Nrzidle.pyz {filename})�idlelib�os�path�dirnameZ__filename__�joinr)r#r,�prrrr+Vs
  43  �matecCr%)z TextMate, the missing editorz -w -l {line} {filename}Nr!r"rrrr2gs�emacscC�t|d�dS)Nr*r!r"rrrr3r��	gnuclientcCr4)Nz -nw +{line} {filename}r!r"rrrr6vr5�cedt.execCr4)Nz /L:{line} {filename}r!r"rrr�crimson_editorzr5r8�katecCr4)Nz -u -l {line} {filename}r!r"rrrr9~r5)F)r )r$)r')r))r+)r2)r3)r6)r7)r9)�__doc__r-rrrZIPythonrZIPython.core.errorrZ
  44  IPython.utilsrrr r$r(r)r+r2r3r6r8r9rrrr�<module>s&
  45  
  46  0
  47  
  48  
  49  
  50  
  51  
  52  
  53  
  54