}BFj0dZddlZddlZddlZddlZddlmZddlmZm 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/GddeZ0e1eZ2e23e!iZ4dZ5e5dddde5dddde5d d!d"d#e5d$d%d&d'e5d(d)d*d+e5d,d-d.d/eZ6de6j7_8d0e6j_9d1e6j&_:d2e6j7_;d2e6j7_<d2e6j7_=d3e6j7_>d4e6j7_?e6d5fe4d6<d7d8d9iid:fe4d8<d7d;d9iidd?eZAGd@d7ee ZBdBdAZCeBjDZEdS)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.ctj}tj}d}tt|||||dS)Nz)https://github.com/ipython/ipython/issues)rauthor author_emailsuperr __init__)selfapp contact_name contact_email bug_tracker __class__s DC:\PYTHON\_runtimes\venv\Lib\site-packages\IPython/terminal/ipapp.pyr%zIPAppCrashHandler.__init__BsM~ , A  %%.. }k     cd|j}tt||g}|j} ||dz|jjjdD] }|||d||jjjdzn#YnxYwd |S)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")400<rIcs--lD.ABBr-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. ic0eZdZdZedZdZdS)LocateIPythonAppz!print the path to the IPython dir)z%IPython.core.profileapp.ProfileLocatez.print the path to an IPython profile directory)profilecn|j|jSt|jdSrE)subappstartprint ipython_dirr&s r,rXzLocateIPythonApp.starts5 ; ";$$&& & $" # # # # #r-N)r>r?r@ descriptiondict subcommandsrXr-r,rTrTsC9K$ K $$$$$r-rTceZdZdZejZeZe Z e Z e Z e ZeeeddZeddZedd d ejfd ZeddZed ddZeddZedddZed ddZeddZ eddddZ!ed Z"e#d fd 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_defaults1 N $          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|_dSdS)NnewcdSrEr_)akws r,rIz3TerminalIPythonApp._quick_changed..sTr-)load_config_filer&changes r,_quick_changedz!TerminalIPythonApp._quick_changeds) %= :$9$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(|dr d|_dSdS)NrmT)interactrrs r,_force_interact_changedz*TerminalIPythonApp._force_interact_changeds# %= ! DMMM ! !r- file_to_run code_to_run module_to_runcP|d}|rd|_|r|js d|_dSdSdS)NrmTF)something_to_runrQrv)r&rsrms r,_file_to_run_changedz'TerminalIPythonApp._file_to_run_changedsLUm  )$(D !  &t* & %  & & & &r-Nctt|||jdS|jr|js|jd|_||| | | | dS)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  $''224888 ; " F ? 24#8 2#q1D       r-c|j||j|j|j|_|jj|dS)z(initialize the InteractiveShell instance)parent profile_dirrZr6N)interactive_shell_classinstancerrZr6r5 configurablesr4r[s r,rzTerminalIPythonApp.init_shell&sX 1::$$($4$($4dl;LL   ''-----r-c|jr |jr|j|jt jkrtdSdS)zoptionally display the bannerN)display_bannerrvr5 show_banner log_levelloggingINFOrYr[s r,rzTerminalIPythonApp.init_banner1sK   %4= % J " " $ $ $ >W\ ) )577777 ) )r-cL|dkrtjdd|_dSdS)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_changed8s6 (?? M. / / /DJJJ ?r-ch|j|jS|jr5|jd|jdS|jd|j|jjstj ddSdS)NzStarting IPython's mainloop...zIPython not interactive...r) rWrXrvlogdebugr5mainlooprestore_term_titlelast_execution_succeededsysexitr[s r,rXzTerminalIPythonApp.start?s ; ";$$&& & =  HNN; < < < J   ! ! ! ! ! HNN7 8 8 8 J ) ) + + +:6    r-rE)*r>r?r@rrcl_usager\r crash_handler_class _examplesexamplesflagsaliasesrrfrobjectrtagrrrhr]rTr^r auto_createrPrrtrrQrwr}r|rrrrrrXrBrCs@r,rOrOsu D.K+H EGdffG"d. k cc   WY   $  :  (     K $t**...--K D Q    cc  WW:::T$ A cc T% cc   W !!! W]M?;;&&<;&T%[[& . . .333          r-c|t}tj|d}t }|j|||jS)zhLoad the default config file from the default ipython_dir. This is useful for embedded shells. Nprofile_default) rospathr8rOconfig_file_pathsr4rqre)rZrr's r,load_default_configrLsg %'' ',,{,=>>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,rs ******IIIIIIII ......222222666666//////-,,,,,655555666666))))))  $ B Z [ B BE;<A7; 517?=*   )*)   ;-.-.*+0!(-'5/1+/1,02-)2&(/%@yWt,-0w -56s ^ $|  } $ $ $ $ $- $ $ $OOOOO/1DOOOb    )8r-