§
    �Ÿjw0  ã                   óø  — 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m	Z	 ddl
mZ ddl
mZ ddlmZ ddlmZ dd	lmZ dd
lmZ ddlmZmZmZmZ ddlmZ ddlmZmZ ddlm Z m!Z!m"Z" ddl#m$Z$ ddl%m&Z& ddl'm(Z( ddl)m*Z*m+Z+m,Z,m-Z-m.Z. dZ/ G d„ de¦  «        Z0 e1e¦  «        Z2e2 3                    e!¦  «         i Z4d„ Z5 e5dddd¦  «          e5dddd¦  «          e5d d!d"d#¦  «          e5d$d%d&d'¦  «          e5d(d)d*d+¦  «          e¦   «         Z6de6j7        _8        d,e6j        _9        d-e6j&        _:        d.e6j7        _;        d.e6j7        _<        d.e6j7        _=        d/e6j7        _>        d0e6j7        _?        e6d1fe4d2<   d3d4d5iid6fe4d4<   d3d7d5iid8fe4d9<   e2 3                    e4¦  «          e1e¦  «        Z@e@ 3                    e"¦  «          G d:„ d;e¦  «        ZA G d<„ d3ee ¦  «        ZBd?d=„ZCeBjD        ZEeFd>k    r eE¦   «          dS dS )@zp
The :class:`~traitlets.config.application.Application` object for the command
line :command:`ipython` program.
é    N)ÚConfig)Úboolean_flagÚcatch_config_error)Úrelease)Úusage)ÚIPCompleter)ÚCrashHandler)ÚPlainTextFormatter)ÚHistoryManager)Ú
ProfileDirÚBaseIPythonApplicationÚ
base_flagsÚbase_aliases)ÚMagicsManager)ÚScriptMagicsÚLoggingMagics)ÚInteractiveShellAppÚshell_flagsÚshell_aliases)ÚStoreMagicsé   )ÚTerminalInteractiveShell)Úget_ipython_dir)ÚBoolÚListÚdefaultÚobserveÚTypea  
ipython --matplotlib       # enable matplotlib integration
ipython --matplotlib=qt    # enable matplotlib integration with qt4 backend

ipython --log-level=DEBUG  # set logging to DEBUG
ipython --profile=foo      # start with profile foo

ipython profile create foo # create profile foo w/ default config files
ipython help profile       # show the help for the profile subcmd

