/usr/local/lib/python3.6/site-packages/dill/__pycache__
Edit: /usr/local/lib/python3.6/site-packages/dill/__pycache__/pointers.cpython-36.pyc (3406B)
3
8%Egs @ st d ddddgZ ddlZddlZddlmZ dd lmZ f fd
d Zdf fddZ df fddZ
d
f fddZeZdS )parent referenceatparentschildren N )
_proxy_helper)_locate_objectc C s* d}t | |||}|j }|| kr&dS |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).
r N)r pop)objobjtypeignoredepthchainr r 7/usr/local/lib/python3.6/site-packages/dill/pointers.pyr s c sP t j} fdd}t|ds"|fn|}dd |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 s
t | S )N)
isinstance)x)r r r
- s zparents..__len__c s s | ]}t |V qd S )N)id).0r r r r 0 s zparents..Nr )gcZ
get_referentshasattr
find_chain)r r r r
edge_func predicater r )r r r % s c sH t j} fdd}t|ds"|fn|}dd |D }t| ||||}|S )a Find 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 s
t | S )N)r )r )r r r r D s zchildren..r c s s | ]}t |V qd S )N)r )r r r r r r G s zchildren..)r Z
get_referrersr r )r r r r
r r r r )r r r 6 s
c C st | g}t | di}t | d i}t|}|jt | |jt | |jt | |jt | |jt | |jt tj |jt tjd tj x|rl|jd} || r| g}
x*|t | d k r|t | } |
j| qW |
S |t | }||k r|| }|jt | xT|D ]L}
t |
|kr0qt |
|kr|d |t |
<