;ò
ÎÑAHc           @   s^   d  Z  d k l Z d k Z d k Z d k Z d „  Z d f  d „  ƒ  YZ d „  Z e ƒ  d S(   s÷   Shell mode for IPython.

Start ipython in shell mode by invoking "ipython -p sh"

(the old version, "ipython -p pysh" still works but this is the more "modern" 
shell mode and is recommended for users who don't care about pysh-mode
compatibility)
(   s   ipapiNc          C   s„  t  i ƒ  } | i } d | _ y | i d ƒ Wn t j
 o n Xd  k } d  k	 } d  k
 } d  k } | i d ƒ | i d ƒ t ƒ  | i d <d | _ d | _ d | _ d	 k l } d  k } d
 | i | i i t d ƒ d f | _ | i i d d ƒ | i i d d ƒ d | _ d | _ d | _ d | _ | i } | i d g  ƒ } | o. t  i! d ƒ GH| i" d ƒ | i d ƒ } n t# i$ d j o d „  }	 n
 d „  }	 xY | D]Q }
 t# i' i( |
 ƒ \ }  } |	 |  ƒ } | | i i, j o | i- | |
 ƒ qµqµW| i. d ƒ | i/ d j oO d t# i0 d i1 ƒ  j o | i- d d ƒ qv| i. d ƒ | i- d d  ƒ n t2 | ƒ d  S(!   Ni   s&   from IPython.external.path import paths	   import oss   def up(): os.chdir('..')s   LAs6   \C_LightBlue[\C_LightCyan\Y2\C_LightBlue]\C_Green|\#> s"   \C_Green|\C_LightGreen\D\C_Green> s   <\#> (   s   Releases   IPython %s   [on Py %s]