ipython locate             # print the path to the IPython directory
ipython locate profile foo # print the path to the directory for profile `foo`
c                   ó,   ‡ — e Zd ZdZˆ fd„Zˆ fd„Zˆ xZS )ÚIPAppCrashHandlerzDsys.excepthook for IPython itself, leaves a detailed report on disk.c                 ó’   •— t           j        }t           j        }d}t          t          | ¦  «                             ||||¦  «         d S )Nz)https://github.com/ipython/ipython/issues)r   ÚauthorÚauthor_emailÚsuperr    Ú__init__)ÚselfÚappÚcontact_nameÚcontact_emailÚbug_trackerÚ	__class__s        €úc/var/www/finuniver-perm.ru/html/student/venv/lib/python3.11/site-packages/IPython/terminal/ipapp.pyr%   zIPAppCrashHandler.__init__C   sM   ø€ Ý”~ˆÝÔ,ˆØAˆÝÕ Ñ%Ô%×.Ò.Ø�˜}¨kñ	
ô 	
ð 	
ð 	
ð 	
ó    c                 ód  •— | j         }t          t          | ¦  «                             |¦  «        g}|j        }	  ||dz   ¦  «         | j        j        j        d         D ]} ||¦  «         Œ |d¦  «          || j        j        j        dz   ¦  «         n#  Y nxY wd 	                    |¦  «        S )z*Return a string containing a crash report.zHistory of session input:Ú_ihz7
*** Last line of input (may not be in above history):
ú
Ú )
Úsection_sepr$   r    Úmake_reportÚappendr'   ÚshellÚuser_nsÚ_last_input_lineÚjoin)r&   Ú	tracebackÚsec_sepÚreportÚrpt_addÚliner+   s         €r,   r3   zIPAppCrashHandler.make_reportK   sÈ   ø€ ð Ô"ˆåÕ)¨4Ñ0Ô0×<Ò<¸YÑGÔGÐHˆà”-ˆð	ØˆG�GÐ7Ñ7Ñ8Ô8Ð8ØœœÔ.¨uÔ5ð ð �Ø�˜‘”��ØˆGÐOÑPÔPÐPØˆG�D”H”NÔ3°DÑ8Ñ9Ô9Ð9Ð9øð	ØˆDøøøà�wŠw�v‰ŒÐs   ºAB ÂB)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r%   r3   Ú__classcell__©r+   s   @r,   r    r    @   sW   ø€ € € € € ØNÐNð
ð 
ð 
ð 
ð 
ðð ð ð ð ð ð ð ð r-   r    c                  óD   — t                                t          | Ž ¦  «        S ©N)Úfrontend_flagsÚupdater   )Úargss    r,   ú<lambda>rI   d   s   € �×-Ò-­l¸DÐ.AÑBÔB€ r-   zautoedit-syntaxz(TerminalInteractiveShell.autoedit_syntaxz1Turn on auto editing of files with syntax errors.z2Turn off auto editing of files with syntax errors.zsimple-promptz&TerminalInteractiveShell.simple_promptz-Force simple minimal prompt using `raw_input`z1Use a rich interactive prompt with prompt_toolkitÚbannerz!TerminalIPythonApp.display_bannerz'Display a banner upon starting IPython.z-Don't display a banner upon starting IPython.zconfirm-exitz%TerminalInteractiveShell.confirm_exitzÂSet to confirm when you try to exit IPython with an EOF (Control-D
    in Unix, Control-Z/Enter in Windows). By typing 'exit' or 'quit',
    you can force a direct exit without any confirmation.z#Don't prompt the user when exiting.z
term-titlez#TerminalInteractiveShell.term_titlez'Enable auto setting the terminal title.z(Disable auto setting the terminal title.Fz'IPython.terminal.prompts.ClassicPromptsr1   ÚNoColorÚPlainz:Gives IPython a similar feel to the classic Python prompt.ÚclassicÚTerminalIPythonAppÚquickTz*Enable quick startup with no config files.Úforce_interactz¬If running code from the command line, become interactive afterwards.
    It is often useful to follow this with `--` to treat remaining flags as
    script arguments.
    Úic                   ó0   — e Zd ZdZ ed¬¦  «        Zd„ ZdS )ÚLocateIPythonAppz!print the path to the IPython dir)z%IPython.core.profileapp.ProfileLocatez.print the path to an IPython profile directory)Úprofilec                 ón   — | j         �| j                              ¦   «         S t          | j        ¦  «         d S rE   )ÚsubappÚstartÚprintÚipython_dir©r&   s    r,   rW   zLocateIPythonApp.start­   s5   € ØŒ;Ð"Ø”;×$Ò$Ñ&Ô&Ð&å�$Ô"Ñ#Ô#Ð#Ð#Ð#r-   N)r>   r?   r@   ÚdescriptionÚdictÚsubcommandsrW   © r-   r,   rS   rS   ¦   sC   € € € € € Ø9€KØ�$ð
ðñ ô €Kð
$ð $ð $ð $ð $r-   rS   c                   ó„  ‡ — e Zd ZdZej        ZeZe	Z
eZeZ e¦   «         Z eeed¬¦  «                             d¬¦  «        Z ed¦  «        d„ ¦   «         Z edd	d
ej        fd¬¦  «        Z ed¦  «        Z edd¬¦  «                             d¬¦  «        Z ed¦  «        d„ ¦   «         Z edd¬¦  «                             d¬¦  «        Z edd¬¦  «                             d¬¦  «        Z ed¦  «        d„ ¦   «         Z  eddd¦  «        d„ ¦   «         Z! ed¦  «        Z"e#d ˆ fd„	¦   «         Z$d„ Z%d„ Z&d„ Z'd„ Z(ˆ xZ)S )!rN   Úipythonz\Class to use to instantiate the TerminalInteractiveShell object. Useful for custom Frontends)ÚklassÚdefault_valueÚhelpT)ÚconfigÚclassesc                 óŠ   — t           | j        t          t          t          t
          t          t          t          t          t          gS )zCThis has to be in a method, for TerminalIPythonApp to be available.)r   r+   r   r   r   r   r
   r   r   r   r   rZ   s    r,   Ú_classes_defaultz#TerminalIPythonApp._classes_defaultÄ   s1   € õ  ØŒNÝ$ÝÝÝÝÝÝÝÝð
