| Server IP : 35.80.110.71 / Your IP : 216.73.216.170 Web Server : Apache/2.4.58 (Ubuntu) System : Linux ip-172-31-21-44 6.17.0-1019-aws #19~24.04.1-Ubuntu SMP Tue Jun 23 18:53:06 UTC 2026 x86_64 User : ubuntu ( 1000) PHP Version : 8.3.31 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /lib/python3/dist-packages/IPython/core/__pycache__/ |
Upload File : |
�
}�e � �t � d Z ddlZddlZddlZddlmZ g d�Zdddd �Zdd
�Zd� Z G d� d
� Z
d� Zd� Zd� Z
y)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)�pre_run_code_hook�late_startup_hook�
shutdown_hookc �* � | j }|�|dk( rd}ndt |� z }d|v r,t j j |� r
|d dk7 rd|z }t j |�d|�d|��d �
� }|r|j � dk7 r
t � �yy)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).N�notepad� z+%d� r �"z"%s"T)�shell) r �int�os�path�isfile�
subprocess�Popen�waitr )�self�filename�linenumr r �linemark�procs �4/usr/lib/python3/dist-packages/IPython/core/hooks.pyr r <