Ë
    7;h>0  ã                   óÒ  — 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«      Z2e2jg                  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e6jn                  _8        d,e6j$                  _9        d-e6jL                  _:        d.e6jn                  _;        d.e6jn                  _<        d.e6jn                  _=        d/e6jn                  _>        d0e6jn                  _?        e6d1fe4d2<   d3d4d5iid6fe4d4<   d3d7d5iid8fe4d9<   e2jg                  e4«        e1e«      Z@e@jg                  e"«        G d:„ d;e«      ZA G d<„ d3ee «      ZBd>d=„ZCeBjˆ                  ZEy)?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                 óv   •— t         j                  }t         j                  }d}t        t        | �  ||||«       y )Nz)https://github.com/ipython/ipython/issues)r   ÚauthorÚauthor_emailÚsuperr    Ú__init__)ÚselfÚappÚcontact_nameÚcontact_emailÚbug_trackerÚ	__class__s        €úg/workspace/moltex-experiments/.pixi/envs/default/lib/python3.12/site-packages/IPython/terminal/ipapp.pyr%   zIPAppCrashHandler.__init__B   s5   ø€ Ü—~‘~ˆÜ×,Ñ,ˆØAˆÜÔ Ñ.Ø�˜}¨kõ	
ó    c                 óf  •— | j                   }t        t        | �  |«      g}|j                  }	  ||dz   «       | j
                  j                  j                  d   D ]
  } ||«       Œ  |d«        || j
                  j                  j                  dz   «       dj                  |«      S #  Y ŒxY w)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_reportJ   s£   ø€ ð ×"Ñ"ˆäÔ)¨4Ñ<¸YÓGÐHˆà—-‘-ˆð	Ù�GÐ7Ñ7Ô8ØŸ™Ÿ™×.Ñ.¨uÔ5�Ù˜•ð 6áÐOÔPÙ�D—H‘H—N‘N×3Ñ3°DÑ8Ô9ð �w‰w�v‹Ðøð	Ùús   ¯A,B, Â,B0)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r%   r3   Ú__classcell__©r+   s   @r,   r    r    ?   s   ø„ ÙNô
÷ð r-   r    c                  ó8   — t         j                  t        | Ž «      S ©N)Úfrontend_flagsÚupdater   )Úargss    r,   Ú<lambda>rI   c   s   € œ×-Ñ-¬l¸DÐ.AÔBr-   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                   ó(   — e Zd ZdZ ed¬«      Zd„ Zy)ÚLocateIPythonAppz!print the path to the IPython dir)z%IPython.core.profileapp.ProfileLocatez.print the path to an IPython profile directory)Úprofilec                 óz   — | j                   �| j                   j                  «       S t        | j                  «       y rE   )ÚsubappÚstartÚprintÚipython_dir©r&   s    r,   rW   zLocateIPythonApp.start¬   s-   € Ø�;‰;Ð"Ø—;‘;×$Ñ$Ó&Ð&ä�$×"Ñ"Õ#r-   N)r>   r?   r@   ÚdescriptionÚdictÚsubcommandsrW   © r-   r,   rS   rS   ¥   s   „ Ø9€KÙð
ô€Kó
$r-   rS   c                   ó2  ‡ — e Zd ZdZej
                  ZeZe	Z