ð 	
r-   )z"IPython.core.profileapp.ProfileAppz#Create and manage IPython profiles.)zipykernel.kernelapp.IPKernelAppz,Start a kernel without an attached frontend.z'IPython.terminal.ipapp.LocateIPythonApp)z"IPython.core.historyapp.HistoryAppz$Manage the IPython history database.)rT   ÚkernelÚlocateÚhistoryFz>Start IPython quickly by skipping the loading of config files.)rc   rO   c                 ó*   — |d         r
d„ | _         d S d S )NÚnewc                  ó   — d S rE   r^   )ÚaÚkws     r,   rI   z3TerminalIPythonApp._quick_changed.<locals>.<lambda>î   s   € °T€ r-   )Úload_config_file©r&   Úchanges     r,   Ú_quick_changedz!TerminalIPythonApp._quick_changedë   s)   € à�%Œ=ð 	:Ø$9Ð$9ˆDÔ!Ð!Ð!ð	:ð 	:r-   z2Whether to display a banner upon starting IPython.zšIf a command or file is given via the command-line,
        e.g. 'ipython foo.py', start an interactive shell after executing the
        file or command.rP   c                 ó(   — |d         r	d| _         d S d S )Nrl   T)Úinteractrq   s     r,   Ú_force_interact_changedz*TerminalIPythonApp._force_interact_changedû   s#   € à�%Œ=ð 	!Ø ˆDŒMˆMˆMð	!ð 	!r-   Úfile_to_runÚcode_to_runÚmodule_to_runc                 óP   — |d         }|rd| _         |r| j        sd| _        d S d S d S )Nrl   TF)Úsomething_to_runrP   ru   )r&   rr   rl   s      r,   Ú_file_to_run_changedz'TerminalIPythonApp._file_to_run_changed   sL   € à�UŒmˆØð 	)Ø$(ˆDÔ!Øð 	&�tÔ*ð 	&Ø %�”��ð	&ð 	&ð 	&ð 	&r-   Nc                 óš  •— t          t          | ¦  «                             |¦  «         | j        �dS | j        r| j        s| j        d         | _        |                      ¦   «          |                      ¦   «          |  	                    ¦   «          |  
                    ¦   «          |                      ¦   «          |                      ¦   «          dS )z8Do actions after construct, but before starting the app.Nr   )r$   rN   Ú
