wL ildZddlZddlZddlmZdgfdZe\ZZdZd dZ dZ d d Z d d Z y)uSupport for wildcard pattern matching in object inspection. Authors ------- - Jörgen Stenarson - Thomas Kluyver N)dir2lambdacttDcgc]}|jds|}}ii}}|D]4}|ddj}t t|}|||<||vs0|||<6||fScc}w)zzReturn dictionaries mapping lower case typename (e.g. 'tuple') to type objects from the types package, and vice versa.TypeN)dirtypesendswithlowergetattr)dont_include_in_type2typestrtname typenamelist typestr2type type2typestrnameobjs \/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/IPython/utils/wildcard.pycreate_typestr2type_dictsrs(+5zLeU^^F5KELLL!#R,L%Sbz!eU# T 3 3 $L  %  %%Ms A0A0c|dk(ryt|tk(r|}ntj|d}|r t||Sy)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 ris_typer&sF % O$#  $$_e< #y)) cT|xs%|jdxs|jd S)zCReturn true for strings starting with single _ if show_all is true.___) startswith)strshow_alls r show_hiddenr%6s'  Fs~~d+ F3>>#3F/FFrchi}t|D]} t||||<|S#t$rY"wxYw)zwProduce a dictionary of an object's attributes. Builds on dir2 by checking that a getattr() call actually succeeds.)rr AttributeError)rnskeys rdict_dirr*:sL BCy S#&2c7  I s % 11c|jddjdd}|r(tj|dztjntj|dzt fd|j DS)zzfilter_ns..Us@Mhc3 #0;C0J07\0JS Ms>!>)replacerecompileIdictitems)r( name_patternr4 ignore_caser$patternr3s ` ` @r filter_nsr?Ksv""3t,44S=Gjjbdd+jj% M"((*M MMrc ^|jd}t|dk(rt||d|||St||dd||}i}|jD]R\}} t t | |dj |dd||} | jD]\} } | ||d| <T|S)zbReturn dictionary of all objects in a namespace dictionary that match type_pattern and filter.r.r)r<r4r=r$rN)r=r$)splitlenr?r;list_namespacer*join) namespacer4filterr=r$ pattern_listfilteredresultsrrr( inner_name inner_objs rrDrDYsc"L <A Q%1$/(DDY\!_).(3hH!) ?ID# | #ab)9 :,7(LB*, ?% I5>j12 ?  ? r)F)r,rTT)FF) __doc__r7r IPython.utils.dir2rrrrrr%r*r?rDrrrPsS #