eZeZ e«       Z eeed¬«      j%                  d¬«      Z ed«      d„ «       Z edd	d
ej                  fd¬«      Z ed«      j%                  d¬«      Z edd¬«      j%                  d¬«      Z ed«      d„ «       Z edd¬«      j%                  d¬«      Z edd¬«      j%                  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Ã   s3   € ô  Ø�N‰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„ | _         y y )NÚnewc                   ó   — y rE   r^   )ÚaÚkws     r,   rI   z3TerminalIPythonApp._quick_changed.<locals>.<lambda>í   s   € °Tr-   )Úload_config_file©r&   Úchanges     r,   Ú_quick_changedz!TerminalIPythonApp._quick_changedê   s   € à�%Š=Ù$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| _         y y )Nrl   T)Úinteractrq   s     r,   Ú_force_interact_changedz*TerminalIPythonApp._force_interact_changedú   s   € à�%Š=Ø ˆD�Mð r-   Úfile_to_runÚcode_to_runÚmodule_to_runc                 óN   — |d   }|rd| _         |r| j                  sd| _        y y y )Nrl   TF)Úsomething_to_runrP   ru   )r&   rr   rl   s      r,   Ú_file_to_run_changedz'TerminalIPythonApp._file_to_run_changedÿ   s/   € à�U‰mˆÙØ$(ˆDÔ!Ù�t×*Ò*Ø %�•ð +ˆ3r-   c                 ó^  •— t         t        | �  |«       | j                  �y| j                  r | j
                  s| j                  d   | _        | j                  «        | j                  «        | j                  «        | j                  «        | j                  «        | j                  «        y)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°4Ô8Ø�;‰;Ð"àà�?Š? 4×#8Ò#8Ø#Ÿ™¨qÑ1ˆDÔØ�‰Ôà�‰Ôà×ÑÔà×ÑÔØ×ÑÔØ�‰Õr-   c                 óÒ   — | j                   j                  | | j                  | j                  | j                  ¬«      | _        | j
                  j                  j                  | «       y)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  sV   € ð ×1Ñ1×:Ñ:À$Ø$(×$4Ñ$4Ø$(×$4Ñ$4¸d¿l¹lð ;ó LˆŒ
ð 	�
‰
× Ñ ×'Ñ'¨Õ-r-   c                 ó¸   — | j                   r&| j                  r| j                  j                  «        | j                  t
        j                  k  rt        «        yy)zoptionally display the bannerN)Údisplay_bannerru   r5   Úshow_bannerÚ	log_levelÚloggingÚINFOrX   rZ   s    r,   r‚   zTerminalIPythonApp.init_banner)  s8   € à×Ò 4§=¢=Ø�J‰J×"Ñ"Ô$à�>‰>œWŸ\™\Ò)¬5­7Ð)r-   c                 óH   — |dk(  rt        j                  d«       d| _        yy)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_changed0  s&   € à�(Š?Ü�M‰Mð .ô /àˆD�Jð r-   c                 ó–  — | j                   �| j                   j                  «       S | j                  r6| j                  j	                  d«       | j
                  j                  «        y | j                  j	                  d«       | j
                  j                  «        | j
                  j                  st        j                  d«       y y )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.start7  s…   € Ø�;‰;Ð"Ø—;‘;×$Ñ$Ó&Ð&à�=Š=Ø�H‰H�N‰NÐ;Ô<Ø�J‰J×ÑÕ!à�H‰H�N‰NÐ7Ô8Ø�J‰J×)Ñ)Ô+Ø—:‘:×6Ò6Ü—‘˜•ð 7r-   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   ³   s”  ø„ Ø€DØ—.‘.€KØ+ÐØ€Hà€EØ€GÙ‹f€Gá"ØØ.Økô÷ 
�c�€cÓð	 ñ ˆYÓñ
ó ð
ñ  ð
ð
ð :Ø×(Ñ(ð
ð
ô€Kñ  �t“*—.‘.¨�.Ó-€Kñ �ØQôç	�c�€cÓð 
ñ ˆWÓñ:ó ð:ñ ˜$ØAôç	�c�€cÓð ñ ˜%ðô÷ 
�c�€cÓð	 ñ
 ÐÓñ!ó ð!ñ ˆ]˜M¨?Ó;ñ&ó <ð&ñ ˜%“[Ðàôó ðò&	.ò3ò ör-   c                 óÜ   — | €
t        «       } t        j                  j                  | d«      }t	        «       }|j
                  j                  |«       |j                  «        |j                  S )zhLoad the default config file from the default ipython_dir.

    This is useful for embedded shells.
    Úprofile_default)	r   ÚosÚpathr8   rN   Úconfig_file_pathsr4   rp   rd   )rY   r‰   r'   s      r,   Úload_default_configr²   D  sY   € ð
 ÐÜ%Ó'ˆä—'‘'—,‘,˜{Ð,=Ó>€KÜ
Ó
€CØ×Ñ× Ñ  Ô-Ø×ÑÔØ�:‰:Ðr-   rE   )FrA   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,   Ú<module>rÏ      s(  ðñó Û 	Û 
Û å *ß IÝ  Ý Ý .Ý 2Ý 6Ý /÷ó õ -÷÷ñ õ 6Ý 6Ý )÷õ ð€	ô$˜ô ñB 	ˆZÓ€Ø ‡�ˆ[Ô Ø€Ù
B€Ù ÐÐEØ;Ø<ôñ ˆÐAØ7Ø;ôñ
 ˆÐ5Ø1Ø7ôñ ˆÐ?ð=ð *ô	ñ ˆÐ;Ø-Ø.ôñ “€Ø-.€× Ñ Ô *Ø+0€× !Ñ !Ô (Ø6_€× 'Ñ 'Ô 5Ø.0€× Ñ Ô +Ø/1€× Ñ Ô ,Ø02€× Ñ Ô -Ø)2€× Ñ Ô &Ø(/€× Ñ Ô %ð Ø@ð€ˆyÑ ð ˜W tÐ,Ð-Ø0ð€ˆwÑ ð Ð-°Ð5Ð6ðð€ˆsÑ ð ‡�ˆ^Ô á
ˆ|Ó
€Ø ‡�ˆ}Ô ô$Ð-ô $ôOÐ/Ð1Dô Oóbð )×8Ñ8Ñ r-   