}BFjtdZddlZddlZddlmZdgfdZe\ZZdZddZ d Z dd Z ddZ dS)uSupport for wildcard pattern matching in object inspection. Authors ------- - Jörgen Stenarson - Thomas Kluyver N)dir2lambdacdttD}ii}}|D]A}|dd}tt|}|||<||vr|||<B||fS)zzReturn dictionaries mapping lower case typename (e.g. 'tuple') to type objects from the types package, and vice versa.c<g|]}|d|S)Type)endswith).0tnames DC:\PYTHON\_runtimes\venv\Lib\site-packages\IPython/utils/wildcard.py z-create_typestr2type_dicts..s)LLLeU^^F5K5KLELLLN)dirtypeslowergetattr)dont_include_in_type2typestr typenamelist typestr2type type2typestrr nameobjs r create_typestr2type_dictsrsMLs5zzLLLL!#R,L%%SbSz!!eU## T 3 3 3 $L   %%r c|dkrdSt|tkr|}nt|d}|rt||SdS)ais_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)typerget isinstance)rtypestr_or_type test_types r is_typer!&s` %t O$$#  $$_e<< *#y))) 5r Fc\|p*|dp|d S)zCReturn true for strings starting with single _ if show_all is true.___) startswith)strshow_alls r show_hiddenr(6s-  Fs~~d++ F3>>#3F3F/FFr cvi}t|D]&} t||||<#t$rY#wxYw|S)zwProduce a dictionary of an object's attributes. Builds on dir2 by checking that a getattr() call actually succeeds.)rrAttributeError)rnskeys r dict_dirr-:s] BCyy  S#&&2c77 4 Is ) 66*rTc2|dddd}|r#tj|dztjntj|dzt fd|DS)zzfilter_ns..Us{MMhc3 #M0;C0J0JM07\0J0JMS MMMMMMr )replacerecompileIdictitems)r+ name_patternr6 ignore_caser'patternr5s ` ` @r filter_nsrAKs""3t,,44S==G&jbd++j%% MMMMMM"((**MMM M MMr c |d}t|dkrt||d|||St||dd||}i}|D]e\}} t t | |d|dd||} | D]\} } | ||d| <f|S)zbReturn dictionary of all objects in a namespace dictionary that match type_pattern and filter.r1r)r>r6r?r'rN)r?r')splitlenrAr=list_namespacer-join) namespacer6filterr?r' pattern_listfilteredresultsrrr+ inner_name inner_objs r rFrFYsc""L <A Q%1$/(DDDDY\!_).(3hHHH!)) ? ?ID# | #abb)9 : :,7(LLLB*, ? ?% I5>jj122 ?r )F)r.rTT)FF) __doc__r9rIPython.utils.dir2rrrrr!r(r-rArFr r rRs ######