wL i0dZddlZddlZddlZddlZddlmZddlmZm Z ddl m Z ddl m Z ddl mZddlmZdd lmZdd lmZdd lmZmZmZmZdd lmZdd lmZmZddlm Z m!Z!m"Z"ddl#m$Z$ddl%m&Z&ddl'm(Z(ddl)m*Z*m+Z+m,Z,m-Z-m.Z.dZ/GddeZ0e1eZ2e2jge!iZ4dZ5e5dddde5dddde5d d!d"d#e5d$d%d&d'e5d(d)d*d+e5d,d-d.d/eZ6de6jn_8d0e6j$_9d1e6jL_:d2e6jn_;d2e6jn_<d2e6jn_=d3e6jn_>d4e6jn_?e6d5fe4d6<d7d8d9iid:fe4d8<d7d;d9iidd?eZAGd@d7ee ZBdBdAZCeBjZEy)Czp The :class:`~traitlets.config.application.Application` object for the command line :command:`ipython` program. N)Config) boolean_flagcatch_config_error)release)usage) IPCompleter) CrashHandler)PlainTextFormatter)HistoryManager) ProfileDirBaseIPythonApplication base_flags base_aliases) MagicsManager) ScriptMagics LoggingMagics)InteractiveShellApp shell_flags shell_aliases) StoreMagics)TerminalInteractiveShell)get_ipython_dir)BoolListdefaultobserveTypea 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,eZdZdZfdZfdZxZS)IPAppCrashHandlerzDsys.excepthook for IPython itself, leaves a detailed report on disk.cvtj}tj}d}tt|||||y)Nz)https://github.com/ipython/ipython/issues)rauthor author_emailsuperr __init__)selfapp contact_name contact_email bug_tracker __class__s \/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/IPython/terminal/ipapp.pyr%zIPAppCrashHandler.__init__Bs5~~ ,, A  . }k cf|j}tt||g}|j} ||dz|j j jdD] }|| |d||j j jdzdj|S#YxYw)z*Return a string containing a crash report.zHistory of session input:_ihz7 *** Last line of input (may not be in above history):  ) section_sepr$r make_reportappendr'shelluser_ns_last_input_linejoin)r& tracebacksec_sepreportrpt_addliner+s r,r3zIPAppCrashHandler.make_reportJs"")4rIcs--lD.ABr-zautoedit-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_toolkitbannerz!TerminalIPythonApp.display_bannerz'Display a banner upon starting IPython.z-Don't display a banner upon starting IPython.z confirm-exitz%TerminalInteractiveShell.confirm_exitzSet 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.tipz#TerminalInteractiveShell.enable_tipz Shows a tip when IPython starts.z#Don't show tip when IPython starts.z term-titlez#TerminalInteractiveShell.term_titlez'Enable auto setting the terminal title.z(Disable auto setting the terminal title.Fz'IPython.terminal.prompts.ClassicPromptsr1nocolorPlainz:Gives IPython a similar feel to the classic Python prompt.classicTerminalIPythonAppquickTz*Enable quick startup with no config files.force_interactzIf 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(eZdZdZedZdZy)LocateIPythonAppz!print the path to the IPython dir)z%IPython.core.profileapp.ProfileLocatez.print the path to an IPython profile directory)profilecz|j|jjSt|jyrE)subappstartprint ipython_dirr&s r,rXzLocateIPythonApp.starts- ;; ";;$$& & $"" #r-N)r>r?r@ descriptiondict subcommandsrXr-r,rTrTs9K K $r-rTc2eZdZdZej ZeZe Z e Z e Z e Zeeedj%dZeddZedd d ej fd Zedj%dZed dj%dZeddZeddj%dZed dj%dZeddZ eddddZ!ed Z"e#dfd Z$dZ%dZ&dZ'dZ(xZ)S) rOipythonz\Class to use to instantiate the TerminalInteractiveShell object. Useful for custom Frontends)klass default_valuehelpT)configclassesc t|jtttt t ttttg S)zCThis has to be in a method, for TerminalIPythonApp to be available.) rr+rr rr r rrrrr[s r,_classes_defaultz#TerminalIPythonApp._classes_defaults3 NN $          r-)z"IPython.core.profileapp.ProfileAppz#Create and manage IPython profiles.)zipykernel.kernelapp.IPKernelAppz,Start a kernel without an attached frontend.z'IPython.terminal.ipapp.LocateIPythonApp)z"IPython.core.historyapp.HistoryAppz$Manage the IPython history database.)rUkernellocatehistoryFz>Start IPython quickly by skipping the loading of config files.)rdrPc |dr d|_yy)NnewcyrEr_)akws r,rIz3TerminalIPythonApp._quick_changed..sr-)load_config_filer&changes r,_quick_changedz!TerminalIPythonApp._quick_changeds %=$9D ! r-z2Whether to display a banner upon starting IPython.zIf 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.rQc|drd|_yy)NrmT)interactrrs r,_force_interact_changedz*TerminalIPythonApp._force_interact_changeds %= DM r- file_to_run code_to_run module_to_runcN|d}|rd|_|r|jsd|_yyy)NrmTF)something_to_runrQrv)r&rsrms r,_file_to_run_changedz'TerminalIPythonApp._file_to_run_changeds/Um $(D ! t** % +3r-c^tt| ||jy|jr |j s|jd|_|j|j|j|j|j|jy)z8Do actions after construct, but before starting the app.Nr) r$rO initializerW extra_argsr|rx init_path init_shell init_bannerinit_gui_pylabinit_extensions init_code)r&argvr+s r,rzTerminalIPythonApp.initializes  $248 ;; "  ??4#8#8#q1D       r-c|jj||j|j|j|_|j j j|y)z(initialize the InteractiveShell instance)parent profile_dirrZr6N)interactive_shell_classinstancerrZr6r5 configurablesr4r[s r,rzTerminalIPythonApp.init_shell&sV 11::$$($4$4$($4$4dll;L    ''-r-c|jr&|jr|jj|jt j kr tyy)zoptionally display the bannerN)display_bannerrvr5 show_banner log_levelloggingINFOrYr[s r,rzTerminalIPythonApp.init_banner1s8   4== JJ " " $ >>W\\ )57 )r-cH|dk(rtjdd|_yy)z,Replace --pylab='inline' with --pylab='auto'inlinez>'inline' not available as pylab backend, using 'auto' instead.autoN)warningswarnpylab)r&nameoldrms r,_pylab_changedz!TerminalIPythonApp._pylab_changed8s& (? MM. /DJ r-c|j|jjS|jr6|jj d|j j y|jj d|j j|j jstjdyy)NzStarting IPython's mainloop...zIPython not interactive...r) rWrXrvlogdebugr5mainlooprestore_term_titlelast_execution_succeededsysexitr[s r,rXzTerminalIPythonApp.start?s ;; ";;$$& & == HHNN; < JJ   ! HHNN7 8 JJ ) ) +::66 7r-rE)*r>r?r@rrcl_usager\r crash_handler_class _examplesexamplesflagsaliasesrrfrobjectrtagrrrhr]rTr^r auto_createrPrrtrrQrwr}r|rrrrrrXrBrCs@r,rOrOs D..K+H EGfG". k cc   Y    :  ( (   K t*...-K  Q  cc  W::$ A cc % cc   !! ]M?;&<&%[& .3  r-c| t}tjj|d}t }|j j ||j|jS)zhLoad the default config file from the default ipython_dir. This is useful for embedded shells. profile_default) rospathr8rOconfig_file_pathsr4rqre)rZrr's r,load_default_configrLsY %' '',,{,=>K  C  - ::r-rE)FrArrrrtraitlets.config.loaderrtraitlets.config.applicationrr IPython.corerrIPython.core.completerrIPython.core.crashhandlerr IPython.core.formattersr IPython.core.historyr IPython.core.applicationr r rrIPython.core.magicrIPython.core.magicsrrIPython.core.shellapprrrIPython.extensions.storemagicrinteractiveshellr IPython.pathsr traitletsrrrrrrr r]rrGrFaddflagclassic_configInteractiveShell cache_sizepprint prompts_class separate_in separate_out separate_out2colorsxmoderrTrOrlaunch_instancelaunch_new_instancer_r-r,rsC *I .26/-66)  $ B Z [ BE;<A7; 517?=*   )*)   ;-.-.*+0!!(-''5/1+/1,02-)2&(/%@yWt,-0w -56s ^ | } $- $O/1DOb )88r-