
    <h                     t    S r SSKrSSKrSSKJr  S/4S jr\" 5       u  rrS rSS jr	S r
  SS	 jrSS
 jrg)u   Support for wildcard pattern matching in object inspection.

Authors
-------
- Jörgen Stenarson <jorgen.stenarson@bostream.nu>
- Thomas Kluyver
    N)dir2lambdac                     [        [        5       Vs/ s H  oR                  S5      (       d  M  UPM     nn0 0 pCU H5  nUSS R                  5       n[	        [        U5      nXcU'   XP;  d  M1  XTU'   M7     X44$ s  snf )zvReturn dictionaries mapping lower case typename (e.g. 'tuple') to type
objects from the types package, and vice versa.TypeN)dirtypesendswithlowergetattr)dont_include_in_type2typestrtnametypenamelisttypestr2typetype2typestrnameobjs          iC:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\IPython/utils/wildcard.pycreate_typestr2type_dictsr      s}     (+5zLze^^F5KEzLL!#R,Sbz!eU# T3 $  %% Ms
   A8A8c                     US:X  a  g[        U5      [         :X  a  UnO[        R                  US5      nU(       a  [        X5      $ g)zis_type(obj, typestr_or_type) verifies if obj is of a certain type. It
can take strings or actual python types for the second argument, i.e.
'tuple'<->TupleType. 'all' matches all types.

TODO: Should be extended for choosing more than one type.allTF)typer   get
isinstance)r   typestr_or_type	test_types      r   is_typer   &   sD     %O$#	 $$_e<	#))    c                 p    U=(       d.    U R                  S5      =(       d    U R                  S5      (       + $ )zCReturn true for strings starting with single _ if show_all is true.___)
startswith)strshow_alls     r   show_hiddenr%   6   s'    Fs~~d+F3>>#3F/FFr   c                 l    0 n[        U 5       H  n [        X5      X'   M     U$ ! [         a     M$  f = f)zsProduce a dictionary of an object's attributes. Builds on dir2 by
checking that a getattr() call actually succeeds.)r   r   AttributeError)r   nskeys      r   dict_dirr*   :   sC     
BCyS&27  I  s   %
33c                 (  ^^^ UR                  SS5      R                  SS5      nU(       a)  [        R                  " US-   [        R                  5      mO[        R                  " US-   5      m[	        UUU4S jU R                  5        5       5      $ )z<Filter a namespace dictionary by name pattern and item type.*z.*?.$c              3      >#    U  HH  u  pTR                  U5      (       d  M  [        UT5      (       d  M0  [        UT5      (       d  MC  X4v   MJ     g 7f)N)matchr%   r   ).0r)   r   regr$   type_patterns      r   	<genexpr>filter_ns.<locals>.<genexpr>U   sB      M*hc		#	0;C0J 07\0J 	*s   AAA	
A)replacerecompileIdictitems)r(   name_patternr4   ignore_caser$   patternr3   s     ` ` @r   	filter_nsr@   K   sv     ""3t,44S=Gjjbdd+jj%  M"((* M M Mr   c           
      J   UR                  S5      n[        U5      S:X  a  [        XS   UX4S9$ [        XS   SX4S9n0 nUR                  5        HP  u  p[	        [        U	5      USR                  USS 5      X4S9n
U
R                  5        H  u  pXU< SU< 3'   M     MR     U$ )z^Return dictionary of all objects in a namespace dictionary that match
type_pattern and filter.r.      r   )r=   r4   r>   r$   r   N)r>   r$   )splitlenr@   r<   list_namespacer*   join)	namespacer4   filterr>   r$   pattern_listfilteredresultsr   r   r(   
inner_name	inner_objs                r   rE   rE   Y   s     c"L
<A	Q%1$/D D Y!_).(3H !)ID| #ab)9 :,7LB *,%
5>j12 *4	 * r   )F)r,   r   TT)FF)__doc__r8   r	   IPython.utils.dir2r   r   r   r   r   r%   r*   r@   rE    r   r   <module>rQ      sS    
  #<D: & 78 l G" EIMr   