� ��^i����ddlZddlmZGd�de��ZGd�dej��ZGd�d e��ZGd �d e��Zd �Z dS) �N�)�collections_abcc�Z�eZdZdZd�Zd�Zd�Zd�Zd�Zd�Z d�Z d �Z d �Z d �Z d �Zd �ZdS)� DirectedGraphz&A graph structure with directed edges.c�H�t��|_i|_i|_dS�N)�set� _vertices� _forwards� _backwards��selfs ��/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/resolvelib/structs.py�__init__zDirectedGraph.__init__ s���������������c�*�t|j��Sr)�iterr r s r�__iter__zDirectedGraph.__iter__����D�N�#�#�#rc�*�t|j��Sr)�lenr r s r�__len__zDirectedGraph.__len__s���4�>�"�"�"rc��||jvSr)r �r�keys r� __contains__zDirectedGraph.__contains__s���d�n�$�$rc���t��}t|j��|_d�|j���D��|_d�|j���D��|_|S)z$Return a shallow copy of this graph.c�4�i|]\}}|t|����S��r ��.0�k�vs r� z&DirectedGraph.copy..s$��H�H�H���A�1�c�!�f�f�H�H�Hrc�4�i|]\}}|t|����Srr r!s rr%z&DirectedGraph.copy..s$��J�J�J�$�!�Q�A�s�1�v�v�J�J�Jr)rr r r �itemsr )r�others r�copyzDirectedGraph.copysh�������d�n�-�-���H�H���1E�1E�1G�1G�H�H�H���J�J�$�/�2G�2G�2I�2I�J�J�J���� rc���||jvrtd���|j�|��t��|j|<t��|j|<dS)zAdd a new vertex to the graph.z vertex existsN)r � ValueError�addr r r rs rr,zDirectedGraph.addsY�� �$�.� � ��_�-�-� -� ����3����!�e�e���s��"�u�u������rc�.�|j�|��|j�|��D]"}|j|�|���#|j�|��D]"}|j|�|���#dS)zCRemove a vertex from the graph, disconnecting all edges from/to it.N)r �remover �popr )rr�f�ts rr.zDirectedGraph.remove's��� ����c�"�"�"���#�#�C�(�(� +� +�A� �O�A� � %� %�c� *� *� *� *���$�$�S�)�)� *� *�A� �N�1� � $� $�S� )� )� )� )� *� *rc�>�||j|vo||j|vSr)r r �rr0r1s r� connectedzDirectedGraph.connected/s%���D�O�A�&�&�A�1���q�0A�+A�Arc��||jvrt|���|j|�|��|j|�|��dS)zgConnect two existing vertices. Nothing happens if the vertices are already connected. N)r �KeyErrorr r,r r3s r�connectzDirectedGraph.connect2sY�� �D�N� "� "��1�+�+� � ��q����a� � � � ������q�!�!�!�!�!rc#�^K�|j���D]\}}|D]}||fV�� �dSr)r r')rr0�childrenr1s r� iter_edgeszDirectedGraph.iter_edges<sT�����>�/�/�1�1� � �K�A�x�� � ����d� � � � � � � rc�6�t|j|��Sr)rr rs r� iter_childrenzDirectedGraph.iter_childrenAs���D�N�3�'�(�(�(rc�6�t|j|��Sr)rr rs r� iter_parentszDirectedGraph.iter_parentsDs���D�O�C�(�)�)�)rN)�__name__� __module__� __qualname__�__doc__rrrrr)r,r.r4r7r:r<r>rrrrrs�������0�0���� $�$�$�#�#�#�%�%�%����%�%�%�*�*�*�B�B�B�"�"�"���� )�)�)�*�*�*�*�*rrc�>�eZdZd d�Zd�Zd�ZeZd�Zd�Zd�Z d�Z dS) �IteratorMappingNc�4�||_||_|pi|_dSr)�_mapping� _accessor�_appends)r�mapping�accessor�appendss rrzIteratorMapping.__init__Is���� �!���� �2�� � � rc�N�d�|j|j|j��S)Nz!IteratorMapping({!r}, {!r}, {!r}))�formatrFrGrHr s r�__repr__zIteratorMapping.__repr__Ns)��2�9�9� �M� �N� �M� � � rc�8�t|jp|j��Sr)�boolrFrHr s r�__bool__zIteratorMapping.__bool__Us���D�M�2�T�]�3�3�3rc�&�||jvp||jvSr)rFrHrs rrzIteratorMapping.__contains__Zs���d�m�#�;�s�d�m�';�;rc��� |j|}n*#t$rt|j|��cYSwxYwt j|�|��|j�|d����S)Nr)rFr6rrH� itertools�chainrG�get)rr#r$s r� __getitem__zIteratorMapping.__getitem__]s{�� *�� �a� �A�A��� *� *� *��� �a�(�)�)� )� )� )� *������t�~�~�a�0�0�$�-�2C�2C�A�r�2J�2J�K�K�Ks � �$7�7c�^���fd��jD��}tj�j|��S)Nc3�.�K�|]}|�jv� |V��dSr�rF�r"r#rs �r� z+IteratorMapping.__iter__..es/�����C�C�a�A�T�]�,B�,B��,B�,B�,B�,B�C�Cr)rHrTrUrF�r�mores` rrzIteratorMapping.__iter__ds2���C�C�C�C�4�=�C�C�C����t�}�d�3�3�3rc�r��t�fd��jD����}t�j��|zS)Nc3�.�K�|]}|�jv� dV��dS)rNrZr[s �rr\z*IteratorMapping.__len__..is/�����F�F��q�� �/E�/E�1�/E�/E�/E�/E�F�Fr)�sumrHrrFr]s` rrzIteratorMapping.__len__hs<����F�F�F�F�d�m�F�F�F�F�F���4�=�!�!�D�(�(rr) r?r@rArrNrQ� __nonzero__rrWrrrrrrDrDHs�������&�&�&�&�  � � �4�4�4��K�<�<�<�L�L�L�4�4�4�)�)�)�)�)rrDc�.�eZdZdZd�Zd�Zd�ZeZd�ZdS)�_FactoryIterableViewa:Wrap an iterator factory returned by `find_matches()`. Calling `iter()` on this class would invoke the underlying iterator factory, making it a "collection with ordering" that can be iterated through multiple times, but lacks random access methods presented in built-in Python sequence types. c��||_dSr��_factory)r�factorys rrz_FactoryIterableView.__init__vs ���� � � rc��d�t|��jt|�������S�Nz{}({}))rM�typer?�listrgr s rrNz_FactoryIterableView.__repr__ys/�����t�D�z�z�2�D������4I�4I�J�J�Jrc�n� t|�����n#t$rYdSwxYwdS)NFT)�nextrg� StopIterationr s rrQz_FactoryIterableView.__bool__|sG�� � ������ !� !� !� !��� � � ��5�5� �����ts �!$� 2�2c�*�|���Srrfr s rrz_FactoryIterableView.__iter__�s���}�}���rN� r?r@rArBrrNrQrbrrrrrdrdmsd�������� � � �K�K�K�����K�����rrdc�.�eZdZdZd�Zd�Zd�ZeZd�ZdS)�_SequenceIterableViewz�Wrap an iterable returned by find_matches(). This is essentially just a proxy to the underlying sequence that provides the same interface as `_FactoryIterableView`. c��||_dSr)� _sequence)r�sequences rrz_SequenceIterableView.__init__�s ��!����rc�\�d�t|��j|j��Srj)rMrkr?rur s rrNz_SequenceIterableView.__repr__�s!�����t�D�z�z�2�D�N�C�C�Crc�*�t|j��Sr)rPrur s rrQz_SequenceIterableView.__bool__�rrc�*�t|j��Sr)rrur s rrz_SequenceIterableView.__iter__�rrNrqrrrrsrs�sd�������� "�"�"�D�D�D�$�$�$��K�$�$�$�$�$rrsc��t|��rt|��St|tj��st |��}t |��S)zCBuild an iterable view from the value returned by `find_matches()`.)�callablerd� isinstancer�Sequencerlrs)�matchess r�build_iter_viewr�sN������-�#�G�,�,�,� �g��7� 8� 8� ��w�-�-�� �� )� )�)r) rT�compatr�objectr�MappingrDrdrsrrrr�r�s�������#�#�#�#�#�#�?*�?*�?*�?*�?*�F�?*�?*�?*�D")�")�")�")�")�o�-�")�")�")�J�����6����8$�$�$�$�$�F�$�$�$�,*�*�*�*�*r