OwlCyberSecurity - MANAGER
Edit File: topological.cpython-312.pyc
� ̓�g� � � � d Z ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlmZ ddlm Z dd lm Z dd lmZ ddlmZ dd l mZ ddlmZ ede�� Zg d�Z dd�Z d dd�Z dd�Zdd�Zy)zTopological sorting algorithms.� )�annotations)�Any)� Collection)�DefaultDict)�Iterable)�Iterator)�Sequence)�Set)�Tuple)�TypeVar� )�util)�CircularDependencyError�_T)�bound)�sort�sort_as_subsets�find_cyclesc # � K � t j t � }| D ] \ }}|| j |� � t |� }t |� }|r~g }|D ]( }|j || � s�|j |� �* |s t dt | |� t |� � �|j |� |D � cg c] } | |v s�| �� }} |�� |r�}y y c c} w �w)NzCircular dependency detected.)r �defaultdict�set�add�list� isdisjoint�appendr r � _gen_edges�difference_update) �tuples�allitems�edges�parent�child�todo�todo_set�output�node�ts �L/opt/hc_python/lib64/python3.12/site-packages/sqlalchemy/util/topological.pyr r s� � �� � '+�&6�&6�s�&;�E�� ��� �e����� � � ��>�D��8�}�H� ����D��"�"�5��;�/�� � �d�#� � �)�/��F�H�-��5�!�� � �"�"�6�*��1�4�a�1��=��4��1��� �� 2�s% �A+C�.A C�8 C�C�C�Cc # �F K � t | |� D ] }|E d{ ��� � y7 ��w)a, sort the given list of items by dependency. 'tuples' is a list of tuples representing a partial ordering. deterministic_order is no longer used, the order is now always deterministic given the order of "allitems". the flag is there for backwards compatibility with Alembic. N)r )r r �deterministic_order�set_s r( r r : s# � �� � ���1����� 2��s �!��!c �� � t j t � }| D ] \ }}|| j |� � t |� }t � }|D ]� }|g}|j |� } |s�|d } || D ]d }||v r6||j |� d }| j |� |j |� || v s�B|j |� | j |� n |j � }|r���� |S )N���)r r r r � difference�indexr �updater �remove�pop)r r r r! r"