
NXc           @@ s  d  Z  d d l m Z m Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l Z d d l	 Z	 d d l
 Z
 d d l Z d d l 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 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! m" Z" d d l# m$ Z$ d d l% m& Z& d d l' m( Z( m) Z) d d l* m+ Z+ m, Z, d d l- m. Z. d d l/ m0 Z0 d d l1 m2 Z2 d d l3 m4 Z4 m5 Z5 d d l6 m7 Z7 d d l8 m9 Z9 d d l: m; Z; d d l< m= Z= m> Z> m? Z? d d l@ mA ZA d d lB mC ZC d d lD mE ZE d d lF mG ZG d d lH mI ZI d d lJ mK ZK d d  lL mM ZM d d! lN mO ZO d d" lP mQ ZQ d d# lP m Z d d$ lP mR ZR d d% lP mS ZS d d& lT mU ZU d d' lV mW ZW d d( lX mY ZY d d) lZ m[ Z[ d d* l\ m] Z] m^ Z^ m_ Z_ m` Z` d d+ la mb Zb mc Zc d d, ld me Ze mf Zf mg Zg mh Zh mi Zi d d- lj mk Zk d d. ll mm Zm d d/ ln mo Zo mp Zp mq Zq mr Zr d d0 ls mt Zt mu Zu mv Zv mw Zw mx Zx my Zy mz Zz m{ Z{ m| Z| m} Z} d d1 l~ m Z m Z d d l Z e	 j d2  Z eU d3    Z eU d4    Z eU d5 e f d6     Y Z e   Z d7 e f d8     YZ eU d9 f  d:     Y Z d;   Z d< e{ f d=     YZ d> e f d?     YZ eU d@ e f dA     Y Z dB e f dC     YZ dD e f dE     YZ dF eh e j e  f dG     YZ e j e  d S(H   s   Main IPython class.i    (   t   absolute_importt   print_functionN(   t   open(   t   PickleShareDB(   t   SingletonConfigurable(   t   debuggert   oinspect(   t   magic(   t   page(   t	   prefilter(   t   shadowns(   t   ultratb(   t   Aliast   AliasManager(   t   ExitAutocall(   t   BuiltinTrap(   t   EventManagert   available_events(   t   CachingCompilert   check_linecache_ipython(   t   DisplayTrap(   t   DisplayHook(   t   DisplayPublisher(   t   InputRejectedt
   UsageError(   t   ExtensionManager(   t   DisplayFormatter(   t   HistoryManager(   t   IPythonInputSplittert	   ESC_MAGICt
   ESC_MAGIC2(   t   Logger(   t   Macro(   t   PayloadManager(   t   PrefilterManager(   t
   ProfileDir(   t   PromptManager(   t   default_banner(   t   skip_doctest(   t
   PyColorize(   t   io(   t	   py3compat(   t   openpy(   t   undoc(   t
   ask_yes_no(   t   Struct(   t   get_ipython_dir(   t   get_home_dirt   get_py_filenamet   unquote_filenamet   ensure_dir_exists(   t   systemt	   getoutput(   t   builtin_modt   unicode_typet   string_typest   with_metaclasst	   iteritems(   t   StrDispatch(   t   prepended_to_syspath(   t   format_screent   LSStringt   SListt   DollarFormatter(
   t   Integert   Boolt   CBoolt   CaselessStrEnumt   Enumt   Listt   Dictt   Unicodet   Instancet   Type(   t   warnt   errors   ^\s+raise|^\s+return|^\s+passc         C@ sR   d } y |  j  } Wn t k
 r& n Xy | |  _  Wn t t f k
 rM n X| S(   s-   Copied from code.py, to remove the dependencyi    (   t	   softspacet   AttributeErrort	   TypeError(   t   filet   newvaluet   oldvalue(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRL   ]   s    c          O@ s   d  S(   N(    (   t   at   kw(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   no_opm   s    t   NoOpContextc           B@ s   e  Z d    Z d   Z RS(   c         C@ s   d  S(   N(    (   t   self(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt	   __enter__r   s    c         C@ s   d  S(   N(    (   RV   t   typet   valuet	   traceback(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   __exit__s   s    (   t   __name__t
   __module__RW   R[   (    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRU   p   s   	t   SpaceInInputc           B@ s   e  Z RS(    (   R\   R]   (    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR^   v   s    t   Bunchc           B@ s   e  Z RS(    (   R\   R]   (    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR_   x   s   c           C@ s.   t  j d k r d St j d k r& d Sd Sd  S(   Nt   darwint   LightBGt   ntt   Linux(   t   syst   platformt   ost   name(    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   get_default_colors|   s
    t   SeparateUnicodec           B@ s   e  Z d  Z d   Z RS(   s   A Unicode subclass to validate separate_in, separate_out, etc.

    This is a Unicode based trait that converts '0'->'' and ``'\\n'->'\n'``.
    c         C@ s@   | d k r d } n  | j  d d  } t t |   j | |  S(   Nt   0t    s   \ns   
(   t   replacet   superRi   t   validate(   RV   t   objRY   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRn      s     	(   R\   R]   t   __doc__Rn   (    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRi      s   t   ReadlineNoRecordc           B@ s>   e  Z d  Z d   Z d   Z d   Z d   Z d d  Z RS(   s   Context manager to execute some code, then reload readline history
    so that interactive input to the code doesn't appear when pressing up.c         C@ s   | |  _  d |  _ d  S(   Ni    (   t   shellt   _nested_level(   RV   Rr   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   __init__   s    	c         C@ st   |  j  d k ra y" |  j   |  _ |  j   |  _ Wqa t t f k
 r] d g  |  _ |  _ qa Xn  |  j  d 7_  d  S(   Ni    i?B i   (   Rs   t   current_lengtht   orig_lengtht   get_readline_tailt   readline_tailRM   t
   IndexError(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRW      s    c         C@ s   |  j  d 8_  |  j  d k r y |  j   |  j } | d k rp x- t |  D] } |  j j j |  j  qM Wn  |  j   |  j k s |  j   |  j k r |  j j	   n  Wq t
 t f k
 r q Xn  t S(   Ni   i    (   Rs   Ru   Rv   t   rangeRr   t   readlinet   remove_history_itemRw   Rx   t   refill_readline_histRM   Ry   t   False(   RV   RX   RY   RZ   t   et   _(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR[      s    c         C@ s   |  j  j j   S(   N(   Rr   R{   t   get_current_history_length(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRu      s    i
   c         C@ s^   |  j  j j   d } t | | d  } |  j  j j } g  t | |  D] } | |  ^ qH S(   s)   Get the last n items in readline history.i   (   Rr   R{   R   t   maxt   get_history_itemRz   (   RV   t   nt   endt   startt   ghit   x(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRw      s    (   R\   R]   Rp   Rt   RW   R[   Ru   Rw   (    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRq      s   					t   DummyModc           B@ s   e  Z d  Z RS(   st   A dummy module used for IPython's interactive module when
    a namespace must be assigned to the module's __dict__.(   R\   R]   Rp   (    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR      s   t   ExecutionResultc           B@ s>   e  Z d  Z d Z d Z d Z d Z e d    Z	 d   Z
 RS(   sm   The result of a call to :meth:`InteractiveShell.run_cell`

    Stores information about what took place.
    c         C@ s   |  j  d  k o |  j d  k S(   N(   t   error_before_exect   Nonet   error_in_exec(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   success   s    c         C@ s:   |  j  d k	 r |  j   n  |  j d k	 r6 |  j  n  d S(   s>   Reraises error if `success` is `False`, otherwise does nothingN(   R   R   R   (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   raise_error   s    N(   R\   R]   Rp   R   t   execution_countR   R   t   resultt   propertyR   R   (    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR      s   t   InteractiveShellc           B@ s
  e  Z d  Z d Z e g  d e d d Z e d d d d e d d Z	 e
 e d e d d	 Z e
 e d e d d
 Z e e d e d d Z e d d e d d Z e d d e d d Z e
 e d e d d Z e d d e   d e d d Z e
 e d d Z e
 e d e Z e
 e d e d d Z e
 e d e d d Z e e d e Z e e   Z! e e"  Z# d Z$ e
 e  Z% e e&  Z' d   Z( e d  Z) e d  Z* e d d e Z+ e d d i e d 6 Z, e d d i e d 6 Z- e
 e d e d d Z. e d d e d d Z/ e d d e d d Z0 e d d d d e Z1 e
 e d e d d  Z2 e
 e3 j4 d! k d e d d" Z5 e6 e d e d d# Z7 e d$ d e d d% Z8 e d& d e d d' Z9 e d( d e d d) Z: e
 e d e d d* Z; d+   Z< e< Z= e< Z> e< Z? e< Z@ e
 e d e d d, ZA e
 e d e ZB e d- d e ZC e d d e d d. ZD e
 e d e ZE e d/ d e ZF e   ZG e d0 d1 d2 d3 d4 d5 d6 d7 d8 d9 d: d; g d e ZH e ZI d<   ZJ e d= d> d? d@ g d d? d e d dA ZK eL dB d e ZM eL d d e ZN eL d d e ZO e
 e d e ZP e d d dC d e ZQ e dF d e ZR e dG d e ZS e dH d e ZT e dI d e ZU e dJ d e ZV e dK d e ZW e dL d e ZX e dM d e ZY e dN d e ZZ e[ dO    Z\ e]   Z^ d Z_ d d d d d dP  Z` dQ   Za dR   Zb d dS  Zc dT   Zd dU   Ze dV   Zf dW   Zg dX   Zh dY   Zi dZ   Zj d[   Zk d\   Zl d]   Zm d^   Zn d_   Zo d`   Zp da   Zq db   Zr dc   Zs dd   Zt de   Zu df   Zv dg   Zw dh   Zx e[ di    Zy d dj  Zz dk   Z{ dl d d e dm  Z| dn   Z} do   Z~ dp   Z dq   Z dr   Z ds   Z dt   Z du   Z e[ e e d dv  Z e dw  Z e Z d d dx  Z e[ dy    Z d d dz  Z d{   Z d|   Z e[ d}    Z e d~  Z e d  Z d d  Z e d  Z d   Z d d  Z e d    Z d d  Z d d  Z d d  Z d d  Z d   Z d   Z d   Z d   Z d d  Z d   Z d d  Z d d d e d  Z d   Z d d  Z d   Z d   Z d   Z e e d   Z d   Z d   Z d   Z d d d  Z d d  Z d   Z d d  Z d   Z e j e j j  d d d   Z d   Z d   Z d   Z d   Z d d  Z d   Z d   Z d   Z d   Z e Z e d d  Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z d   Z e e d  Z d   Z d   Z e e e d  Z d   Z d? e d d  Z d d  Z e Z d d  Z d d  Z d e e d  Z d e   d  Z d d d  Z d   Z d   Z d d  Z d   Z e d  Z e e e e d  Z d   Z d   Z RS(   s*   An enhanced, interactive shell for Python.t   configt   helps   
        A list of ast.NodeTransformer subclass instances, which will be applied
        to user input before code is run.
        i    i   i   t   default_values  
        Make IPython automatically call any callable object even if you didn't
        type explicit parentheses. For example, 'str 43' becomes 'str(43)'
        automatically. The value can be '0' to disable the feature, '1' for
        'smart' autocall, where it is not applied if there are no more
        arguments on the line, and '2' for 'full' autocall, where all callable
        objects are automatically called (even if no arguments are present).
        s@   
        Autoindent IPython code entered interactively.
        sK   
        Enable magic commands to be called without the leading %.
        s7   The part of the banner to be printed before the profileRk   s6   The part of the banner to be printed after the profilei  s  
        Set the size of the output cache.  The default is 1000, you can
        change it permanently in your config file.  Setting it to 0 completely
        disables the caching system, and the minimum value accepted is 20 (if
        you provide a value less than 20, it is reset to 0 and a warning is
        issued).  This limit is defined because otherwise you'll spend more
        time re-flushing a too small cache than working
        s   
        Use colors for displaying information about objects. Because this
        information is passed through a pager (like 'less'), and some pagers
        get confused with color codes, this capability can be turned off.
        t   NoColorRa   Rc   s2   Set the color scheme (NoColor, Linux, or LightBG).sd   
        Force use of ANSI color codes, regardless of OS and readline
        availability.
        s  
        **Deprecated**

        Enable deep (recursive) reloading by default. IPython can use the
        deep_reload module which reloads changes in modules recursively (it
        replaces the reload() function, so you don't need to change anything to
        use it). `deep_reload` forces a full reload of modules whose code may
        have changed, which the default reload() function does not.  When
        deep_reload is off, IPython will use the normal reload(), but
        deep_reload will still be available as dreload().
        s?   Don't call post-execute functions that have failed in the past.t
   allow_nonec         C@ s
   t  |   S(   N(   R   (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   _exiter_default<  s    s   <ipython console>s/   IPython.core.inputsplitter.IPythonInputSplittert   line_input_checkers   
        Start logging to the default log file in overwrite mode.
        Use `logappend` to specify a log file to **append** logs to.
        s1   
        The name of the logfile to use.
        s   
        Start logging to the given file in append mode.
        Use `logfile` to specify a log file to **overwrite** logs to.
        sL   
        Automatically call the pdb debugger after every exception.
        t   win32s8   Save multi-line entries as one entry in readline historysh   If True, anything that would be passed to the pager
        will be displayed as regular output instead.s	   In [\#]: s)   Deprecated, use PromptManager.in_templates	      .\D.: s*   Deprecated, use PromptManager.in2_templates	   Out[\#]: s*   Deprecated, use PromptManager.out_templates%   Deprecated, use PromptManager.justifyc         C@ sr   i d d 6d d 6d d 6d d 6} t  d	 j d
 | d | |   |  j d  k	 rn t |  j j | | |  n  d  S(   Nt   in_templatet
   prompt_in1t   in2_templatet
   prompt_in2t   out_templatet
   prompt_outt   justifyt   prompts_pad_leftsB   InteractiveShell.{name} is deprecated, use PromptManager.{newname}Rg   t   newname(   RJ   t   formatR   R   t   setattrR$   (   RV   Rg   t   oldt   newt   table(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   _prompt_trait_changedx  s    
s(   Show rewritten input, e.g. for autocall.i'  so   
        The number of saved history entries to be loaded
        into the readline buffer at startup.
        s   -/~s   tab: completes   "\C-l": clear-screens   set show-all-if-ambiguous ons   "\C-o": tab-inserts   "\C-r": reverse-search-historys   "\C-s": forward-search-historys   "\C-p": history-search-backwards   "\C-n": history-search-forwards   "\e[A": history-search-backwards   "\e[B": history-search-forwards   "\C-k": kill-lines   "\C-u": unix-line-discardc         C@ s   t  |  _ d  S(   N(   t   Truet   _custom_readline_config(   RV   Rg   R   R   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt    _readline_parse_and_bind_changed  s    t   allt   lastt	   last_exprt   nones   
        'all', 'last', 'last_expr' or 'none', specifying which nodes should be
        run interactively (displaying output from expressions).s   
t   Contextt   Plaint   Verboses   IPython.core.alias.AliasManagers'   IPython.core.prefilter.PrefilterManagers%   IPython.core.builtin_trap.BuiltinTraps%   IPython.core.display_trap.DisplayTraps(   IPython.core.extensions.ExtensionManagers#   IPython.core.payload.PayloadManagers(   IPython.core.history.HistoryAccessorBases    IPython.core.magic.MagicsManagers#   IPython.core.application.ProfileDirc         C@ s;   |  j  d  k	 r7 t j j |  j  j  } | j d d  Sd  S(   Nt   profile_Rk   (   t   profile_dirR   Rf   t   patht   basenamet   locationRl   (   RV   Rg   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   profile  s    c         K@ s  t  t |   j |   |  g |  _ |  j |  |  j |  |  j   |  j   |  j   |  j	 | |  |  j
   |  j   t t j j |  j j d   |  _ |  j   |  j   |  j   |  j   |  j   |  j   |  j   |  j   |  j   |  j   |  j   |  j   t j  r/t! |  _" n	 t# |  _" |  j$   |  j%   |  j& |  |  j'   |  j(   |  j)   |  j*   |  j+   |  j,   |  j-   |  j.   |  j/   |  j0   |  j1   |  j2   |  j3 j4   |  j5 j6 d |   t7 j8 |  j9  d  S(   Nt   dbt   shell_initialized(:   Rm   R   Rt   t   configurablest   init_ipython_dirt   init_profile_dirt   init_instance_attrst   init_environmentt   init_virtualenvt   init_create_namespacest   save_sys_module_statet   init_sys_modulesR   Rf   R   t   joinR   R   R   t   init_historyt   init_encodingt   init_prefiltert   init_syntax_highlightingt
   init_hookst   init_eventst   init_pushd_popd_magict   init_user_nst   init_loggert   init_builtinst   init_inspectort   init_readlineR)   t   PY3t   inputt   raw_input_originalt	   raw_inputt   init_completert   init_iot   init_traceback_handlerst   init_promptst   init_display_formattert   init_display_pubt   init_data_pubt   init_displayhookt   init_magicst
   init_aliast   init_logstartt   init_pdbt   init_extension_managert   init_payloadt   init_deprecation_warningst   hookst   late_startup_hookt   eventst   triggert   atexitt   registert   atexit_operations(   RV   t   ipython_dirR   t   user_modulet   user_nst   custom_exceptionst   kwargs(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRt     sX    




$











		













c         C@ s   |  S(   s.   Return the currently running IPython instance.(    (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   get_ipython5  s    c         C@ s   t  |  d  S(   N(   R2   (   RV   Rg   R   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   _ipython_dir_changed=  s    c         C@ sh   | d k r? |  j  r? t j d k r2 t d  n  d |  _ d S| d k r[ |  j |  _ n	 | |  _ d S(   sr   Set the autoindent flag, checking for readline support.

        If called with no arguments, it acts as a toggle.i    t   posixs5   The auto-indent feature requires the readline libraryN(   t   has_readlineRf   Rg   RJ   t
   autoindentR   (   RV   RY   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   set_autoindent@  s    	c         C@ s)   | d  k	 r | |  _ d  St   |  _ d  S(   N(   R   R   R.   (   RV   R   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR   S  s    	c         C@ s5   | d  k	 r | |  _ d  St j |  j d  |  _ d  S(   Nt   default(   R   R   R#   t   create_profile_dir_by_nameR   (   RV   R   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR   Z  s    	c         C@ sa   t  |  _ t   |  _ t   |  _ g  |  _ g  |  _ t  |  _ t	 j
   |  _ d |  _ i  |  _ d  S(   Ni    (   R~   t   moreR   t   compileR-   t   metat	   tempfilest   tempdirsR   R)   t   getcwdt   starting_dirt   indent_current_nspt   _post_execute(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR   a  s    					c         C@ s   d S(   s6   Any changes we need to make to the user's environment.N(    (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    c         C@ s:   y t  j j p d |  _ Wn t k
 r5 d |  _ n Xd  S(   Nt   ascii(   Rd   t   stdint   encodingt   stdin_encodingRM   (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    c         @ s(   t  j   j     f d     _ d  S(   Nc         @ s    |  d   j   S(   Nt   str(   t   colors(   t   src(   RV   t   pyformat(    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   <lambda>  s    (   R'   t   ParserR   t
   pycolorize(   RV   (    (   RV   R
  sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    c         C@ s   t    |  _ g  |  _ d  S(   N(   R/   t   home_dirt	   dir_stack(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    c         C@ s"   t  |  j d d d d |  _ d  S(   Nt   logfnames   ipython_log.pyt   logmodet   rotate(   R   R  t   logger(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    c         C@ s]   |  j  r  |  j d |  j   n9 |  j r@ |  j d |  j  n |  j rY |  j d  n  d S(   sI   Initialize logging in case it was requested at the command line.
        s   logstart %s appends   logstart %st   logstartN(   t	   logappendR   t   logfileR  (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    			c         C@ s)   t  j d d t d |  j j d  d S(   s   
        register default filter for deprecation warning.

        This will allow deprecation warning of function used interactively to show
        warning to users, and still hide deprecation warning from libraries import.
        R   t   categoryt   moduleR\   N(   t   warningst   filterwarningst   DeprecationWarningR   t   get(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    c         C@ s0   t  t j d <d t j d <t d |   |  _ d  S(   Nt   __IPYTHON__s!   Deprecated, check for __IPYTHON__t   __IPYTHON__activeRr   (   R   R5   t   __dict__R   t   builtin_trap(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    c         C@ s(   t  j t  j t j d |  j  |  _ d  S(   NR   (   R   t	   Inspectort   InspectColorsR'   t   ANSICodeColorst   object_info_string_levelt	   inspector(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    c         C@ sw   t  j d k s t  j d k rI |  j rI t j |  j j  t _ t _ n* t j t  j  t _ t j t  j  t _ d  S(   NR   t   cli(	   Rd   Re   R   R(   t   IOStreamR{   t   _outputfilet   stdoutt   stderr(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    '"c         C@ sJ   t  d |  d |   |  _ |  j j |  j  d t _ d t _ d t _ d  S(   NRr   t   parents   In : s   ...: s   Out: (   R$   t   prompt_managerR   t   appendRd   t   ps1t   ps2t   ps3(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s
    		c         C@ s)   t  d |   |  _ |  j j |  j  d  S(   NR+  (   R   t   display_formatterR   R-  (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    c         C@ s,   |  j  d |   |  _ |  j j |  j  d  S(   NR+  (   t   display_pub_classt   display_pubR   R-  (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    c         C@ sB   |  j  s d  |  _ d  S|  j  d |   |  _ |  j j |  j  d  S(   NR+  (   t   data_pub_classR   t   data_pubR   R-  (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s
    		c         C@ sP   |  j  d |  d |  d |  j  |  _ |  j j |  j  t d |  j  |  _ d  S(   NR+  Rr   t
   cache_sizet   hook(   t   displayhook_classR6  t   displayhookR   R-  R   t   display_trap(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    	c         @ s^  d t  j k r d St  j j t j  } | g } xY t  j j |  r t  j j t  j j t  j j |  t  j	 |    } | j
 |  q4 Wt  j j t  j d    t   f d   | D  r d St d  t j d k rt  j j t  j d d d  } n- t  j j t  j d d d	 t j d
  d  } d d l } t j j d |  | j |  d S(   s  Add a virtualenv to sys.path so the user can import modules from it.
        This isn't perfect: it doesn't use the Python interpreter with which the
        virtualenv was built, and it ignores the --no-site-packages option. A
        warning will appear suggesting the user installs IPython in the
        virtualenv, but for many cases, it probably works well enough.
        
        Adapted from code snippets online.
        
        http://blog.ufsoft.org/2009/1/29/ipython-and-virtualenv
        t   VIRTUAL_ENVNc         3@ s   |  ] } | j     Vq d  S(   N(   t
   startswith(   t   .0t   p(   t   p_venv(    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pys	   <genexpr>  s    sl   Attempting to work in a virtualenv. If you encounter problems, please install IPython inside the virtualenv.R   t   Libs   site-packagest   libs   python%d.%di   i    (   Rf   t   environR   t   normcaseRd   t
   executablet   islinkR   t   dirnamet   readlinkR-  t   anyRJ   Re   t   version_infot   sitet   insertt
   addsitedir(   RV   R>  t   pathst   virtual_envRJ  (    (   R?  sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s$    	6
"c         C@ sw   i  |  _  t j |  j  d <t j |  j  d <t j |  j  d <t j |  j  d <|  j j |  _ t j	 j
 |  j j  |  _ d S(   su   Save the state of hooks in the sys module.

        This has to be called after self.user_module is created.
        R  R)  R*  t
   excepthookN(   t   _orig_sys_module_stateRd   R  R)  R*  RO  R   R\   t   _orig_sys_modules_main_namet   modulesR  t   _orig_sys_modules_main_mod(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR   "  s    	c         C@ sq   y4 x- t  |  j  D] \ } } t t | |  q WWn t k
 rG n X|  j d k	 rm |  j t j |  j <n  d S(   s$   Restore the state of the sys module.N(	   R9   RP  R   Rd   RM   RS  R   RR  RQ  (   RV   t   kt   v(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   restore_sys_module_state/  s    c         C@ sV   |  j  } |  j r5 |  j d k r5 | d |  j 7} n  |  j rR | d |  j 7} n  | S(   NR   s   
IPython profile: %s
s   
(   t   banner1R   t   banner2(   RV   t   banner(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRY  >  s    		c         C@ s)   | d  k r |  j } n  |  j |  d  S(   N(   R   RY  t   write(   RV   RY  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   show_bannerG  s    c         C@ s   t    |  _ i  |  _ t j j } x3 | j D]( } |  j | t | |  d d t q+ W|  j	 r |  j d t
 j t
 j	  d  n  d  S(   Nid   t   _warn_deprecatedt   show_in_pageriZ   (   R-   R   t   strdispatcherst   IPythont   coret   __all__t   set_hookt   getattrR~   t   display_pageR   t   as_hook(   RV   R   t	   hook_name(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR   P  s    	&	i2   c         C@ s  t  j | |   } | d k	 rZ |  j j | t    } | j | | |  | |  j | <d S| d k	 r |  j j | t    } | j t j	 |  | |  | |  j | <d St
 |  j | d  }	 | t j j j k r t d | t j j j f  n  | r<| t j j j k r<t j j j | }
 t d j | |
   n  |	 sWt j j j   }	 n  y |	 j | |  Wn t k
 r| }	 n Xt |  j | |	  d S(   s	  set_hook(name,hook) -> sets an internal IPython hook.

        IPython exposes some of its internal API as user-modifiable hooks.  By
        adding your function to one of these hooks, you can modify IPython's
        behavior to call at runtime your own routines.Ns#   Warning! Hook '%s' is not one of %ss&   Hook {} is deprecated. Use {} instead.(   t   typest
   MethodTypeR   R^  R  R:   t   add_st   add_ret   reR   Rc  R   R_  R`  Ra  t   printt
   deprecatedRJ   R   t   CommandChainDispatchert   addRM   R   (   RV   Rg   R7  t   priorityt   str_keyt   re_keyR\  t   ft   sdpt   dpt   alternative(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRb  `  s2    
c         C@ s,   t  |  t  |  _ |  j j d |  j  d  S(   Nt   pre_execute(   R   R   R   R   t   _clear_warning_registry(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    c         C@ s!   t  d  |  j j d |  d S(   s   DEPRECATED: Use ip.events.register('post_run_cell', func)
        
        Register a function for calling after code execution.
        s^   ip.register_post_execute is deprecated, use ip.events.register('post_run_cell', func) instead.t   post_run_cellN(   RJ   R   R   (   RV   t   func(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   register_post_execute  s    
c         C@ s    d |  j  k r |  j  d =n  d  S(   Nt   __warningregistry__(   t   user_global_ns(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRx    s    c         C@ s   t  j j |  } y |  j | } Wn: t k
 r_ t j t j |  d d } |  j | <n X| j	 j
   | | _ | | _ d   | _ | S(   s  Return a new 'main' module object for user code execution.
        
        ``filename`` should be the path of the script which will be run in the
        module. Requests with the same filename will get the same module, with
        its namespace cleared.
        
        ``modname`` should be the module name - normally either '__main__' or
        the basename of the file without the extension.
        
        When scripts are executed via %run, we must keep a reference to their
        __main__ module around so that Python doesn't
        clear it, rendering references to module globals useless.

        This method keeps said reference in a private dict, keyed by the
        absolute path of the script. This way, for multiple executions of the
        same script we only keep one copy of the namespace (the last one),
        thus preventing memory leaks from old references while allowing the
        objects from the last execution to be accessible.
        t   docs(   Module created for script run in IPythonc           S@ s   t  S(   N(   R   (    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR    s    (   Rf   R   t   abspatht   _main_mod_cachet   KeyErrorRg  t
   ModuleTypeR)   t   cast_bytes_py2R  t   clearR\   t   __file__t   __nonzero__(   RV   t   filenamet   modnamet   main_mod(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   new_main_mod  s    		c         C@ s   |  j  j   d S(   s  Clear the cache of main modules.

        Mainly for use by utilities like %reset.

        Examples
        --------

        In [15]: import IPython

        In [16]: m = _ip.new_main_mod(IPython.__file__, 'IPython')

        In [17]: len(_ip._main_mod_cache) > 0
        Out[17]: True

        In [18]: _ip.clear_main_mod_cache()

        In [19]: len(_ip._main_mod_cache) == 0
        Out[19]: True
        N(   R  R  (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   clear_main_mod_cache  s    c         C@ s   |  j  |  _ d  S(   N(   t   pdbt   call_pdb(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    c         C@ s   |  j  S(   N(   t	   _call_pdb(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   _get_call_pdb  s    c         C@ s@   | d d t  t f k r' t d   n  | |  _ | |  j _ d  S(   Ni    i   s"   new call_pdb value must be boolean(   R~   R   t
   ValueErrorR  t   InteractiveTBR  (   RV   t   val(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   _set_call_pdb  s    	s,   Control auto-activation of pdb at exceptionsc         @ sv   | p   j  s d St t d  s0 t d  d St j rL d d l m } n   f d   }   j  |   Wd QXd S(   s?  Call the pydb/pdb debugger.

        Keywords:

          - force(False): by default, this routine checks the instance call_pdb
            flag and does not actually invoke the debugger if the flag is false.
            The 'force' option forces the debugger to activate even if the flag
            is false.
        Nt   last_tracebacks1   No traceback has been produced, nothing to debug.i    (   t   pmc           @ s     j  j d t  S(   Nt   force(   R  R   R   (    (   RV   (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR    s    (	   R  t   hasattrRd   RK   R   t   has_pydbt   pydbR  t   readline_no_record(   RV   R  R  (    (   RV   sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    
	
c         C@ s   | d  k	 s | d  k	 r$ t |  _ n  |  j | |  \ |  _ |  _ i  |  _ i  |  _ i |  j j d 6|  j d 6t	 j d 6|  _
 d  S(   Nt   user_globalt
   user_localt   builtin(   R   R~   t   default_user_namespacest   prepare_user_moduleR   R   t   user_ns_hiddenR  R  R5   t   ns_table(   RV   R   R   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR   "  s    %		
c         C@ s
   |  j  j S(   N(   R   R  (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR}  p  s    c         C@ s   | d k r= | d k	 r= | j d d  t   } | | _ n  | d k ra t j d d d } n  | j j d t  | j j d t  | d k r | j } n  | | f S(   s  Prepare the module and namespace in which user code will be run.
        
        When IPython is started normally, both parameters are None: a new module
        is created automatically, and its __dict__ used as the namespace.
        
        If only user_module is provided, its __dict__ is used as the namespace.
        If only user_ns is provided, a dummy module is created, and user_ns
        becomes the global namespace. If both are provided (as they may be
        when embedding), user_ns is the local namespace, and user_module
        provides the global namespace.

        Parameters
        ----------
        user_module : module, optional
            The current user module in which IPython is being run. If None,
            a clean module will be created.
        user_ns : dict, optional
            A namespace in which to run interactive commands.

        Returns
        -------
        A tuple of user_module and user_ns, each properly initialised.
        R\   t   __main__R~  s@   Automatically created module for IPython interactive environmentt   __builtin__t   __builtins__N(   R   t
   setdefaultR   R  Rg  R  R5   (   RV   R   R   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR  t  s    	c         C@ s    |  j  j } |  j  t j | <d  S(   N(   R   R\   Rd   RR  (   RV   t	   main_name(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    c         C@ s   t    } |  j j | d <|  j j | d <|  j j | d <t | d <|  j j | d <|  j j | d <|  j | d <|  j | d <|  j | d	 <|  j j	 |  |  j
 j	 |  d
 S(   s  Initialize all user-visible namespaces to their minimum defaults.

        Certain history lists are also initialized here, as they effectively
        act as user namespaces.

        Notes
        -----
        All data structures here are only filled in, they are NOT reset by this
        method.  If they were not empty before, data will simply be added to
        therm.
        t   _iht   _oht   _dht   _sht   Int   OutR   t   exitt   quitN(   t   dictt   history_managert   input_hist_parsedt   output_histt   dir_histR
   R   t   exiterR  t   updateR   (   RV   t   ns(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    	
c         C@ s9   |  j  |  j |  j g g  |  j j   D] } | j ^ q% S(   s   Get a list of references to all the namespace dictionaries in which
        IPython might store a user-created object.
        
        Note that this does not include the displayhook, which also caches
        objects from the output.(   R   R}  R  R  t   valuesR  (   RV   t   m(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   all_ns_refs  s    c         C@ s   |  j  j |  | r" d |  _ n  |  j j r> |  j j   n  |  j |  j k	 r` |  j j   n  |  j } t	 | j
    } | j d  | j d  | j d  x | D] } | | =q W|  j j   |  j   |  j j   |  j j   |  j   d S(   s   Clear all internal namespaces, and attempt to release references to
        user objects.

        If new_session is True, a new history session will be opened.
        i   R  R  R\   N(   R  t   resetR   R9  t   do_full_cachet   flushR   R}  R  t   sett   keyst   discardR  R   t   alias_managert   clear_aliasest   init_aliasesR  (   RV   t   new_sessionR  t	   drop_keysRT  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR    s&    	
c   
      C@ sF  | d	 k r t  d |   n  |  j } | ra x| D]% } y | | =Wq5 t k
 rY q5 Xq5 Wn y |  j | } Wn! t k
 r t d |   n X| j |  j j  xW | D]O } g  t |  D] \ } } | | k r | ^ q } x | D] }	 | |	 =q Wq Wx< d
 D]4 }	 t	 |  j
 |	  | k r
t |  j
 |	 d  q
q
Wd S(   s  Delete a variable from the various namespaces, so that, as
        far as possible, we're not keeping any hidden references to it.

        Parameters
        ----------
        varname : str
            The name of the variable to delete.
        by_name : bool
            If True, delete variables with the given name in each
            namespace. If False (default), find the variable in the user
            namespace, and delete references to it.
        R  R  s   Refusing to delete %ss   name '%s' is not definedR   t   __t   ___N(   s   __builtin__s   __builtins__(   R   s   __R  (   R  R  R  R   t	   NameErrorR-  R  R  R9   Rc  R9  R   R   (
   RV   t   varnamet   by_namet   ns_refsR  Ro   R   t   ot	   to_deleteRg   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   del_var$  s*    	1c         C@ s   | d k	 r y t j |  } Wn t k
 r> t d   n Xx> |  j D]0 } x' | D] } | j |  rV | | =qV qV WqI Wn  d S(   sD  Clear selective variables from internal namespaces based on a
        specified regular expression.

        Parameters
        ----------
        regex : string or compiled pattern, optional
            A regular expression pattern that will be used in searching
            variable names in the users namespaces.
        s*   regex must be a string or compiled patternN(   R   Rk  R   RN   R  t   search(   RV   t   regexR  R  t   var(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   reset_selectiveM  s    
c         C@ s(  d } t | t  r | } n t | t t t f  r t | t  rU | j   } n | } i  } t j d  } xa | D]J } y  t	 | | j
 | j  | | <Wqw t d | | j j f  qw Xqw Wn t d   |  j j |  |  j } | rx. | D] } | j | d  q Wn | j |  d S(   s  Inject a group of variables into the IPython user namespace.

        Parameters
        ----------
        variables : dict, str or list/tuple of str
            The variables to inject into the user's namespace.  If a dict, a
            simple update is done.  If a str, the string is assumed to have
            variable names separated by spaces.  A list/tuple of str can also
            be used to give the variable names.  If just the variable names are
            give (list/tuple/str) then the variable values looked up in the
            callers frame.
        interactive : bool
            If True (default), the variables will be listed with the ``who``
            magic.
        i   s!   Could not get variable %s from %ss'   variables must be a dict/str/list/tupleN(   R   t
   isinstanceR  R7   t   listt   tuplet   splitRd   t	   _getframet   evalt	   f_globalst   f_localsRl  t   f_codet   co_nameR  R   R  R  t   pop(   RV   t	   variablest   interactivet   vdictt   vlistt   cfRg   R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   pushc  s,    	 	c         C@ sc   x\ t  |  D]N \ } } | |  j k r |  j | | k r |  j | =|  j j | d  q q Wd S(   s  Remove a dict of variables from the user namespace, if they are the
        same as the values in the dictionary.
        
        This is intended for use by extensions: variables that they've added can
        be taken back out if they are unloaded, without removing any that the
        user has overwritten.
        
        Parameters
        ----------
        variables : dict
          A dictionary mapping object names (as strings) to the objects.
        N(   R9   R   R  R  R   (   RV   R  Rg   Ro   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt
   drop_by_id  s    "
c         C@ s  | j    } | j t  rO | j t  rO t j | d t rO t d t  Sd } | d k r d |  j
 f d |  j f d t j f g } n  t } d } d } d } t } t }	 d }
 | d k rt j r|  j j t j @ri | d 6| d 6| d 6| d	 6|	 d
 6|
 d 6S| j d  } | d | d } } x | D] \ } } y | | } Wn t k
 rkq;q;Xxv t |  D][ \ } } yD | }
 | t |  d k r|  j | |  } n t | |  } WqyPqyXqyWt } | } Pq;W| sd } | j t  r%| j t  } |  j |  } n] | j t  rU| j t  } |  j |  } n- |  j |  } | d k r|  j |  } n  | d k	 rt } d } t } t | t  }	 qn  | r| d k rt |  } t } d } n  i | d 6| d 6| d 6| d	 6|	 d
 6|
 d 6S(   s   Find an object in the available namespaces.

        self._ofind(oname) -> dict with keys: found,obj,ospace,ismagic

        Has special code to detect magic functions.
        t   dottedt   foundt   Interactives   Interactive (global)s   Python builtinRl  Ro   t	   namespacet   ismagict   isaliasR+  t   .i    i   s   IPython internals   ''s   ""s   []s   {}s   ()N(   s   ''s   ""s   []s   {}s   ()(   t   stripR<  R   R   R)   t   isidentifierR   R  R~   R   R   R}  R5   R  R   R   t   compiler_flagst
   __future__t   CO_FUTURE_PRINT_FUNCTIONR  R  t	   enumeratet   lent   _getattr_propertyRc  t   lstript   find_cell_magict   find_line_magicR  R   R  (   RV   t   onamet
   namespacest   alias_nsR  Ro   t   ospacet   dsR  R  R+  t   oname_partst
   oname_headt
   oname_restt   nsnameR  t   idxt   part(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   _ofind  sz         		c         C@ s_   t  |  t  sR y t t |   |  } Wn t k
 r; qR Xt  | t  rR | Sn  t |  |  S(   s   Property-aware getattr to use in object finding.

        If attrname represents a property, return it unevaluated (in case it has
        side effects or raises an error.

        (   R  RX   Rc  RM   R   (   Ro   t   attrnamet   attr(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR    s    c         C@ s   t  |  j | |   S(   s6   Find an object and return a struct with info about it.(   R-   R  (   RV   R  R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   _object_find2  s    c         K@ s   |  j  | |  } | j r t |  j |  } | j r< t n d } | d k rd | | j | |  q | d k r | | j | | | |  q | | j |  n t d |  d Sd S(   sp   Generic interface to the inspector system.

        This function is meant to be called by pdef, pdoc & friends.t   pdoct   pinfos   Object `%s` not found.s	   not foundN(	   R  R  Rc  R%  R  R<   R   Ro   Rl  (   RV   t   methR  R  RS   t   infot   pmethodt	   formatter(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   _inspect6  s    	c         C@ sd   |  j  U |  j |  } | j rD |  j j | j | d | d | St j d | d t  SWd QXd S(   s   Get object info about onameR  t   detail_levelRg   R  N(	   R   R  R  R%  R  Ro   R   t   object_infoR~   (   RV   R  R  R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   object_inspectH  s    
	c         C@ sZ   |  j  K |  j |  } | j rD |  j j | j | d | d | St |   Wd QXd S(   s!   Get object info as formatted textR  R  N(   R   R  R  R%  t   _format_infoRo   R  (   RV   R  R  R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   object_inspect_textS  s    
	c         C@ s/   t  d |  d |   |  _ |  j j |  j  d S(   s:   Sets up the command history, and starts regular autosaves.Rr   R+  N(   R   R  R   R-  (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR   b  s    c      	   C@ so   t  j d d  |  _ t  j d d d d d d d t  |  _ t j |  _ |  j |   |  j j	 d |  j
  d  S(   Nt   color_schemeR   t   modeR   t	   tb_offseti   t   check_cache(   R   t   SyntaxTBt   AutoFormattedTBR   R  Rd   RO  t   sys_excepthookt   set_custom_exct   set_modet   xmode(   RV   R   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR   k  s    c         @ s   t  |  t  d  k s$ t d   d d  } d      d k rN | } n d    f d  } t j | |   |  _ | |  _ d S(   s  set_custom_exc(exc_tuple,handler)

        Set a custom exception handler, which will be called if any of the
        exceptions in exc_tuple occur in the mainloop (specifically, in the
        run_code() method).

        Parameters
        ----------

        exc_tuple : tuple of exception classes
            A *tuple* of exception classes, for which to call the defined
            handler.  It is very important that you use a tuple, and NOT A
            LIST here, because of the way Python's except statement works.  If
            you only want to trap a single exception, use a singleton tuple::

                exc_tuple == (MyCustomException,)

        handler : callable
            handler must have the following signature::

                def my_handler(self, etype, value, tb, tb_offset=None):
                    ...
                    return structured_traceback

            Your handler must return a structured traceback (a list of strings),
            or None.

            This will be made into an instance method (via types.MethodType)
            of IPython itself, and it will be called if any of the exceptions
            listed in the exc_tuple are caught. If the handler is None, an
            internal basic one is used, which just prints basic info.

            To protect IPython from crashes, if your handler ever raises an
            exception or returns an invalid result, it will be immediately
            disabled.

        WARNING: by putting in your own exception handler into IPython's main
        execution loop, you run a very good chance of nasty crashes.  This
        facility should only be used if you really know what you are doing.s/   The custom exceptions must be given AS A TUPLE.c         S@ s5   t  d  t  d |  t  d |  t  d |  d  S(   Ns'   *** Simple custom exception handler ***s   Exception type :s   Exception value:s   Traceback      :(   Rl  (   RV   t   etypeRY   t   tbR  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   dummy_handler  s    
c         S@ s   d |  } |  d k r g  St |  t  r0 |  g St |  t  sN t |   n  x, |  D]$ } t | t  sU t |   qU qU W|  S(   sW  validate structured traceback return type
            
            return type of CustomTB *should* be a list of strings, but allow
            single strings or None, which are harmless.
            
            This function will *always* return a list of strings,
            and will raise a TypeError if stb is inappropriate.
            s,   CustomTB must return list of strings, not %rN(   R   R  R7   R  RN   (   t   stbt   msgt   line(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   validate_stb  s    	
c         @ s   y)   |  | | | d | }  |  SWn |  j  d d  t d d t j |  j j t j     } t |  j j	 |  d t j
 t d d t j
 |  j j | | | f d | } n X| S(   s   wrap CustomTB handler, to protect IPython from user code
                
                This makes it harder (but not impossible) for custom exception
                handlers to crash IPython.
                R  s'   Custom TB Handler failed, unregisteringRO   s   The original exception:(    N(   R  R   Rl  R(   R*  R  t   structured_tracebackRd   t   exc_infot   stb2textR)  (   RV   R  RY   R  R  R  (   t   handlerR!  (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   wrapped  s    	N(    (   RX   t   AssertionErrorR   Rg  Rh  t   CustomTBR   (   RV   t	   exc_tupleR%  R  R&  (    (   R%  R!  sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR    s    )			c         C@ s    |  j  | | | f d d d S(   s2  One more defense for GUI apps that call sys.excepthook.

      GUI frameworks like wxPython trap exceptions and call
      sys.excepthook themselves.  I guess this is a feature that
      enables them to keep running after exceptions that would
      otherwise kill their mainloop. This is a bother for IPython
      which excepts to catch all of the program exceptions with a try:
      except: statement.

      Normally, IPython sets sys.excepthook to a CrashHandler instance, so if
      any app directly invokes sys.excepthook, it will look to the user like
      IPython crashed.  In order to work around this, we can disable the
      CrashHandler and replace it with this excepthook instead, which prints a
      regular traceback using our InteractiveTB.  In this fashion, apps which
      call sys.excepthook will generate a regular-looking exception from
      IPython, and the CrashHandler will only be triggered by real IPython
      crashes.

      This hook should be used sparingly, only in places which are not likely
      to be true IPython errors.
      R  i    N(   t   showtraceback(   RV   R  RY   R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRO    s    c         C@ s   | d k r$ t j   \ } } } n | \ } } } | d k rq t t d  rq t j t j t j } } } qq n  | d k r t d   n  | t _ | t _ | t _ | | | f S(   s  get exc_info from a given tuple, sys.exc_info() or sys.last_type etc.
        
        Ensures sys.last_type,value,traceback hold the exc_info we found,
        from whichever source.
        
        raises ValueError if none of these contain any information
        t	   last_types   No exception to findN(   R   Rd   R#  R  R+  t
   last_valueR  R  (   RV   R)  R  RY   R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   _get_exc_info   s    			c         C@ s   |  j  d |  d S(   s|   Show a short message for UsageErrors
        
        These are special exceptions that shouldn't show a traceback.
        s   UsageError: %sN(   t	   write_err(   RV   t   exc(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   show_usage_error   s    c         C@ s7   |  j  |  \ } } } t j | |  } d j |  S(   s}   
        Return as a string (ending with a newline) the exception that
        just occurred, without any traceback.
        Rk   (   R-  RZ   t   format_exception_onlyR   (   RV   R)  R  RY   R  R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   get_exception_only'  s    c   	      C@ sb  y3y |  j  |  \ } } } Wn t k
 r@ |  j d  d SXt | t  r` |  j |  n | t k r| |  j |  n | r d g } | j |  j	 j
 | |   nu y | j   } Wn/ t k
 r |  j	 j | | | d | } n X|  j | | |  |  j r|  j d t  n  d S|  j | | |  Wn( t k
 r]|  j d |  j
    n Xd S(   s  Display the exception that just occurred.

        If nothing is known about the exception, this is the method which
        should be used throughout the code for presenting user tracebacks,
        rather than directly invoking the InteractiveTB object.

        A specific showsyntaxerror() also exists, but this method can take
        care of calling it if needed, so unless you are explicitly catching a
        SyntaxError exception, don't try to analyze the stack manually and
        simply call this method.s    No traceback available to show.
Ns>   An exception has occurred, use %tb to see the full traceback.
R  R  s   
(   R-  R  R.  t
   issubclasst   SyntaxErrort   showsyntaxerrorR   R0  t   extendR  R2  t   _render_traceback_t	   ExceptionR"  t   _showtracebackR  R   R   t   KeyboardInterrupt(	   RV   R)  R  R  t   exception_onlyR  RY   R  R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR*  0  s4    		c         C@ s#   t  |  j j |  d t j d S(   s   Actually show a traceback.

        Subclasses may override this method to put the traceback on a different
        place, like a side channel.
        RO   N(   Rl  R  R$  R(   R)  (   RV   R  t   evalueR  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR9  f  s    c         C@ ss   |  j    \ } } } | rD t | t  rD y | | _ WqD qD Xn  |  j j | | g   } |  j | | |  d S(   s8  Display the syntax error that just occurred.

        This doesn't display a stack trace because there isn't one.

        If a filename is given, it is stuffed in the exception instead
        of what was there before (because Python's parser always uses
        "<string>" when reading from a string).
        N(   R-  R3  R4  R  R  R"  R9  (   RV   R  R  RY   R  R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR5  n  s    	c         C@ s   |  j    d S(   s   Called by run_cell when there's an IndentationError in code entered
        at the prompt.

        This is overridden in TerminalInteractiveShell to show a message about
        the %paste magic.N(   R5  (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   showindentationerror  s    c         C@ s|  |  j  r d d l j j } n  d |  _ t |  _ |  j  sD | j r t |  _	 d |  _
 t |  _ t |  _ t |  _ |  j  rht d  qhnt |  _	 | |  _
 | t j d <t j d k r | j |  _ n | j |  _ |  j r| j rx! |  j D] } | j |  q Wn  t j j d  } | d k r\d } | j rAd } n  t j j  |  j! |  } n  t j j" |  ry | j# |  Wqt d	 |  qXn  |  j rx! |  j D] } | j |  qWn  | j$   } t% j& s| j' d
 d  } n  x# |  j( D] } | j) | d  } qW| j) t* d  } | j+ |  | |  _, | j- |  j.  |  j/   t0 |   |  _ |  j1 |  j2  d S(   s,   Command history completion/saving/reloading.i    Ns.   Readline services not available or not loaded.R{   Rb   t   INPUTRCs   .inputrcs   .editrcs2   Problems reading readline initialization file <%s>R  t   ignoreRk   (3   t   readline_uset   IPython.utils.rlineimplt   utilst	   rlineimplR   t   rl_next_inputR~   t   rl_do_indentt   have_readlineR   R{   t   no_op_contextR  RT   t   set_readline_completert   set_custom_completerRJ   R   Rd   RR  Rf   Rg   t   set_pre_input_hookt   readline_startup_hookt   set_startup_hookR   t   uses_libeditt   readline_parse_and_bindt   parse_and_bindRB  R  R   R   R  t   isfilet   read_init_filet   get_completer_delimsR)   R   t   encodet   readline_remove_delimsRl   R   t   set_completer_delimst   readline_delimst   set_history_lengtht   history_lengthR}   Rq   R   R   (   RV   R{   t	   rlcommandt   inputrc_namet   delimst   d(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s`    																	
c         C@ s   |  j  j   t j j p d } d } x |  j j |  j d t D] \ } } } | j	   } | rA | | k rA ye |  j
 r |  j  j t j | |   n3 x0 | j   D]" } |  j  j t j | |   q W| } Wq t k
 r qA q XqA qA Wd  S(   Ns   utf-8u    t   include_latest(   R{   t   clear_historyRd   R  R  R  t   get_tailt   history_load_lengthR   t   rstript   multiline_historyt   add_historyR)   t   unicode_to_strt
   splitlinesRN   (   RV   R  t	   last_cellR   t   cellR   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR}     s"    	
c         C@ s   t  j |  |  _ d S(   s    Sets the 'default' input string for the next command line.

        Requires readline.

        Example::

            In [1]: _ip.set_next_input("Hello Word")
            In [2]: Hello Word_  # cursor is here
        N(   R)   R  RD  (   RV   t   sRl   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   set_next_input  s    c         C@ sT   |  j  r" |  j j |  j    n  |  j d k	 rP |  j j |  j  d |  _ n  d S(   sc   readline hook to be used at the start of each line.

        Currently it handles auto-indent only.N(   RE  R{   t   insert_textt   _indent_current_strRD  R   (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   pre_readline  s
    	c         C@ s   |  j  j d S(   s3   return the current level of indentation as a stringt    (   t   input_splittert   indent_spaces(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRk    s    c         C@ s1  d d l  m } d d l m } m } m } m } | d |  d |  j d |  j d |  j	 d |   |  _
 |  j j |  j
  |  j j d	 t    } | |  j d	 <| |  j
 _ |  j d	 | d
 d |  j d	 | d
 d |  j d	 | d
 d |  j d	 | d
 d |  j d	 | d
 d |  j	 r-|  j   n  d S(   sL  Initialize the completion machinery.

        This creates completion machinery that can be used by client code,
        either interactively in-process (typically triggered by the readline
        library), programatically (such as in test suites) or out-of-prcess
        (typically over the network by remote frontends).
        i    (   t   IPCompleter(   t   module_completert   magic_run_completert   cd_completert   reset_completerRr   R  t   global_namespacet   use_readlineR+  t   complete_commandRq  t   importt   froms   %runs   %cds   %resetN(   t   IPython.core.completerRp  t   IPython.core.completerlibRq  Rr  Rs  Rt  R   R}  R   t	   CompleterR   R-  R^  R  R:   t   custom_completersRb  RH  (   RV   Rp  Rq  Rr  Rs  Rt  t   sdisp(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s$    "				c         C@ s*   |  j   |  j j | | |  SWd QXd S(   s  Return the completed text and a list of completions.

        Parameters
        ----------

           text : string
             A string of text to be completed on.  It can be given as empty and
             instead a line/position pair are given.  In this case, the
             completer itself will split the line like readline does.

           line : string, optional
             The complete line that text is part of.

           cursor_pos : int, optional
             The position of the cursor on the input line.

        Returns
        -------
          text : string
            The actual text that was completed.

          matches : list
            A sorted list with all possible completions.

        The optional arguments allow the completion to take more context into
        account, and are part of the low-level completion API.

        This is a wrapper around the completion mechanism, similar to what
        readline does at the command line when the TAB key is hit.  By
        exposing it as a method, it can be used by other non-readline
        environments (such as GUIs) for text completion.

        Simple usage example:

        In [1]: x = 'hello'

        In [2]: _ip.complete('x.l')
        Out[2]: ('x.l', ['x.ljust', 'x.lower', 'x.lstrip'])
        N(   R   R|  t   complete(   RV   t   textR   t
   cursor_pos(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR  D  s    *
c         C@ s/   t  j | |  j  } |  j j j | |  d S(   s   Adds a new custom completer function.

        The position argument (defaults to 0) is the index in the completers
        list where you want the completer to be inserted.N(   Rg  Rh  R|  t   matchersRK  (   RV   t	   completert   post   newcomp(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRI  q  s    c         C@ s   |  j  j |  j j  d S(   s)   Reset readline's completer to be our own.N(   R{   t   set_completerR|  t
   rlcomplete(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRH  z  s    c         C@ sI   | r' | j  |  j _ | j |  j _ n |  j |  j _ |  j |  j _ d S(   s   Set the frame of the completer.N(   R  R|  R  R  Ru  R   R}  (   RV   t   frame(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   set_completer_frame~  s
    c         C@ sS  d d l  m } t j d |  d |  d | j |    |  _ |  j j |  j  |  j j |  _	 |  j j
 |  _
 |  j	 | j | j | j | j | j | j | j | j | j | j | j | j | j | j  |  j } | j d d  | j d d	  | j d
 d  | j d d d  | j d d d  | j d d d  |  j d |  j  d  S(   Ni    (   t   magicsRr   R+  t   user_magicst   edt   editt   histt   historyt   rept   recallt   SVGt   svgRg  t   HTMLt   htmlRO   t	   writefiles	   colors %s(   t   IPython.coreR  R   t   MagicsManagert
   UserMagicst   magics_managerR   R-  R   t   register_magicst   define_magict
   AutoMagicst   BasicMagicst
   CodeMagicst   ConfigMagicst   DeprecatedMagicst   DisplayMagicst   ExecutionMagicst   ExtensionMagicst   HistoryMagicst   LoggingMagicst   NamespaceMagicst   OSMagicst   PylabMagicst   ScriptMagicst   register_aliasR  (   RV   R  t   mman(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s&    	R   c         C@ s    |  j  j | d | d | d  S(   Nt
   magic_kindt
   magic_name(   R  t   register_function(   RV   Rz  R  R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   register_magic_function  s    c         C@ s   |  j  |  } | d k rc |  j |  } d } | d k rB d n d | } t | | | f  nu d } |  j | |  } | g }	 i  }
 t | d t  r t j |  j	 |
 d <n  |  j
  | |	 |
   } Wd QX| Sd S(   s   Execute the given line magic.

        Parameters
        ----------
        magic_name : str
          Name of the desired magic function, without '%' prefix.

        line : str
          The rest of the input line as a single string.
        s'   Line magic function `%%%s` not found%s.Rk   s=    (But cell magic `%%%%%s` exists, did you mean that instead?)i   t   needs_local_scopet   local_nsN(   R  R   R  RK   t
   var_expandRc  R~   Rd   R  R  R   (   RV   R  R   t   fnt   cmt   etplt   extrat   stack_deptht   magic_arg_st   argsR   R   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   run_line_magic  s     	
c         C@ s   |  j  |  } | d k rj |  j |  } d } | d k rB d n d j |  } t | j | |   n | d k r d j |  } |  j |  d k	 r | d j |  7} n  t |   n; d }	 |  j | |	  }
 |  j  | |
 |  } Wd QX| Sd S(   sX  Execute the given cell magic.
        
        Parameters
        ----------
        magic_name : str
          Name of the desired magic function, without '%' prefix.

        line : str
          The rest of the first input line as a single string.

        cell : str
          The body of the cell as a (possibly multiline) string.
        s    Cell magic `%%{0}` not found{1}.Rk   s;    (But line magic `%{0}` exists, did you mean that instead?)s2   %%{0} is a cell magic, but the cell body is empty.s-    Did you mean the line magic %{0} (single %)?i   N(   R  R   R  R   RK   R   R  R   (   RV   R  R   Rg  R  t   lmR  R  t   messageR  R  R   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   run_cell_magic  s"    	
c         C@ s   |  j  j d j |  S(   sU   Find and return a line magic by name.

        Returns None if the magic isn't found.R   (   R  R  R  (   RV   R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR    s    c         C@ s   |  j  j d j |  S(   sU   Find and return a cell magic by name.

        Returns None if the magic isn't found.Rg  (   R  R  R  (   RV   R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR    s    c         C@ s   |  j  j | j |  S(   sb   Find and return a magic of the given type by name.

        Returns None if the magic isn't found.(   R  R  R  (   RV   R  R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt
   find_magic	  s    c         C@ s:   | j  d  \ } } } | j t j  } |  j | |  S(   se  DEPRECATED. Use run_line_magic() instead.

        Call a magic function by name.

        Input: a string containing the name of the magic function to call and
        any additional arguments to be passed to the magic.

        magic('name -opt foo bar') is equivalent to typing at the ipython
        prompt:

        In[1]: %name -opt foo bar

        To call a magic without arguments, simply use magic('name').

        This provides a proper Python function to call IPython's magics in any
        valid Python code you can type at the interpreter, including loops and
        compound statements.
        Rm  (   t	   partitionR  R	   R   R  (   RV   t   arg_sR  R   R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR   
	  s    c         C@ sc   d d l  m } t | t  r1 | j |  } n  t | | j  sR t d   n  | |  j | <d S(   s#  Define a new macro

        Parameters
        ----------
        name : str
            The name of the macro.
        themacro : str or Macro
            The action to do upon invoking the macro.  If a string, a new
            Macro object is created by passing the string to it.
        i    (   t   macros-   A macro must be a string or a Macro instance.N(   R  R  R  R7   R    R  R   (   RV   Rg   t   themacroR  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   define_macro&	  s    c         C@ sJ   | j    j d  r$ t d   n  t |  j | d d  |  j d <d S(   s,  Call the given cmd in a subprocess, piping stdout/err

        Parameters
        ----------
        cmd : str
          Command to execute (can not end in '&', as background processes are
          not supported.  Should not be a command that expects input
          other than simple text.
        t   &s#   Background processes not supported.t   depthi   t
   _exit_codeN(   Ra  t   endswitht   OSErrorR3   R  R   (   RV   t   cmd(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   system_piped>	  s    
c      	   C@ sZ  |  j  | d d } t j d k r d d l m } |   y } | d	 k	 r_ d | | f } n  t j |  } y t j	 |  } Wn. t
 k
 r |  j d |  j    d } n XWd	 QXn t j |  } t j j d
 d	  } y t j | d t d | } Wn. t
 k
 r.|  j d |  j    d } n X| d k rI| d } n  | |  j d <d	 S(   s   Call the given cmd in a subprocess using os.system on Windows or
        subprocess.call using the system shell on other platforms.

        Parameters
        ----------
        cmd : str
          Command to execute.
        R  i   R   i    (   t   AvoidUNCPaths   "pushd %s &&"%ss   
iNt   SHELLRr   RD  i   i   R  (   R  Rd   Re   t   IPython.utils._process_win32R  R   R)   Rd  Rf   R3   R:  R.  R2  RB  R  t
   subprocesst   callR   R   (   RV   R  R  R   t   ecRD  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt
   system_rawU	  s,    	

c         C@ sn   | j    j d  r$ t d   n  t |  j | d | d  } | r^ t | j    } n t |  } | S(   sG  Get output (possibly including stderr) from a subprocess.

        Parameters
        ----------
        cmd : str
          Command to execute (can not end in '&', as background processes are
          not supported.
        split : bool, optional
          If True, split the output into an IPython SList.  Otherwise, an
          IPython LSString is returned.  These are objects similar to normal
          lists and strings, with a few convenience attributes for easier
          manipulation of line-based output.  You can use '?' on them for
          details.
        depth : int, optional
          How many frames above the caller are the local variables which should
          be expanded in the command string? The default (0) assumes that the
          expansion variables are in the stack frame calling this function.
        R  s#   Background processes not supported.R  i   (   Ra  R  R  R4   R  R>   Re  R=   (   RV   R  R  R  t   out(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR4   	  s    c         C@ s/   t  d |  d |   |  _ |  j j |  j  d  S(   NRr   R+  (   R   R  R   R-  (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR   	  s    c         C@ s/   t  d |  d |   |  _ |  j j |  j  d  S(   NRr   R+  (   R   t   extension_managerR   R-  (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR   	  s    c         C@ s)   t  d |   |  _ |  j j |  j  d  S(   NR+  (   R!   t   payload_managerR   R-  (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR   	  s    c         C@ s>   t  d |  d |   |  _ |  j j |  j  |  j j |  _ d  S(   NRr   R+  (   R"   t   prefilter_managerR   R-  t   prefilter_linesR	   (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR   	  s    c         C@ sl   |  j  s d S|  j j d  | } y# t |  } t | d t j Wn t k
 rg t d |  n Xd S(   s  Print to the screen the rewritten form of the user's command.

        This shows visual feedback by rewriting input lines that cause
        automatic calling to kick in, like::

          /f x

        into::

          ------> f(x)

        after the user's input prompt.  This helps the user understand that the
        input line was transformed automatically by IPython.
        Nt   rewriteRO   s   ------> (   t   show_rewritten_inputR,  t   renderR  Rl  R(   R)  t   UnicodeEncodeError(   RV   R  t   rw(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   auto_rewrite_input	  s    	c         C@ sb   |  j    \ } } } |  j j | |  } i d d 6| d 6t | j  d 6t j |  d 6} | S(   sR   return simple exception dict
        
        for use in user_expressions
        RK   u   statusu	   tracebacku   enameu   evalue(   R-  R  R2  R6   R\   R)   t   safe_unicode(   RV   R  R<  R  R  R#  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   _user_obj_error	  s    c         C@ s7   |  j  j |  \ } } i d d 6| d 6| d 6} | S(   sZ   format a user object to display dict
        
        for use in user_expressions
        t   okt   statust   datat   metadata(   R1  R   (   RV   Ro   R  t   mdRY   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   _format_user_obj	  s    
c         C@ sx   i  } |  j  } |  j } xY t |  D]K \ } } y |  j t | | |   } Wn |  j   } n X| | | <q% W| S(   s  Evaluate a dict of expressions in the user's namespace.

        Parameters
        ----------
        expressions : dict
          A dict with string keys and string values.  The expression values
          should be valid Python expressions, each of which will be evaluated
          in the user namespace.

        Returns
        -------
        A dict, keyed like the input expressions dict, with the rich mime-typed
        display_data of each value.
        (   R   R}  R9   R  R  R  (   RV   t   expressionsR  R   t	   global_nst   keyt   exprRY   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   user_expressions
  s    		c         B@ s+   |  j   | |  j |  j f d UWd QXd S(   s4   Execute a normal python statement in user namespace.N(   R   R}  R   (   RV   R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   ex+
  s    
c         C@ s*   |  j   t | |  j |  j  SWd QXd S(   se   Evaluate python expression expr in user namespace.

        Returns the result of evaluation
        N(   R   R  R}  R   (   RV   R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   ev0
  s    
c   	      O@ s]  | j  d t  | j  d t  | j  d t  t j j t j j |   } y t |   } Wd QXWn t d |  d SXt j j |  } t	 |   yA | d	 d  \ } } t j | | | | d r |  j n d  Wnp t k
 r,} | d r  n  | j rS| d rS|  j d t  qSn' | d r?  n  |  j d d  n XWd QXd S(
   si  A safe version of the builtin execfile().

        This version will never throw an exception, but instead print
        helpful error messages to the screen.  This only works on pure
        Python files with the .py extension.

        Parameters
        ----------
        fname : string
            The name of the file to be executed.
        where : tuple
            One or two namespaces, passed to execfile() as (globals,locals).
            If only one is given, it is passed as both.
        exit_ignore : bool (False)
            If True, then silence SystemExit for non-zero status (it is always
            silenced for zero status, as it is so common).
        raise_exceptions : bool (False)
            If True raise exceptions everywhere. Meant for testing.
        shell_futures : bool (False)
            If True, the code will share future statements with the interactive
            shell. It will both be affected by previous __future__ imports, and
            any __future__ imports in the code will affect the shell. If False,
            __future__ imports are not shared in either direction.

        t   exit_ignoret   raise_exceptionst   shell_futuresNs,   Could not open file <%s> for safe execution.i   R;  R  (   N(   R  R~   Rf   R   R  t
   expanduserR   RJ   RF  R;   R   R)   t   execfileR   t
   SystemExitt   codeR*  R   (	   RV   t   fnamet   whereRS   t   thefilet   dnamet   globt   locR  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   safe_execfile8
  s4    
	


c   	      @ s	  t  j j t  j j       y t     } Wd QXWn t d    d SXt  j j    }   f d   } t |   yS xL |   D]A } |  j | d t	 d | } | r | j
   q | j s Pq q WWn+ | r   n  |  j   t d    n XWd QXd S(   s  Like safe_execfile, but for .ipy or .ipynb files with IPython syntax.

        Parameters
        ----------
        fname : str
            The name of the file to execute.  The filename must have a
            .ipy or .ipynb extension.
        shell_futures : bool (False)
            If True, the code will share future statements with the interactive
            shell. It will both be affected by previous __future__ imports, and
            any __future__ imports in the code will affect the shell. If False,
            __future__ imports are not shared in either direction.
        raise_exceptions : bool (False)
            If True raise exceptions everywhere.  Meant for testing.
        Ns,   Could not open file <%s> for safe execution.c          3@ s     j  d  r d d l m }  t    T } |  | d d } | j sM d Sx+ | j D]  } | j d k rW | j VqW qW WWd QXn  t     } | j   VWd QXd S(   s,   generator for sequence of code blocks to runs   .ipynbi    (   t   readt
   as_versioni   NR  (   R  t   nbformatR  t   io_opent   cellst	   cell_typet   sourceR   (   R  Rs  t   nbRg  (   R  (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt	   get_cells
  s    	t   silentR  s$   Unknown failure executing file: <%s>(   Rf   R   R  R  R   RJ   RF  R;   t   run_cellR   R   R   R*  (	   RV   R  R  R  R  R  R  Rg  R   (    (   R  sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   safe_execfile_ipy
  s,    
	
c         C@ s{   yU y, | j  t j t |  d d d t  Wn" t k
 rS } | j rT   qT n XWn |  j   t d |  n Xd S(   s  A safe version of runpy.run_module().

        This version will never throw an exception, but instead print
        helpful error messages to the screen.

        `SystemExit` exceptions with status code 0 or None are ignored.

        Parameters
        ----------
        mod_name : string
            The name of the module to be executed.
        where : dict
            The globals namespace.
        t   run_nameR  t	   alter_syss&   Unknown failure executing module: <%s>N(	   R  t   runpyt
   run_moduleR  R   R  R  R*  RJ   (   RV   t   mod_nameR  R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   safe_run_module
  s    	
c         C@ s%   |  j  } d |  _  |  j | | |  S(   sJ   Special method to call a cell magic with the data stored in self.
        N(   t   _current_cell_magic_bodyR   R  (   RV   R  R   Rg  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   _run_cached_cell_magic
  s    		c         @ s  t      | s | j   r    S| r/ t } n  | rD |  j   _ n    f d   } |  j j d  | s| |  j j d  n  d } y |  j j |  } Wn# t	 k
 r t
 j   } | } nf Xt | j    d k r#|  j ? y |  j j |  d } Wn t k
 rt
 j   } n XWd QXn  | rE|  j j |  j | |  n  | sa|  j j | |  n  | d k	 r|  j |  | r|  j d 7_ n  | | d  S| r|  j n t   } |  j |  j j | |  j  }	 |  j ty | j | d |	 }
 Wn t k
 r;} |  j   | r1|  j d 7_ n  | |  St t	 t t  t! f k
 r} |  j"   | r{|  j d 7_ n  | |  SXy |  j# |
  }
 Wn< t$ k
 r} |  j   | r|  j d 7_ n  | |  SX  |  j% _& | rd	 n |  j' } |  j( |
 j) |	 d
 | d | d   d |  j% _& |  j j d  | sS|  j j d  n  Wd QXWd QX| r|  j j* |  j  |  j d 7_ n    S(   s  Run a complete IPython cell.

        Parameters
        ----------
        raw_cell : str
          The code (including IPython code such as %magic functions) to run.
        store_history : bool
          If True, the raw and translated cell will be stored in IPython's
          history. For user code calling back into IPython's machinery, this
          should be set to False.
        silent : bool
          If True, avoid side-effects, such as implicit displayhooks and
          and logging.  silent=True forces store_history=False.
        shell_futures : bool
          If True, the code will share future statements with the interactive
          shell. It will both be affected by previous __future__ imports, and
          any __future__ imports in the code will affect the shell. If False,
          __future__ imports are not shared in either direction.

        Returns
        -------
        result : :class:`ExecutionResult`
        c         @ s   |    _    S(   N(   R   (   RY   (   R   (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     s    	Rw  t   pre_run_celli   s   
Ni   R  R   t   interactivityt   compilerR   t   post_executeRy  (+   R   t   isspaceR~   R   R   R   R   t   input_transformer_managert   transform_cellR4  Rd   R#  R  Re  R   R  R  R8  R  t   store_inputsR  t   logR*  R   R   t   cacheR:  t	   ast_parset   IndentationErrorR=  t   OverflowErrorR  RN   t   MemoryErrorR5  t   transform_astR   R9  t   exec_resultt   ast_node_interactivityt   run_ast_nodest   bodyt   store_output(   RV   t   raw_cellt   store_historyR  R  R   t   preprocessing_exc_tupleRg  R  t	   cell_namet   code_astR   R  (    (   R   sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR  
  s    		







c         C@ s   xi |  j  D]^ } y | j |  } Wq
 t k
 r9   q
 t k
 rg t d |  |  j  j |  q
 Xq
 W|  j  r t j |  n  | S(   s  Apply the AST transformations from self.ast_transformers
        
        Parameters
        ----------
        node : ast.Node
          The root node to be transformed. Typically called with the ast.Module
          produced by parsing user input.
        
        Returns
        -------
        An ast.Node corresponding to the node it was called with. Note that it
        may also modify the passed object, so don't rely on references to the
        original AST.
        s;   AST transformer %r threw an error. It will be unregistered.(   t   ast_transformerst   visitR   R8  RJ   t   removet   astt   fix_missing_locations(   RV   t   nodet   transformer(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR  i  s    	c         C@ s  | s
 d S| d k r> t  | d t j  r5 d } q> d } n  | d k rZ | g  } } nP | d k r~ | d  | d } } n, | d k r g  | } } n t d |   |  j } y xT t |  D]F \ }	 }
 t j |
 g  } | | | d  } |  j | |  r t Sq WxT t |  D]F \ }	 }
 t j	 |
 g  } | | | d	  } |  j | |  rt SqWt
 t j d
  rt   n  Wn. | rt j   d | _ n  |  j   t SXt S(   s  Run a sequence of AST nodes. The execution mode depends on the
        interactivity parameter.

        Parameters
        ----------
        nodelist : list
          A sequence of AST nodes to run.
        cell_name : str
          Will be passed to the compiler as the filename of the cell. Typically
          the value returned by ip.compile.cache(cell).
        interactivity : str
          'all', 'last', 'last_expr' or 'none', specifying which nodes should be
          run interactively (displaying output from expressions). 'last_expr'
          will run the last node interactively only if it is an expression (i.e.
          expressions in loops or other blocks are not displayed. Other values
          for this parameter will raise a ValueError.
        compiler : callable
          A function with the same interface as the built-in compile(), to turn
          the AST nodes into code objects. Default is the built-in compile().
        result : ExecutionResult, optional
          An object to store exceptions that occur during execution.

        Returns
        -------
        True if an exception occurred while running code, False if it finished
        running.
        NR   iR   R   R   s   Interactivity was %rt   exect   singlei    i   (   R  R+  t   ExprR  R   R  t   Modulet   run_codeR   R  RL   Rd   R)  Rl  R#  R   R*  R~   (   RV   t   nodelistR&  R  R  R   t   to_run_exect   to_run_interactivet
   exec_countt   iR-  t   modR  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR     sB    			

c   	      B@ s;  e  j |  j } e  _ | |  _ d } y9 z( |  j j   | |  j |  j f d UWd | e  _ XWn e k
 r } | d k	 r | | _	 n  |  j
 d e  e d d d n |  j k
 r e  j   \ } } } | d k	 r | | _	 n  |  j | | |  n9 | d k	 r#e  j   d | _	 n  |  j
   n Xd } | S(   s  Execute a code object.

        When an exception occurs, self.showtraceback() is called to display a
        traceback.

        Parameters
        ----------
        code_obj : code object
          A compiled code object, to be executed
        result : ExecutionResult, optional
          An object to store exceptions that occur during execution.

        Returns
        -------
        False : successful execution.
        True : an error occurred.
        i   NR;  s'   To exit: use 'exit', 'quit', or Ctrl-D.t   leveli    (   Rd   RO  R  R   t   pre_run_code_hookR}  R   R  R   R   R*  R   RJ   R   R#  R(  (	   RV   t   code_objR   t   old_excepthookt   outflagR   R  RY   R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR3    s0    	c         C@ s   t  d   d  S(   Ns"   Implement enable_gui in a subclass(   t   NotImplementedError(   RV   t   gui(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt
   enable_gui  s    c         C@ s   d d l  m } | j | |  j  \ } } | d k r |  j d k rR | |  _ q | |  j k r t d | |  j f  | j |  j  \ } } q n  | j |  | j |  |  |  j |  | j	 |  j
  |  j j d _ | | f S(   s  Enable interactive matplotlib and inline figure support.
        
        This takes the following steps:
        
        1. select the appropriate eventloop and matplotlib backend
        2. set up matplotlib for interactive use with that backend
        3. configure formatters for inline figure display
        4. enable the selected gui eventloop
        
        Parameters
        ----------
        gui : optional, string
          If given, dictates the choice of matplotlib GUI backend to use
          (should be one of IPython's supported backends, 'qt', 'osx', 'tk',
          'gtk', 'wx' or 'inline'), otherwise we use the default chosen by
          matplotlib (as dictated by the matplotlib build-time options plus the
          user's matplotlibrc configuration file).  Note that not all backends
          make sense in all contexts, for example a terminal ipython can't
          display figures inline.
        i    (   t
   pylabtoolst   inlinesH   Warning: Cannot change to a different GUI toolkit: %s. Using %s instead.R  N(   R  RB  t   find_gui_and_backendt   pylab_gui_selectR   Rl  t   activate_matplotlibt   configure_inline_supportRA  t
   mpl_runnerR  R  t   registryt   default_runner(   RV   R@  t   ptt   backend(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   enable_matplotlib  s    c         C@ s   d d l  m } |  j |  \ } } i  } | | |  t d g  } t |  j |  j  j |  } g  | D]# }	 |  j |	 | |	 k	 ro |	 ^ qo }
 |  j j |  |  j j |  | | |
 f S(   s   Activate pylab support at runtime.

        This turns on support for matplotlib, preloads into the interactive
        namespace all of numpy and pylab, and configures IPython to correctly
        interact with the GUI event loop.  The GUI backend to be used can be
        optionally selected with the optional ``gui`` argument.
        
        This method only adds preloading the namespace to InteractiveShell.enable_matplotlib.

        Parameters
        ----------
        gui : optional, string
          If given, dictates the choice of matplotlib GUI backend to use
          (should be one of IPython's supported backends, 'qt', 'osx', 'tk',
          'gtk', 'wx' or 'inline'), otherwise we use the default chosen by
          matplotlib (as dictated by the matplotlib build-time options plus the
          user's matplotlibrc configuration file).  Note that not all backends
          make sense in all contexts, for example a terminal ipython can't
          display figures inline.
        import_all : optional, bool, default: True
          Whether to do `from numpy import *` and `from pylab import *`
          in addition to module imports.
        welcome_message : deprecated
          This argument is ignored, no welcome message will be displayed.
        i    (   t   import_pylabR  (	   t   IPython.core.pylabtoolsRN  RM  R  t   intersectionR   t
   differenceR  R  (   RV   R@  t
   import_allt   welcome_messageRN  RL  R  t   ignoredt   bothRg   t	   clobbered(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   enable_pylabG  s    !0c         C@ s   |  j  j   } y t j | d  } Wn t k
 r9 n X| j | j  y | j | d g  d | } Wn t k
 r| n X| S(   s(  Expand python variables in a string.

        The depth argument indicates how many frames above the caller should
        be walked to look for the local namespace where to expand variables.

        The global namespace for expansion is always the user's interactive
        namespace.
        i   R  R   (	   R   t   copyRd   R  R  R  R  t   vformatR8  (   RV   R  R  R
  R  R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR  w  s    	t   ipython_edit_c         C@ s   t  j d |  } |  j j |  t  j d | d | \ } } t j |  |  j j |  | r t | d  } | j	 |  | j   n  | S(   s  Make a new tempfile and return its filename.

        This makes a call to tempfile.mkstemp (created in a tempfile.mkdtemp),
        but it registers the created filename internally so ipython cleans it up
        at exit time.

        Optional inputs:

          - data(None): if data is given, it gets written out to the temp file
            immediately, and the file is closed again.t   prefixs   .pyt   dirt   w(
   t   tempfilet   mkdtempR   R-  t   mkstempRf   t   closeR   R   RZ  (   RV   R  R[  RF  t   handleR  t   tmp_file(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt
   mktempfile  s    c         C@ s   t  j j |  d S(   s$   Write a string to the default outputN(   R(   R)  RZ  (   RV   R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyRZ    s    c         C@ s   t  j j |  d S(   s*   Write a string to the default error outputN(   R(   R*  RZ  (   RV   R  (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR.    s    c         C@ s   |  j  r t St | |  S(   N(   t   quietR   R,   (   RV   t   promptR   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR,     s    	c         C@ s   t  j  t j j j  d S(   s   Show a usage messageN(   R   R_  R`  t   usaget   interactive_usage(   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt
   show_usage  s    c         C@ s/   |  j  j | d | } d j d   | D  S(   s  Return as a string a set of input history slices.

        Parameters
        ----------
        range_str : string
            The set of slices is given as a string, like "~5/6-~4/2 4:8 9",
            since this function is for use by magic functions which get their
            arguments as strings. The number before the / is the session
            number: ~n goes n back from the current session.

        raw : bool, optional
            By default, the processed input is used.  If this is true, the raw
            input history is used instead.

        Notes
        -----

        Slices can be described with two notations:

        * ``N:M`` -> standard python form, means including items N...(M-1).
        * ``N-M`` -> include items N..M (closed endpoint).
        t   raws   
c         s@ s   |  ] \ } } } | Vq d  S(   N(    (   R=  R   R   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pys	   <genexpr>  s    (   R  t   get_range_by_strR   (   RV   t	   range_strRj  t   lines(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   extract_input_lines  s    c         C@ s  |  j  | d | } | r | St |  } y& | j d  rP t j | d | SWn~ t k
 r | s y d d l m } Wn! t k
 r d d l	 m } n X| |  }	 |	 j
   j d  St d |   n X| g }
 y |
 j d t |   Wn t k
 rn Xx |
 D] } t j j |  ry t j | d | SWqt k
 r| st | d	 d
 d  } | j
   SWd QXn  t d |   qXqt j j t j j |   rt d |   qqW| r|  j | d d } | d r| d r| d Sn  y t | |  j  } Wn! t k
 r?t d |   n Xt | t  rS| St | t  ri| j St d | |   d S(   s  Get a code string from history, file, url, or a string or macro.

        This is mainly used by magic functions.

        Parameters
        ----------

        target : str

          A string specifying code to retrieve. This will be tried respectively
          as: ranges of input history (see %history for syntax), url,
          correspnding .py file, filename, or an expression evaluating to a
          string or Macro in the user namespace.

        raw : bool
          If true (default), retrieve raw history. Has no effect on the other
          retrieval mechanisms.

        py_only : bool (default False)
          Only try to fetch python code, do not try alternative methods to decode file
          if unicode fails.

        Returns
        -------
        A string of code.

        ValueError is raised if nothing is found, and TypeError if it evaluates
        to an object of another type. In each case, .args[0] is a printable
        message.
        Rj  s   http://s   https://t   skip_encoding_cookiei    (   t   urlopent   latin1s   '%s' seem to be unreadable.t   rR  Ns(   '%s' is a directory, not a regular file.R  i   R  R  sI   '%s' was not found in history, as a file, url, nor in the user namespace.s#   %s is neither a string nor a macro.(   s   http://s   https://(    Rn  R1   R<  R*   t   read_py_urlt   UnicodeDecodeErrort   urllib.requestRp  t   ImportErrort   urllibR  t   decodeR  RK  R0   t   IOErrorRf   R   RP  t   read_py_fileR  t   isdirR  R  R  R   R8  R  R7   R    RY   RN   (   RV   t   targetRj  t   py_onlyRo  t	   search_nsR  t   utargetRp  t   responset   potential_targett   tgtRs  R  t   codeobj(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   find_user_code  s^    	
c         C@ s   |  j  j   x6 |  j D]+ } y t j |  Wq t k
 rA q Xq Wx6 |  j D]+ } y t j |  WqP t k
 rz qP XqP W|  j d t	  |  j
 j   d S(   s  This will be executed at the time of exit.

        Cleanup operations and saving of persistent data that is done
        unconditionally by IPython should be performed here.

        For things that may depend on startup flags or platform specifics (such
        as having readline or not), register a separate atexit function in the
        code that has the appropriate information, rather than trying to
        clutter
        R  N(   R  t   end_sessionR   Rf   t   unlinkR  R   t   rmdirR  R~   R   t   shutdown_hook(   RV   t   tfilet   tdir(    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR   4  s    c         C@ s   |  j    d  S(   N(   RV  (   RV   (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   cleanupW  s    N(   i    i   i   (   s   NoColors   LightBGs   Linux(    (    (   i    i   i   (   R   s   PlainR   (    (   (    N(   R\   R]   Rp   R   t	   _instanceRE   R   R(  RD   t   autocallRB   R   t	   automagicRG   R%   RW  RX  R@   R6  t
   color_infoRC   Rh   R  R~   t   colors_forcet   debugt   deep_reloadt   disable_failing_post_executeRH   R   R1  RI   R   R8  R   R2  R4  t   exit_nowR   R  R   R   R  R   Rn  R  R  R  R  R$  R  Rd   Re   Rb  RA   Rd  R   R   R   R   R   t   _prompt_in1_changedt   _prompt_in2_changedt   _prompt_out_changedt   _prompt_pad_left_changedR  Re  RX  R`  R@  RT  RV  RN  R   R   R  Ri   t   separate_int   separate_outt   separate_out2t   wildcards_case_sensitiveR  R  R  R   R:  R  R  R  R  R   R   R   RF   R  RE  Rt   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   R   RV  RY  R[  R   Rb  R   R{  Rx  R  R  R   R  R  R  R   R  R   R}  R  R   R   R  R  R  R  R  R  R  t   staticmethodR  R  R  R  R  R   R   R  RO  R-  R0  R2  R*  R9  R5  R=  R   R}   R&   Ri  Rl  Rk  R   R  RI  RH  R  R   t	   functoolst   wrapsR   R  R  R  R  R  R  R  R  R  R  R  R3   R4   R   R   R   R   R  R  R  R  R  R  R  R  R  R  R  R  R   R   R3  t   runcodeRA  RM  RW  R?   R  Rd  RZ  R.  R,   Ri  Rn  R  R   R  (    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR      s  																																				T												
												-						1					&					N,		<
*)0	b'				f	 			5			T				%-			"	"	$						4!					 						G<			 R5-0			Z	#t   InteractiveShellABCc           B@ s   e  Z d  Z RS(   s,   An abstract base class for InteractiveShell.(   R\   R]   Rp   (    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyR  [  s   (   Rp   R  R    R   t   abcR+  R   R  Rf   Rk  R	  Rd   R^  RZ   Rg  R  R  R(   R   R  t   pickleshareR   t   traitlets.config.configurableR   R  R   R   R   R   R	   R
   R   t   IPython.core.aliasR   R   t   IPython.core.autocallR   t   IPython.core.builtin_trapR   t   IPython.core.eventsR   R   t   IPython.core.compileropR   R   t   IPython.core.display_trapR   t   IPython.core.displayhookR   t   IPython.core.displaypubR   t   IPython.core.errorR   R   t   IPython.core.extensionsR   t   IPython.core.formattersR   t   IPython.core.historyR   t   IPython.core.inputsplitterR   R   R   t   IPython.core.loggerR   t   IPython.core.macroR    t   IPython.core.payloadR!   t   IPython.core.prefilterR"   t   IPython.core.profiledirR#   t   IPython.core.promptsR$   t   IPython.core.usageR%   t   IPython.testing.skipdoctestR&   t   IPython.utilsR'   R)   R*   t   IPython.utils.decoratorsR+   t   IPython.utils.ioR,   t   IPython.utils.ipstructR-   t   IPython.pathsR.   t   IPython.utils.pathR/   R0   R1   R2   t   IPython.utils.processR3   R4   t   IPython.utils.py3compatR5   R6   R7   R8   R9   t   IPython.utils.strdispatchR:   t   IPython.utils.syspathcontextR;   t   IPython.utils.textR<   R=   R>   R?   t	   traitletsR@   RA   RB   RC   RD   RE   RF   RG   RH   RI   t   IPython.utils.warnRJ   RK   t   IPython.core.hooksR_  R   t	   dedent_reRL   RT   t   objectRU   RG  R8  R^   R_   Rh   Ri   Rq   R   R   R   t   ABCMetaR  R   (    (    (    sU   /data/av2000/mvv/env_mvv/lib/python2.7/site-packages/IPython/core/interactiveshell.pyt   <module>   s   "("F			.            "