B
    è¹`n
  ã               @   s   d d„ Z dd„ ZdS )c             C   s$   x| dk	r| |krdS | j } qW dS )a2  Is ``resource1`` 'inside' ``resource2``?  Return ``True`` if so, else
    ``False``.

    ``resource1`` is 'inside' ``resource2`` if ``resource2`` is a
    :term:`lineage` ancestor of ``resource1``.  It is a lineage ancestor
    if its parent (or one of its parent's parents, etc.) is an
    ancestor.
    NTF)Ú
__parent__)Z	resource1Z	resource2© r   úX/home/kop/projects/devel/pgwui/test_venv/lib/python3.7/site-packages/pyramid/location.pyÚinside   s
    	

r   c             c   s<   x6| dk	r6| V  y
| j } W q tk
r2   d} Y qX qW dS )am  
    Return a generator representing the :term:`lineage` of the
    :term:`resource` object implied by the ``resource`` argument.  The
    generator first returns ``resource`` unconditionally.  Then, if
    ``resource`` supplies a ``__parent__`` attribute, return the resource
    represented by ``resource.__parent__``.  If *that* resource has a
    ``__parent__`` attribute, return that resource's parent, and so on,
    until the resource being inspected either has no ``__parent__``
    attribute or which has a ``__parent__`` attribute of ``None``.
    For example, if the resource tree is::

      thing1 = Thing()
      thing2 = Thing()
      thing2.__parent__ = thing1

    Calling ``lineage(thing2)`` will return a generator.  When we turn
    it into a list, we will get::

      list(lineage(thing2))
      [ <Thing object at thing2>, <Thing object at thing1> ]
    N)r   ÚAttributeError)Úresourcer   r   r   Úlineage!   s    

r   N)r   r   r   r   r   r   Ú<module>   s   