initializerV   Ú
extra_argsr{   rw   Ú	init_pathÚ
init_shellÚinit_bannerÚinit_gui_pylabÚinit_extensionsÚ	init_code)r&   Úargvr+   s     €r,   r~   zTerminalIPythonApp.initialize  sÀ   ø€ õ 	Õ  $Ñ'Ô'×2Ò2°4Ñ8Ô8Ð8ØŒ;Ð"àˆFàŒ?ð 	2 4Ô#8ð 	2Ø#œ¨qÔ1ˆDÔØ�ŠÑÔÐà�ŠÑÔÐà×ÒÑÔÐà×ÒÑÔÐØ×ÒÑÔÐØ�ŠÑÔÐÐÐr-   c                 ó¨   — | j                              | | j        | j        | j        ¬¦  «        | _        | j        j                             | ¦  «         dS )z(initialize the InteractiveShell instance)ÚparentÚprofile_dirrY   r6   N)Úinteractive_shell_classÚinstancer‰   rY   r6   r5   Úconfigurablesr4   rZ   s    r,   r�   zTerminalIPythonApp.init_shell  sX   € ð Ô1×:Ò:À$Ø$(Ô$4Ø$(Ô$4¸d¼lð ;ñ Lô LˆŒ
ð 	Œ
Ô ×'Ò'¨Ñ-Ô-Ð-Ð-Ð-r-   c                 óž   — | j         r | j        r| j                             ¦   «          | j        t
          j        k    rt          ¦   «          dS dS )zoptionally display the bannerN)Údisplay_bannerru   r5   Úshow_bannerÚ	log_levelÚloggingÚINFOrX   rZ   s    r,   r‚   zTerminalIPythonApp.init_banner*  sK   € àÔð 	% 4¤=ð 	%ØŒJ×"Ò"Ñ$Ô$Ð$àŒ>�Wœ\Ò)Ð)­5©7¬7¨7¨7¨7Ð)Ð)r-   c                 óL   — |dk    rt          j        d¦  «         d| _        dS dS )z,Replace --pylab='inline' with --pylab='auto'Úinlinez>'inline' not available as pylab backend, using 'auto' instead.ÚautoN)ÚwarningsÚwarnÚpylab)r&   ÚnameÚoldrl   s       r,   Ú_pylab_changedz!TerminalIPythonApp._pylab_changed1  s6   € à�(Š?ˆ?ÝŒMð .ñ /ô /ð /àˆDŒJˆJˆJð ˆ?r-   c                 óh  — | j         �| j                              ¦   «         S | j        r5| j                             d¦  «         | j                             ¦   «          d S | j                             d¦  «         | j                             ¦   «          | j        j        st          j
        d¦  «         d S d S )NzStarting IPython's mainloop...zIPython not interactive...r   )rV   rW   ru   ÚlogÚdebugr5   ÚmainloopÚrestore_term_titleÚlast_execution_succeededÚsysÚexitrZ   s    r,   rW   zTerminalIPythonApp.start8  s¨   € ØŒ;Ð"Ø”;×$Ò$Ñ&Ô&Ð&àŒ=ð 	ØŒH�NŠNÐ;Ñ<Ô<Ð<ØŒJ×ÒÑ!Ô!Ð!Ð!Ð!àŒH�NŠNÐ7Ñ8Ô8Ð8ØŒJ×)Ò)Ñ+Ô+Ð+Ø”:Ô6ð Ý”˜‘”���ðð r-   rE   )*r>   r?   r@   r™   r   Úcl_usager[   r    Úcrash_handler_classÚ	_examplesÚexamplesÚflagsÚaliasesr   re   r   Úobjectr   ÚtagrŠ   r   rg   r\   rS   r]   r   Úauto_createrO   r   rs   rŽ   rP   rv   r|   r{   r   r~   r�   r‚   r›   rW   rB   rC   s   @r,   rN   rN   ´   se  ø€ € € € € Ø€DØ”.€KØ+ÐØ€Hà€EØ€GØˆd‰fŒf€Gà"˜dØØ.Økðñ ô ÷ 
‚c�€cÑÔð	 ð €WˆYÑÔð
ð 
ñ Ôð
ð  �$ð
ð
ð :ØÔ(ð
ð
ðñ ô €Kð" ��T‘
”
€KàˆD�ØQðñ ô ç	‚c�€cÑÔð 
ð €WˆWÑÔð:ð :ñ Ôð:ð �T˜$ØAðñ ô ç	‚c�€cÑÔð ð �T˜%ððñ ô ÷ 
‚c�€cÑÔð	 ð
 €WÐÑÔð!ð !ñ Ôð!ð €Wˆ]˜M¨?Ñ;Ô;ð&ð &ñ <Ô;ð&ð �T˜%‘[”[Ðàðð ð ð ð ñ Ôðð&	.ð 	.ð 	.ð3ð 3ð 3ð ð  ð  ðð ð ð ð ð ð r-   c                 óè   — | €t          ¦   «         } t          j                             | d¦  «        }t	          ¦   «         }|j                             |¦  «         |                     ¦   «          |j        S )zhLoad the default config file from the default ipython_dir.

    This is useful for embedded shells.
    NÚprofile_default)	r   ÚosÚpathr8   rN   Úconfig_file_pathsr4   rp   rd   )rY   r‰   r'   s      r,   Úload_default_configr²   E  sg   € ð
 ÐÝ%Ñ'Ô'ˆå”'—,’,˜{Ð,=Ñ>Ô>€KÝ
