;ò
ÎÑAHc           @   sÁ   d  Z  d k l Z d Z e i Z d k Z d k Z d k Z d k	 Z	 d k
 Z
 d k Z d k l Z d g d „ Z e ƒ  \ Z Z d „  Z e d „ Z d	 e f d
 „  ƒ  YZ e e d „ Z d S(   sp   Support for wildcard pattern matching in object inspection.

$Id: OInspect.py 608 2005-07-06 17:52:32Z fperez $
(   s   Releases0   JÃ¶rgen Stenarson <jorgen.stenarson@bostream.nu>N(   s   dir2s   lambdac         C   s·   g  } x6 t t ƒ D]( } | d d j o | i | ƒ q q Wh  } h  } x[ | D]S } | d  i ƒ  } t	 t | ƒ } t	 t | ƒ | | <| |  j o | | | <qR qR W| | f Sd S(   sl   Return dictionaries mapping lower case typename to type objects, from
    the types package, and vice versa.iüÿÿÿs   TypeN(   s   typenamelists   dirs   typess   tnames   appends   typestr2types   type2typestrs   lowers   names   getattrs   objs   dont_include_in_type2type2str(   s   dont_include_in_type2type2strs   objs   names   typenamelists   typestr2types   type2typestrs   tname(    (    s@   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/wildcard.pys   create_typestr2type_dicts   s        c         C   sg   | d j o t Sn t | ƒ t i j o
 | } n t i | t ƒ } | o t	 |  | ƒ Sn t Sd S(   sò   is_type(obj,typestr_or_type) verifies if obj is of a certain type or
    group of types takes strings as parameters of the for 'tuple'<->TupleType
    'all' matches all types.  TODO: Should be extended for choosing more than
    one type
    s   allN(   s   typestr_or_types   Trues   types   typess   TypeTypes	   test_types   typestr2types   gets   Falses
   isinstances   obj(   s   objs   typestr_or_types	   test_type(    (    s@   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/wildcard.pys   is_type.   s     
c         C   s)   | p |  i d ƒ p |  i d ƒ Sd S(   sC   Return true for strings starting with single _ if show_all is true.s   __s   _N(   s   show_alls   strs
   startswith(   s   strs   show_all(    (    s@   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/wildcard.pys   show_hidden?   s     s	   NameSpacec           B   s\   t  Z d  Z d d e e d „ Z d „  Z e e ƒ Z d „  Z e e d d ƒZ	 d „  Z
 RS(	   s]   NameSpace holds the dictionary for a namespace and implements filtering
    on name and typess   *s   allc         C   sÊ   | |  _  | |  _ | |  _ | |  _ | |  _ t | ƒ t i	 j o | |  _
 nw g  } x^ t | ƒ D]P } t | t ƒ o: y  | i | t | | ƒ f ƒ Wq³ t j
 o q³ Xqc qc Wt | ƒ |  _
 d  S(   N(   s   show_alls   selfs   objs   objects   name_patterns   type_patterns   ignore_cases   types   typess   DictTypes   _nss   kvs   dir2s   keys
   isinstances
   basestrings   appends   getattrs   AttributeErrors   dict(   s   selfs   objs   name_patterns   type_patterns   ignore_cases   show_alls   keys   kv(    (    s@   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/wildcard.pys   __init__F   s     					  c         C   s   |  i |  i |  i ƒ Sd S(   sJ   Return name space dictionary with objects matching type and name patterns.N(   s   selfs   filters   name_patterns   type_pattern(   s   self(    (    s@   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/wildcard.pys   get_nsa   s     c         C   s   |  i i ƒ  Sd S(   sA   Return list of object names in namespace that match the patterns.N(   s   selfs   nss   keys(   s   self(    (    s@   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/wildcard.pys   get_ns_namesf   s     s   docsD   List of objects in name space that match the type and name patterns.c   
      C   s¹   d „  } |  i }	 g  i } | |	 i ƒ  | |  i |  i	 ƒ D] } | | |	 | f ƒ q; ~ } g  i } | D]0 \ } } t | | ƒ o | | | f ƒ ql ql ~ } t | ƒ } | Sd S(   s(   Return dictionary of filtered namespace.c   	      C   s¨   | i d d ƒ i d d ƒ } | o t i | d t i ƒ } n t i | d ƒ } g  i } |  D]4 } | i | ƒ o t | | ƒ o | | ƒ qc qc ~ } | Sd S(   s4   Return list of elements in lista that match pattern.s   *s   .*s   ?s   .s   $N(   s   name_patterns   replaces   patterns   ignore_cases   res   compiles   Is   regs   appends   _[1]s   listas   xs   matchs   show_hiddens
   hidehiddens   result(	   s   listas   name_patterns
   hidehiddens   ignore_cases   patterns   _[1]s   results   xs   reg(    (    s@   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/wildcard.pys   glob_filtern   s     KN(   s   glob_filters   selfs   _nss   nss   appends   _[1]s   keyss   name_patterns   show_alls   ignore_cases   xs   alls   keys   objs   is_types   type_patterns   dict(
   s   selfs   name_patterns   type_patterns   alls   objs   glob_filters   _[1]s   keys   xs   ns(    (    s@   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/wildcard.pys   filterl   s     			3G(   s   __name__s
   __module__s   __doc__s   Trues   __init__s   get_nss   propertys   nss   get_ns_namess   ns_namess   filter(    (    (    s@   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/wildcard.pys	   NameSpaceC   s    		c      
   C   s  | i d ƒ }	 t |	 ƒ d j o3 t |  d |	 d d | d | d | ƒ} | i	 Snµ t |  d |	 d d d d | d | ƒ} h  }
 | i	 } xv | i ƒ  D]h \ } } t | | d i |	 d ƒ d | d | ƒ} x. | i ƒ  D]  \ } } | |
 d	 | | f <qÝ Wq™ W|
 Sd
 S(   sW   Return dictionary of all objects in namespace that matches type_pattern
    and filter.s   .i   s   name_patterni    s   type_patterns   ignore_cases   show_alls   alls   %s.%sN(   s   filters   splits   pattern_lists   lens	   NameSpaces	   namespaces   type_patterns   ignore_cases   show_alls   nss   ress   nsdicts	   iteritemss   names   objs   list_namespaces   joins
   inner_names	   inner_obj(   s	   namespaces   type_patterns   filters   ignore_cases   show_alls	   inner_objs
   inner_names   objs   names   pattern_lists   ress   nss   nsdict(    (    s@   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/wildcard.pys   list_namespace‚   s$     	  (   s   __doc__s   IPythons   Releases
   __author__s   licenses   __license__s   __builtin__s
   exceptionss   pdbs   pprints   res   typess   IPython.genutilss   dir2s   create_typestr2type_dictss   typestr2types   type2typestrs   is_types   Falses   show_hiddens   objects	   NameSpaces   list_namespace(   s   list_namespaces   dir2s   create_typestr2type_dictss   __license__s   res	   NameSpaces   pprints   is_types   __builtin__s
   __author__s
   exceptionss   typestr2types   show_hiddens   type2typestrs   Releases   pdbs   types(    (    s@   /nyx/web/d/b/dbachman/work/src/ipython-0.8.4/IPython/wildcard.pys   ?   s    									?