← Back
Editing: editorhooks.cpython-311.pyc
� �@�c� � � � d Z ddlZddlZddlZddlZddlmZ ddlmZ ddl m Z dd�Zdd �Zdd�Z dd �Zd d�Zd!d�Zd"d�Zd#d�Zd$d�Zd%d�Zd&d�ZdS )'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� �fd� }t � � � d|� � � t � � _ dS )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� � rt j |� � }t j |d�� � }|� � � dk rt � � ��rt j d� � d S d S )Nr )�filename�line�>�winT)�shellzPress Enter when done editing:)�format�shlex�quote�print�sys�platform� startswith�split� subprocess�Popen�waitr r �input)�selfr r �cmd�proc�templater s ���9/usr/lib/python3/dist-packages/IPython/lib/editorhooks.py�call_editorz#install_editor.<locals>.call_editor. s� �� ��<��D��o�o�u�{�8�'<�'<�4�o�H�H�� �c�3�����<�"�"�5�)�)� #��+�c�"�"�C����4�0�0�0���9�9�;�;�!����)�)�O�� >��O�<�=�=�=�=�=� >� >� �editorN)r )r �set_hookr )r r r s `` r �install_editorr"