Ñ
Ô
€CØÔ× Ò  Ñ-Ô-Ð-Ø×ÒÑÔÐØŒ:Ðr-   Ú__main__rE   )GrA   r‘   r¯   r¢   r–   Útraitlets.config.loaderr   Útraitlets.config.applicationr   r   ÚIPython.corer   r   ÚIPython.core.completerr   ÚIPython.core.crashhandlerr	   ÚIPython.core.formattersr
   ÚIPython.core.historyr   ÚIPython.core.applicationr   r   r   r   ÚIPython.core.magicr   ÚIPython.core.magicsr   r   ÚIPython.core.shellappr   r   r   ÚIPython.extensions.storemagicr   Úinteractiveshellr   ÚIPython.pathsr   Ú	traitletsr   r   r   r   r   r¦   r    r\   r¨   rG   rF   ÚaddflagÚclassic_configÚInteractiveShellÚ
cache_sizeÚpprintÚprompts_classÚseparate_inÚseparate_outÚseparate_out2ÚcolorsÚxmoder©   rS   rN   r²   Úlaunch_instanceÚlaunch_new_instancer>   r^   r-   r,   ú<module>rÐ      s•  ððð ð €€€Ø 	€	€	€	Ø 
€
€
€
Ø €€€à *Ð *Ð *Ð *Ð *Ð *Ø IÐ IÐ IÐ IÐ IÐ IÐ IÐ IØ  Ð  Ð  Ð  Ð  Ð  Ø Ð Ð Ð Ð Ð Ø .Ð .Ð .Ð .Ð .Ð .Ø 2Ð 2Ð 2Ð 2Ð 2Ð 2Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø /Ð /Ð /Ð /Ð /Ð /ðð ð ð ð ð ð ð ð ð ð ð ð -Ð ,Ð ,Ð ,Ð ,Ð ,ðð ð ð ð ð ð ð ðð ð ð ð ð ð ð ð ð ð 6Ð 5Ð 5Ð 5Ð 5Ð 5Ø 6Ð 6Ð 6Ð 6Ð 6Ð 6Ø )Ð )Ð )Ð )Ð )Ð )ðð ð ð ð ð ð ð ð ð ð ð ð ð ð€	ð$ð ð ð ð ˜ñ ô ð ðB 	ˆˆZÑÔ€Ø ‡‚ˆ[Ñ Ô Ð Ø€Ø
BÐ
B€Ø €ÐÐEØ;Ø<ñô ð ð €ˆÐAØ7Ø;ñô ð ð
 €ˆÐ5Ø1Ø7ñô ð ð €ˆÐ?ð=ð *ñ	ô ð ð €ˆÐ;Ø-Ø.ñô ð ð �‘”€Ø-.€Ô Ô *Ø+0€Ô !Ô (Ø6_€Ô 'Ô 5Ø.0€Ô Ô +Ø/1€Ô Ô ,Ø02€Ô Ô -Ø)2€Ô Ô &Ø(/€Ô Ô %ð Ø@ð€ˆyÑ ð ˜W tÐ,Ð-Ø0ð€ˆwÑ ð Ð-°Ð5Ð6ðð€ˆsÑ ð ‡‚ˆ^Ñ Ô Ð à
ˆ$ˆ|Ñ
Ô
€Ø ‡‚ˆ}Ñ Ô Ð ð$ð $ð $ð $ð $Ð-ñ $ô $ð $ðOð Oð Oð Oð OÐ/Ð1Dñ Oô Oð Oðbð ð ð ð )Ô8Ð ð ˆzÒÐØÐÑÔÐÐÐð Ðr-   