ó
æNXc           @@ sq  d  Z  d d l m Z d d l m 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 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 d d l m Z m Z m Z m Z d d l 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, d d l- m. Z. m/ Z/ m0 Z0 d Z1 d e f d „  ƒ  YZ2 e3 e ƒ Z4 e4 j5 e# ƒ i  Z6 d „  Z7 e7 d d d d ƒ e7 d d d  d! ƒ e7 d" d# d$ d% ƒ e7 d& d' d( d) ƒ e ƒ  Z8 d e8 j9 _: e; e8 j _< d* e8 j _= d+ e8 j _> d, e8 j _? d, e8 j9 _@ d, e8 j9 _A d, e8 j9 _B d- e8 j9 _C d. e8 j9 _D e8 d/ f e6 d0 <i i eE d1 6d2 6d3 f e6 d1 <i i eE d4 6d2 6d5 f e6 d6 <e4 j5 e6 ƒ e3 e ƒ ZF eF j5 e$ ƒ d7 e f d8 „  ƒ  YZG d2 e e" f d9 „  ƒ  YZH d d: „ ZJ eH jK ZL eM d; k rmeL ƒ  n  d S(<   sl   
The :class:`~IPython.core.application.Application` object for the command
line :command:`ipython` program.
i    (   t   absolute_import(   t   print_functionN(   t   Config(   t   boolean_flagt   catch_config_errort   Application(   t   release(   t   usage(   t   IPCompleter(   t   CrashHandler(   t   PlainTextFormatter(   t   HistoryManager(   t   PromptManager(   t
   ProfileDirt   BaseIPythonApplicationt
   base_flagst   base_aliases(   t   ScriptMagics(   t   InteractiveShellAppt   shell_flagst   shell_aliases(   t   StoreMagics(   t   TerminalInteractiveShell(   t   warn(   t   get_ipython_dir(   t   Boolt   Listt   Dictså  
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 qtconsole          # start the qtconsole GUI application
ipython help qtconsole     # show the help for the qtconsole subcmd

ipython console            # start the terminal-based console application
ipython help console       # show the help for the console subcmd

ipython notebook           # start the IPython notebook
ipython help notebook      # show the help for the notebook subcmd

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`

ipython nbconvert           # convert notebooks to/from other formats
t   IPAppCrashHandlerc           B@ s    e  Z d  Z d „  Z d „  Z RS(   sD   sys.excepthook for IPython itself, leaves a detailed report on disk.c         C@ s;   t  j } t  j } d } t t |  ƒ j | | | | ƒ d  S(   Ns)   https://github.com/ipython/ipython/issues(   R   t   authort   author_emailt   superR   t   __init__(   t   selft   appt   contact_namet   contact_emailt   bug_tracker(    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyR    N   s
    		c         C@ sŸ   |  j  } t t |  ƒ j | ƒ g } | j } y[ | | d ƒ x% |  j j j d D] } | | ƒ qR W| d ƒ | |  j j j d ƒ Wn n Xd j	 | ƒ S(   s*   Return a string containing a crash report.s   History of session input:t   _ihs7   
*** Last line of input (may not be in above history):
s   
t    (
   t   section_sepR   R   t   make_reportt   appendR"   t   shellt   user_nst   _last_input_linet   join(   R!   t	   tracebackt   sec_sept   reportt   rpt_addt   line(    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyR)   V   s    		
(   t   __name__t
   __module__t   __doc__R    R)   (    (    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyR   K   s   	c          G@ s   t  j t |  Œ  ƒ S(   N(   t   frontend_flagst   updateR   (   t   args(    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyt   <lambda>o   s    s   autoedit-syntaxs(   TerminalInteractiveShell.autoedit_syntaxs1   Turn on auto editing of files with syntax errors.s2   Turn off auto editing of files with syntax errors.t   banners!   TerminalIPythonApp.display_banners'   Display a banner upon starting IPython.s-   Don't display a banner upon starting IPython.s   confirm-exits%   TerminalInteractiveShell.confirm_exitsÂ   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.s#   Don't prompt the user when exiting.s
   term-titles#   TerminalInteractiveShell.term_titles'   Enable auto setting the terminal title.s(   Disable auto setting the terminal title.s   >>> s   ... R'   t   NoColort   Plains:   Gives IPython a similar feel to the classic Python prompt.t   classict   quickt   TerminalIPythonApps*   Enable quick startup with no config files.t   force_interacts¬   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.
    t   it   LocateIPythonAppc           B@ s,   e  Z d  Z e e d d ƒ ƒ Z d „  Z RS(   s!   print the path to the IPython dirt   profiles%   IPython.core.profileapp.ProfileLocates.   print the path to an IPython profile directoryc         C@ s-   |  j  d  k	 r |  j  j ƒ  St |  j ƒ d  S(   N(   t   subappt   Nonet   startt   printt   ipython_dir(   R!   (    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyRG   µ   s    (   s%   IPython.core.profileapp.ProfileLocates.   print the path to an IPython profile directory(   R4   R5   t   descriptionR   t   dictt   subcommandsRG   (    (    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyRC   ®   s
   	 c           B@ sz  e  Z d  Z e j Z e Z e Z	 e
 e ƒ Z e
 e ƒ Z e ƒ  Z d „  Z e d d0 d d1 d d2 d d3 d d4 d d e j f d d5 d d6 d d7 d d8 ƒ 
Z d9 e d! <e e ƒ Z e e d" e d# d$ ƒZ d% „  Z e e d" e d# d& ƒZ e e d" e d# d' ƒZ d( „  Z d) „  Z e Z e Z e e ƒ Z e e ƒ Z  d: d* „ Z" e# d: d+ „ ƒ Z$ d, „  Z% d- „  Z& d. „  Z' d/ „  Z( RS(;   u   ipythonc      
   C@ s%   t  |  j t t t t t t t t	 g
 S(   sC   This has to be in a method, for TerminalIPythonApp to be available.(
   R   t	   __class__R   R   R   R   R
   R   R   R   (   R!   (    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyt   _classes_defaultÅ   s    t	   qtconsoles*   qtconsole.qtconsoleapp.JupyterQtConsoleApps)   DEPRECATD: Launch the Jupyter Qt Console.t   notebooks    notebook.notebookapp.NotebookApps4   DEPRECATED: Launch the Jupyter HTML Notebook Server.RD   s"   IPython.core.profileapp.ProfileApps#   Create and manage IPython profiles.t   kernels   ipykernel.kernelapp.IPKernelApps,   Start a kernel without an attached frontend.t   consoles)   jupyter_console.app.ZMQTerminalIPythonApps6   DEPRECATED: Launch the Jupyter terminal-based Console.t   locates'   IPython.terminal.ipapp.LocateIPythonAppt   historys"   IPython.core.historyapp.HistoryApps$   Manage the IPython history database.t	   nbconverts#   nbconvert.nbconvertapp.NbConvertApps4   DEPRECATED: Convert notebooks to/from other formats.t   trusts   nbformat.sign.TrustNotebookAppsN   DEPRECATED: Sign notebooks to trust their potentially unsafe contents at load.t
   kernelspecs*   jupyter_client.kernelspecapp.KernelSpecApps1   DEPRECATED: Manage Jupyter kernel specifications.s+   notebook.nbextensions.InstallNBExtensionApps4   DEPRECATED: Install Jupyter notebook extension filess   install-nbextensiont   configt   helps>   Start IPython quickly by skipping the loading of config files.c         C@ s   | r d „  |  _  n  d  S(   Nc          _@ s   d  S(   N(   RF   (   t   at   kw(    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyR:     s    (   t   load_config_file(   R!   t   namet   oldt   new(    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyt   _quick_changedÿ   s    s2   Whether to display a banner upon starting IPython.sš   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.c         C@ s   | r t  |  _ n  d  S(   N(   t   Truet   interact(   R!   R]   R^   R_   (    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyt   _force_interact_changed  s    c         C@ s2   | r t  |  _ n  | r. |  j r. t |  _ n  d  S(   N(   Ra   t   something_to_runRA   t   FalseRb   (   R!   R]   R^   R_   (    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyt   _file_to_run_changed  s    c         C@ sq   | d k r t j d n | } d | k r[ | } | j d ƒ } t j d ƒ d | | <n  t t |  ƒ j | ƒ S(   s<   override to allow old '-pylab' flag with deprecation warningi   s   -pylabs^   `-pylab` flag has been deprecated.
    Use `--matplotlib <backend>` and import pylab manually.s   --pylabN(   RF   t   syst   argvt   indexR   R   R@   t   parse_command_line(   R!   Rh   t   idx(    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyRj     s    c         C@ s   t  t |  ƒ j | ƒ |  j d k	 r) d S|  j rO |  j rO |  j d |  _ n  |  j ƒ  |  j	 ƒ  |  j
 ƒ  |  j ƒ  |  j ƒ  |  j ƒ  d S(   s8   Do actions after construct, but before starting the app.Ni    (   R   R@   t
   initializeRE   RF   t
   extra_argsRd   t   file_to_runt	   init_patht
   init_shellt   init_bannert   init_gui_pylabt   init_extensionst	   init_code(   R!   Rh   (    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyRl   .  s    




c         C@ sM   t  j d |  d t d |  j d |  j d |  j ƒ |  _ |  j j j |  ƒ d S(   s(   initialize the InteractiveShell instancet   parentt   display_bannert   profile_dirRI   R,   N(	   R   t   instanceRe   Rw   RI   R,   R+   t   configurablesR*   (   R!   (    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyRp   B  s    c         C@ sB   |  j  r" |  j r" |  j j ƒ  n  |  j t j k r> t ƒ  n  d S(   s   optionally display the bannerN(   Rv   Rb   R+   t   show_bannert	   log_levelt   loggingt   INFORH   (   R!   (    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyRq   M  s     c         C@ s)   | d k r% t  j  d ƒ d |  _ n  d S(   s,   Replace --pylab='inline' with --pylab='auto't   inlines>   'inline' not available as pylab backend, using 'auto' instead.t   autoN(   R   t   pylab(   R!   R]   R^   R_   (    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyt   _pylab_changedT  s    c         C@ sY   |  j  d  k	 r |  j  j ƒ  S|  j rE |  j j d ƒ |  j j ƒ  n |  j j d ƒ d  S(   Ns   Starting IPython's mainloop...s   IPython not interactive...(   RE   RF   RG   Rb   t   logt   debugR+   t   mainloop(   R!   (    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyRG   [  s    	(   s*   qtconsole.qtconsoleapp.JupyterQtConsoleApps)   DEPRECATD: Launch the Jupyter Qt Console.(   s    notebook.notebookapp.NotebookApps4   DEPRECATED: Launch the Jupyter HTML Notebook Server.(   s"   IPython.core.profileapp.ProfileApps#   Create and manage IPython profiles.(   s   ipykernel.kernelapp.IPKernelApps,   Start a kernel without an attached frontend.(   s)   jupyter_console.app.ZMQTerminalIPythonApps6   DEPRECATED: Launch the Jupyter terminal-based Console.(   s"   IPython.core.historyapp.HistoryApps$   Manage the IPython history database.(   s#   nbconvert.nbconvertapp.NbConvertApps4   DEPRECATED: Convert notebooks to/from other formats.(   s   nbformat.sign.TrustNotebookAppsN   DEPRECATED: Sign notebooks to trust their potentially unsafe contents at load.(   s*   jupyter_client.kernelspecapp.KernelSpecApps1   DEPRECATED: Manage Jupyter kernel specifications.(   s+   notebook.nbextensions.InstallNBExtensionApps4   DEPRECATED: Install Jupyter notebook extension filesN()   R4   R5   R]   R   t   cl_usageRJ   R   t   crash_handler_classt	   _examplest   examplesR   t   flagst   aliasesR   t   classesRN   RK   RC   RL   R   Ra   t   auto_createRe   R?   R`   Rv   RA   Rc   Rf   t   _code_to_run_changedt   _module_to_run_changedRb   Rd   RF   Rj   R   Rl   Rp   Rq   R   RG   (    (    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyR@   ¼   sh   			         	 
									c         C@ sg   |  d k r t ƒ  }  n  t j j |  d ƒ } t ƒ  } x* t j d d | ƒD] } | j | ƒ qL W| S(   sh   Load the default config file from the default ipython_dir.

    This is useful for embedded shells.
    t   profile_defaultt   ipython_configt   pathN(	   RF   R   t   osR‘   R.   R   R   t   _load_config_filesR8   (   RI   Rw   RX   t   cf(    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyt   load_default_confige  s    	t   __main__(N   R6   t
   __future__R    R   R|   R’   Rg   t   traitlets.config.loaderR   t   traitlets.config.applicationR   R   R   t   IPython.coreR   R   t   IPython.core.completerR   t   IPython.core.crashhandlerR	   t   IPython.core.formattersR
   t   IPython.core.historyR   t   IPython.core.promptsR   t   IPython.core.applicationR   R   R   R   t   IPython.core.magicsR   t   IPython.core.shellappR   R   R   t   IPython.extensions.storemagicR   t!   IPython.terminal.interactiveshellR   t   IPython.utilsR   t   IPython.pathsR   t	   traitletsR   R   R   R‡   R   RK   R‰   R8   R7   t   addflagt   classic_configt   InteractiveShellt
   cache_sizeRe   t   pprintt   in_templatet   in2_templatet   out_templatet   separate_int   separate_outt   separate_out2t   colorst   xmodeRa   RŠ   RC   R@   RF   R•   t   launch_instancet   launch_new_instanceR4   (    (    (    sN   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/terminal/ipapp.pyt   <module>   s„   "!							©	