bgsZgdZddlZddlZddlmZddlmZd dZd dZ d d Z dd Z eZ dS))parent referenceatparentschildrenN) _proxy_helper)_locate_objectcbd}t||||}|}||urdS|S)al >>> listiter = iter([4,5,6,7]) >>> obj = parent(listiter, list) >>> obj == [4,5,6,7] # actually 'is', but don't have handle any longer True NOTE: objtype can be a single type (e.g. int or list) or a tuple of types. WARNING: if obj is a sequence (e.g. list), may produce unexpected results. Parent finds *one* parent (e.g. the last member of the sequence). rN)rpop)objobjtypeignoredepthchainrs ^/builddir/build/BUILD/cloudlinux-venv-1.0.7/venv/lib/python3.11/site-packages/dill/pointers.pyrrs< E C% 0 0E YY[[F }}t Mctj}fd}t|ds|fn|}d|D}t||||ddd}|S)zFind the chain of referents for obj. Chain will end with obj. objtype: an object type or tuple of types to search for depth: search depth (e.g. depth=2 is 'grandparents') ignore: an object or tuple of objects to ignore in the search c$t|SN isinstancexrs rzparents..-*Q00r__len__c34K|]}t|VdSrid.0rs r zparents..0( ( (#bgg ( ( ( ( ( (rN)gc get_referentshasattr find_chainrrrr edge_func predicaters ` rrr%sk I0000I%fi88 DfYYfF ( ( ( ( (F sIy% 8 82 >E Lrctj}fd}t|ds|fn|}d|D}t|||||}|S)aFind the chain of referrers for obj. Chain will start with obj. objtype: an object type or tuple of types to search for depth: search depth (e.g. depth=2 is 'grandchildren') ignore: an object or tuple of objects to ignore in the search NOTE: a common thing to ignore is all globals, 'ignore=(globals(),)' NOTE: repeated calls may yield different results, as python stores the last value in the special variable '_'; thus, it is often good to execute something to replace '_' (e.g. >>> 1+1). c$t|Srrrs rrzchildren..Drrrc34K|]}t|VdSrr r"s rr$zchildren..Gr%r)r' get_referrersr)r*r+s ` rrr6sb I0000I%fi88 DfYYfF ( ( ( ( (F sIy% @ @E Lrc|g}t|di}t|di}t|}|t||t||t||t||t||ttj|ttjdt j|r(|d} || rY| g} |t| ?|t| } | | |t| ?| S|t| } | |kr|| } |t| | D]a} t| |vrt| |vr<| dz|t| <| |t| <|| b|(|gS)Nrr) r!setaddsys _getframer'collectr append)rr-r, max_depth extra_ignorequeuerrrtargetrtdepth referrerssources rr*r*Ss: EE WWaLEggt_F   F JJr,    JJr%yy JJr%yy JJr&zz JJr&zz JJr#-//""### JJr#-""##$$$JLLL )1 9V   HEF$06 + V$$$F$0Lr&zz" I  ! &))I JJr)}} % % %# ) )f::''f::U**(. E"V**%)/F2f::&LL(((% )& 5Lr)r )rr )r2r ) __all__r'r6_dillr rr rrrrr* refobjectr rrrDs ? > > ------''''''(":    H  r