Ñò
ÎÑAHc           @   s   d  Z  d d k Z d d k Te i i ƒ  Z d d k Z d „  Z d „  Z	 d „  Z
 d „  Z e ƒ  d „  Z e i d	 e ƒ d S(
   sž    IPython extension: new prefilters for output grabbing 

Provides 

var = %magic blah blah

var = !ls

$Id: genutils.py 1077 2006-01-24 18:15:27Z vivainio $

iÿÿÿÿN(   t   *c         C   s4   | i  d ƒ } | i  d ƒ } t | ƒ } t d ƒ S(   s    Handle a = %mymagic blah blah t   varnamet   cmds   $var = _ip.magic($expr)(   t   groupt   make_quoted_exprt   itpl(   t   linet   mot   varR   t   expr(    (    sY   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/Extensions/ext_rescapture.pyt	   hnd_magic   s    c         C   s:   | i  d ƒ } | i  d ƒ } t t d ƒ ƒ } t d ƒ S(   s    Handle a = !ls R   R   s   sc -l =$cmds   $var = _ip.magic($expr)(   R   R   R   (   R   R   R   R   R	   (    (    sY   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/Extensions/ext_rescapture.pyt
   hnd_syscmd   s    c         C   s&   t  i i i t i |  ƒ | f ƒ d  S(   N(   t   ipt   metat   re_prefilterst   appendt   ret   compile(   t   patt   hnd(    (    sY   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/Extensions/ext_rescapture.pyt   install_re_handler)   s    c           C   s*   g  t  i _ t d t ƒ t d t ƒ d  S(   Ns'   (?P<varname>[\w\.]+)\s*=\s*%(?P<cmd>.*)s'   (?P<varname>[\w\.]+)\s*=\s*!(?P<cmd>.*)(   R   R   R   R   R
   R   (    (    (    sY   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/Extensions/ext_rescapture.pyt   init_handlers,   s
    c         C   sQ   x> t  i i D]0 \ } } | i | ƒ } | o | | | ƒ Sq Wt i i ‚ d  S(   N(   R   R   R   t   matcht   IPythont   ipapit   TryNext(   t   selfR   R   t   handlerR   (    (    sY   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/Extensions/ext_rescapture.pyt   regex_prefilter_f:   s     t   input_prefilter(   t   __doc__t   IPython.ipapiR   t   IPython.genutilsR   t   getR   R   R
   R   R   R   R   t   set_hook(    (    (    sY   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/Extensions/ext_rescapture.pyt   <module>   s   
	
	
			