File: //opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/topological.pyo
�
��4]c           @   sc   d  Z  d d l m Z d d l m Z d d d g Z e d � Z e d � Z d	 �  Z	 d
 �  Z
 d S(   s   Topological sorting algorithms.i   (   t   util(   t   CircularDependencyErrort   sortt   sort_as_subsetst   find_cyclesc   
      c   s�   t  j t � } x% |  D] \ } } | | j | � q W| rF t  j n t } | | � } x� | r� | �  } x1 | D]) }	 | j | |	 � rq | j |	 � qq qq W| s� t d t |  | � t | � � � n  | j	 | � | Vq[ Wd  S(   Ns   Circular dependency detected.(
   R    t   defaultdictt   sett   addt
   OrderedSett
   isdisjointR   R   t
   _gen_edgest   difference_update(
   t   tuplest   allitemst   deterministic_ordert   edgest   parentt   childt   Sett   todot   outputt   node(    (    sN   /opt/alt/python27/lib64/python2.7/site-packages/sqlalchemy/util/topological.pyR      s"