Файловый менеджер - Редактировать - /opt/imh-python/lib/python3.9/site-packages/IPython/core/__pycache__/hooks.cpython-39.pyc
Ðазад
a o�h � @ sx d Z ddlZddlZddlZddlmZ g d�Zdddd �Zddd�Zd d� Z G dd� d�Z dd� Zdd� Zdd� Z dS )a� Hooks for IPython. In Python, it is possible to overwrite any method of any object if you really want to. But IPython exposes a few 'hooks', methods which are *designed* to be overwritten by users for customization purposes. This module defines the default versions of all such hooks, which get used by IPython if not overridden by the user. Hooks are simple functions, but they should be declared with ``self`` as their first argument, because when activated they are registered into IPython as instance methods. The self argument will be the IPython running instance itself, so hooks have full access to the entire IPython object. If you wish to define a new hook and activate it, you can make an :doc:`extension </config/extensions/index>` or a :ref:`startup script <startup_files>`. For example, you could use a startup file like this:: import os def calljed(self,filename, linenum): "My editor hook calls the jed editor directly." print "Calling my own editor, jed ..." if os.system('jed +%d %s' % (linenum,filename)) != 0: raise TryNext() def load_ipython_extension(ip): ip.set_hook('editor', calljed) � N� ��TryNext)�editor�synchronize_with_editor� show_in_pager�pre_prompt_hook� clipboard_getz8a callback for the 'pre_execute' or 'pre_run_cell' eventz,a callback for the 'shell_initialized' eventzthe atexit module)Zpre_run_code_hookZlate_startup_hookZ shutdown_hookTc C s� | j }|du s|dkrd}ndt|� }d|v rPtj�|�rP|d dkrPd| }tjd |||f d d�}|r~|�� dkr~t� �dS )a 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).NZnotepad� z+%d� r �"z"%s"z%s %s %sT)�shell) r �int�os�path�isfile� subprocess�Popen�waitr )�self�filename�linenumr r Zlinemark�proc� r ��/root/rpmbuild/BUILDROOT/imh-python39-modules-3.9.7-92.el8.x86_64/opt/imh-python/lib/python3.9/site-packages/IPython/core/hooks.pyr <