Ñò
ÎÑAHc           @   sc   d  d k  l Z d  d k  Z d  d k Z d e f d „  ƒ  YZ d „  Z e d j o e ƒ  n d S(   iÿÿÿÿ(   t   CommandChainDispatcherNt   StrDispatchc           B   sS   e  Z d  Z d „  Z d d „ Z d d „ Z d „  Z d „  Z d „  Z d „  Z	 RS(	   s8    Dispatch (lookup) a set of strings / regexps for match c         C   s   h  |  _  h  |  _ d  S(   N(   t   strst   regexs(   t   self(    (    sK   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/strdispatch.pyt   __init__   s    	i    c         C   s9   |  i  i | t ƒ  ƒ } | i | | ƒ | |  i  | <d S(   s(    Adds a target 'string' for dispatching N(   R   t   getR    t   add(   R   t   st   objt   priorityt   chain(    (    sK   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/strdispatch.pyt   add_s   s    c         C   s9   |  i  i | t ƒ  ƒ } | i | | ƒ | |  i  | <d S(   s&    Adds a target regexp for dispatching N(   R   R   R    R   (   R   t   regexR	   R
   R   (    (    sK   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/strdispatch.pyt   add_re   s    c         c   s`   | |  i  j o |  i  | Vn x9 |  i i ƒ  D]( \ } } t i | | ƒ o	 | Vq0 q0 Wd S(   s2    Get a seq of Commandchain objects that match key N(   R   R   t   itemst   ret   match(   R   t   keyt   rR	   (    (    sK   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/strdispatch.pyt   dispatch   s     	c         C   s   d |  i  |  i f S(   Ns   <Strdispatch %s, %s>(   R   R   (   R   (    (    sK   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/strdispatch.pyt   __repr__&   s    c         c   s:   | |  i  j o d  Sx |  i  | D] } | d Vq# Wd  S(   Ni   (   R   (   R   R   t   el(    (    sK   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/strdispatch.pyt	   s_matches)   s
     c         c   s8   x1 |  i  | ƒ D]  } x | D] } | d Vq Wq Wd S(   s-    Yield all 'value' targets, without priority i   N(   R   (   R   R   t   valR   (    (    sK   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/strdispatch.pyt   flat_matches0   s      (
   t   __name__t
   __module__t   __doc__R   R   R   R   R   R   R   (    (    (    sK   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/strdispatch.pyR      s   				c          C   sq   t  ƒ  }  |  i d d d d ƒ|  i d d d d ƒt |  i d ƒ ƒ GH|  i d d ƒ t |  i d ƒ ƒ GHd  S(	   Nt   heii"   R
   i   i{   i   s   h.ii®  (   R   R   t   listR   R   R   (   t   d(    (    sK   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/strdispatch.pyt   test8   s    	t   __main__(   t   IPython.hooksR    t   IPythonR   t   objectR   R    R   (    (    (    sK   /u/d/b/dbachman/web/work/lib/python2.3/site-packages/IPython/strdispatch.pyt   <module>   s   2	