Ńň
ă=Pc        
   @   sú   d  Z  d d k l Z d d k Te e  Z d d d     YZ e d j oŞ d d f Z d	 d f Z d
 d f Z	 d d f Z
 d d f Z d d f Z d d f Z e   Z e i e	 e e
 e e e e  g  Z e i   D] Z e e d qŮ [ GHn d S(   sK   
The I{depsolve} module defines a class for performing dependancy solving.
i˙˙˙˙(   t	   getLogger(   t   *t   DepListc           B   sD   e  Z d  Z d   Z d   Z d   Z d   Z d   Z d   Z RS(   sł  
    Dependancy solving list.
    Items are tuples: (object, (deps,))
    @ivar raw: The raw (unsorted) items.
    @type raw: list
    @ivar index: The index of (unsorted) items.
    @type index: list
    @ivar stack: The sorting stack.
    @type stack: list
    @ivar pushed: The I{pushed} set tracks items that have been
        processed.
    @type pushed: set
    @ivar sorted: The sorted list of items.
    @type sorted: list
    c         C   s4   g  |  _  h  |  _ g  |  _ t   |  _ d |  _ d S(   t    N(   t   unsortedt   indext   stackt   sett   pushedt   Nonet   sorted(   t   self(    (    sO   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/deplist.pyt   __init__,   s
    			c         G   s<   x5 | D]- } |  i  i |  | d } | |  i | <q W|  S(   sŹ   
        Add items to be sorted.
        @param items: One or more items to be added.
        @type items: I{item}
        @return: self
        @rtype: L{DepList}
        i    (   R   t   appendR   (   R   t   itemst   itemt   key(    (    sO   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/deplist.pyt   add4   s     
c         C   s   t    |  _ t   |  _ xň |  i D]ç } g  } |  i |  xŞ t |  i  o yi |  i   } | d i	   } |  i
 i |  } | d j o t i d t |   w> n |  i |  Wq> t j
 o | i |  i    q> q> Xq> Wx | D] } |  i i |  qď Wq" W|  i |  _ |  i S(   sn   
        Sort the list based on dependancies.
        @return: The sorted items.
        @rtype: list
        i   s   "%s" not found, skippedN(   t   listR
   R   R   R   t   pusht   lenR   t   topt   nextR   t   getR	   t   logt   debugt   Reprt   StopIterationR   t   pop(   R   R   t   poppedR   t   reft   refdt   p(    (    sO   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/deplist.pyt   sortB   s0    
   c         C   s   |  i  d S(   ss   
        Get the item at the top of the stack.
        @return: The top item.
        @rtype: (item, iter)
        i˙˙˙˙(   R   (   R   (    (    sO   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/deplist.pyR   ^   s    c         C   sO   | |  i  j o d S| t | d  f } |  i i |  |  i  i |  d S(   sş   
        Push and item onto the sorting stack.
        @param item: An item to push.
        @type item: I{item}
        @return: The number of items pushed.
        @rtype: int
        Ni   (   R   t   iterR   R   R   (   R   R   t   frame(    (    sO   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/deplist.pyR   f   s
    c         C   s)   y |  i  i   } | d SWn n Xd S(   s   
        Pop the top item off the stack and append
        it to the sorted list.
        @return: The popped item.
        @rtype: I{item}
        i    N(   R   R   (   R   R#   (    (    sO   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/deplist.pyR   t   s
    (	   t   __name__t
   __module__t   __doc__R   R   R!   R   R   R   (    (    (    sO   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/deplist.pyR      s   					t   __main__t   at   xt   bt   ct   dt   et   fi    N(    (   R)   (   R(   (   R(   R*   (   R+   (   R,   R(   (   R-   R+   R,   R(   (    (   R&   t   loggingR    t   sudsR$   R   R   R(   R*   R+   R,   R-   R.   R)   t   LR   t   _[1]R!   (    (    (    sO   /usr/local/lib/python2.6/dist-packages/suds-0.3.7-py2.6.egg/suds/xsd/deplist.pyt   <module>   s   
g	