i   i    s   cds   -qs   macros   -rs   1s   0s
   syscmdlistsÞ   
        System command list not initialized, probably the first run...
        running %rehashx to refresh the command list. Run %rehashx
        again to refresh command list (after installing new software etc.)
        s   rehashxs   posixc         C   s   |  S(   N(   s   s(   s   s(    (    sR   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_profile_sh.pys   <lambda>^   s    c         C   s   |  i ƒ  Sd  S(   N(   s   ss   lower(   s   s(    (    sR   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_profile_sh.pys   mapper`   s    s   IPython.external.mglobs   win32s   cygwins   PATHs   ds   ls -F --color=autos	   ipy_fsopss   dir /w /og /on(3   s   ipapis   gets   ips   optionss   os   autocalls   exs   ImportErrors
   envpersists	   ipy_whichs   ipy_app_completerss   ipy_rehashdirs   LastArgFinders   user_nss
   prompt_in1s
   prompt_in2s
   prompt_outs   IPythons   Releases   syss   versions   splits   Nones   banners   IPs   default_options   prompts_pad_lefts   separate_ins   separate_outs   separate_out2s   dbs   syscmdss   textwraps   dedents   magics   oss   names   mappers   cmds   paths   splitexts   noexts   exts   keys   alias_tables   defaliass   loads   platforms   environs   lowers   extend_shell_behavior(   s   noexts   ips   ipy_app_completerss   syscmdss
   envpersists   dbs   syss   keys   Releases   mappers   cmds   os	   ipy_whichs   ipy_rehashdirs   ext(    (    sR   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_profile_sh.pys   main   s`    										)						 s   LastArgFinderc           B   s#   t  Z d  Z e d „ Z d „  Z RS(   s…    Allow $LA to work as "last argument of previous command", like $! in bash
    
    To call this in normal IPython code, do LA()
    c         C   sI   t  i ƒ  } | t j o t |  ƒ Sn | i i | i	 ƒ  i
 ƒ  d Sd  S(   Niÿÿÿÿ(   s   ipapis   gets   ips   hist_idxs   Nones   strs   selfs   IPs   input_hist_raws   strips   split(   s   selfs   hist_idxs   ip(    (    sR   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_profile_sh.pys   __call__   s    c         C   s|   t  i ƒ  } xe t | i i ƒ D]Q } | i ƒ  i ƒ  } t
 | ƒ d j  p | d d d g j o q n | d Sq Wd Sd  S(   Ni   iÿÿÿÿs   $LAs   LA()s    (   s   ipapis   gets   ips   reverseds   IPs   input_hist_raws   cmds   strips   splits   partss   len(   s   selfs   ips   cmds   parts(    (    sR   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_profile_sh.pys   __str__„   s     *(   s   __name__s
   __module__s   __doc__s   Nones   __call__s   __str__(    (    (    sR   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_profile_sh.pys   LastArgFinderz   s    c            s‰   d ˆ  i _ ˆ  i i ˆ  i i d i d <d k l ‰ d k l } t	 d ‡ ‡  ‡ d † ˆ  i _
 ‡  d †  ‰ ‡  d	 †  } | ˆ  i _ d  S(
   Ni   s   __builtins__s   __sig__(   s   ItplNS(   s   shelli   c            s   t  ˆ  |  ˆ i i ˆ ƒ  ƒ ƒ S(   N(   s   strs   ItplNSs   cmds   ips   IPs   user_nss
   get_locals(   s   cmds   lvarss   depth(   s   ItplNSs   ips
   get_locals(    sR   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_profile_sh.pys   <lambda>¡   s    c    	         s/  d k  ‰  ‡  d †  } ‡  d †  }  d } ˆ i i } | } x^ | | j oP y | | ƒ } Wq= t	 t
 f j
 o | d 7} q= t j
 o h  Sq= Xq= W| } y- x& | | | d ƒ j o | d 7} q§ WWn t	 t
 t f j
 o n Xh  } x1 t | | d d ƒ D] } | i |  | ƒ ƒ q
W| Sd S(   s3   Substituting a variable through Itpl deep inside the IPSHELL stack
            requires the knowledge of all the variables in scope upto the last
            IPSHELL frame. This routine simply merges all the local variables
            on the IPSHELL stack without worrying about their scope rules
        Nc            s   ˆ  i |  d ƒ i d i d S(   Ni   s   __builtins__s   __sig__(   s   syss	   _getframes   fnos	   f_globalss   __dict__(   s   fno(   s   sys(    sR   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_profile_sh.pys   <lambda>­   s    c            s   ˆ  i |  d ƒ i S(   Ni   (   s   syss	   _getframes   fnos   f_locals(   s   fno(   s   sys(    sR   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_profile_sh.pys   <lambda>¯   s    i   iÿÿÿÿ(   s   syss   getsigs   getlvarss   frame_nos   ips   IPs   __sig__s   sigs   fsigs   AttributeErrors   KeyErrors
   ValueErrors   first_frames   lvarss   ranges   fnos   update(	   s   getlvarss   frame_nos   syss   first_frames   sigs   lvarss   fnos   getsigs   fsig(   s   ip(   s   syssR   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_profile_sh.pys
   get_locals¤   s6     	   c            s  ˆ  i i ƒ  |  i d ƒ }  d } d } xÕ |  D]Í } | d j o | i ƒ  } n | o | d d j o" | | d d !d 7} t	 } q/ q/ | | 7} | p | oX ˆ  i i
 i d | d ƒ ˆ  i i ˆ  i i | | ƒ ƒ } d } | t j o Pqü q/ q/ W| o ˆ  i i d ƒ n d S(	   sU  Run a string of one or more lines of source.

        This method is capable of running a string containing multiple source
        lines, as if they had been entered at the IPython prompt.  Since it
        exposes IPython's processing machinery, the given strings can contain
        magic calls (%magic), special shell access (!cmd), etc.s   
i    s    iÿÿÿÿs   \s    s   # N(   s   ips   IPs   resetbuffers   liness   splits   mores   commands   lines   strips   Trues   input_hist_raws   appends   pushs	   prefilters   None(   s   liness   commands   lines   more(   s   ip(    sR   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_profile_sh.pys	   _runlinesÌ   s,      
!(   s   ips   IPs   __sig__s   user_nss   __dict__s   IPython.Itpls   ItplNSs   IPython.genutilss   shells   Nones
   var_expands
   get_localss	   _runliness   runlines(   s   ips   shells   ItplNSs
   get_localss	   _runlines(    (   s   ips   ItplNSs
   get_localssR   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_profile_sh.pys   extend_shell_behavior”   s    (-(	   s   __doc__s   IPythons   ipapis   oss   textwraps   ipy_defaultss   mains   LastArgFinders   extend_shell_behavior(   s   ipy_defaultss   ipapis   textwraps   LastArgFinders   extend_shell_behaviors   mains   os(    (    sR   /u/d/b/dbachman/=/lib/python2.3/site-packages/IPython/Extensions/ipy_profile_sh.pys   ?   s   		h	g