� ��^i�D���ddlZddlZddlmZddlmZmZmZejdddg��Z Gd�d e ��Z Gd �d e ��Z Gd �d e ��Z Gd�de��ZGd�de ��ZGd�de��ZGd�de��Zejdd��ZGd�de��Zd�Zejdd��Zd�ZGd�de��ZdS) �N�)�AbstractResolver)� DirectedGraph�IteratorMapping�build_iter_view�RequirementInformation� requirement�parentc��eZdZdZdS)�ResolverExceptionz�A base class for all exceptions raised by this module. Exceptions derived by this class should all be handled in this module. Any bubbling pass the resolver should be treated as a bug. N)�__name__� __module__� __qualname__�__doc__����/builddir/build/BUILDROOT/alt-python311-pip-21.3.1-4.el8.x86_64/opt/alt/python311/lib/python3.11/site-packages/pip/_vendor/resolvelib/resolvers.pyr r s���������rr c�$��eZdZ�fd�Zd�Z�xZS)�RequirementsConflictedc�f��tt|���|��||_dS�N)�superr�__init__� criterion)�selfr� __class__s �rrzRequirementsConflicted.__init__s-��� �$�d�+�+�4�4�Y�?�?�?�"����rc��d�d�d�|j���D������S)NzRequirements conflict: {}�, c3�4K�|]}t|��V��dSr��repr��.0�rs r� z1RequirementsConflicted.__str__..�(����I�I�!�d�1�g�g�I�I�I�I�I�Ir)�format�joinr�iter_requirement�rs r�__str__zRequirementsConflicted.__str__sF��*�1�1� �I�I�I�I�t�~�'F�'F�'H�'H�I�I�I� I� I� � � r�r rrrr+� __classcell__�rs@rrrsG�������#�#�#�#�#� � � � � � � rrc�$��eZdZ�fd�Zd�Z�xZS)�InconsistentCandidatec�v��tt|���||��||_||_dSr)rr0r� candidater)rr2rrs �rrzInconsistentCandidate.__init__!s6��� �#�T�*�*�3�3�I�y�I�I�I�"���"����rc��d�|jd�d�|j���D������S)Nz+Provided candidate {!r} does not satisfy {}rc3�4K�|]}t|��V��dSrr r"s rr%z0InconsistentCandidate.__str__..)r&r)r'r2r(rr)r*s rr+zInconsistentCandidate.__str__&sK��<�C�C� �N� �I�I�I�I�t�~�'F�'F�'H�'H�I�I�I� I� I� � � rr,r.s@rr0r0 sG�������#�#�#�#�#�  � � � � � � rr0c�*�eZdZdZd�Zd�Zd�Zd�ZdS)� CriterionaQRepresentation of possible resolution results of a package. This holds three attributes: * `information` is a collection of `RequirementInformation` pairs. Each pair is a requirement contributing to this criterion, and the candidate that provides the requirement. * `incompatibilities` is a collection of all known not-to-work candidates to exclude from consideration. * `candidates` is a collection containing all possible candidates deducted from the union of contributing requirements and known incompatibilities. It should never be empty, except when the criterion is an attribute of a raised `RequirementsConflicted` (in which case it is always empty). .. note:: This class is intended to be externally immutable. **Do not** mutate any of its attribute containers. c�0�||_||_||_dSr�� candidates� information�incompatibilities)rr9r:r;s rrzCriterion.__init__As��$���&���!2����rc�t�d�d�|jD����}d�|��S)Nrc3�HK�|]\}}d�||��V��dS)z({!r}, via={!r})N)r')r#�reqr s rr%z%Criterion.__repr__..GsJ����! �! ���V� � %� %�c�6� 2� 2�! �! �! �! �! �! rz Criterion({}))r(r:r')r� requirementss r�__repr__zCriterion.__repr__FsJ���y�y�! �! �#�/�! �! �! � � � ��%�%�l�3�3�3rc�$�d�|jD��S)Nc3�$K�|] }|jV�� dSr)r �r#�is rr%z-Criterion.iter_requirement..Ns$����8�8�!�� �8�8�8�8�8�8r�r:r*s rr)zCriterion.iter_requirementMs��8�8�t�'7�8�8�8�8rc�$�d�|jD��S)Nc3�$K�|] }|jV�� dSr�r rCs rr%z(Criterion.iter_parent..Qs$����3�3�Q���3�3�3�3�3�3rrEr*s r� iter_parentzCriterion.iter_parentPs��3�3�$�"2�3�3�3�3rN)r rrrrr@r)rIrrrr6r6-sZ��������&3�3�3� 4�4�4�9�9�9�4�4�4�4�4rr6c��eZdZdS)�ResolutionErrorN)r rrrrrrKrKTs�������DrrKc���eZdZ�fd�Z�xZS)�ResolutionImpossiblec�f��tt|���|��||_dSr)rrMr�causes)rrOrs �rrzResolutionImpossible.__init__Ys-��� �"�D�)�)�2�2�6�:�:�:��� � � r�r rrrr-r.s@rrMrMXs8���������������rrMc���eZdZ�fd�Z�xZS)�ResolutionTooDeepc�f��tt|���|��||_dSr)rrRr� round_count)rrTrs �rrzResolutionTooDeep.__init__`s0��� ���&�&�/�/� �<�<�<�&����rrPr.s@rrRrR_s8�������'�'�'�'�'�'�'�'�'rrR�Statez!mapping criteria backtrack_causesc�^�eZdZdZd�Zed���Zd�Zd�Zd�Z d�Z d�Z d �Z d �Z d �Zd S) � Resolutionz�Stateful resolution object. This is designed as a one-off object that holds information to kick start the resolution process, and holds the results afterwards. c�0�||_||_g|_dSr)�_p�_r�_states)r�provider�reporters rrzResolution.__init__ps���������� � � rc�X� |jdS#t$rtd���wxYw)N������state)r[� IndexError�AttributeErrorr*s rr`zResolution.stateus=�� *��<��#� #��� *� *� *� ��)�)� )� *���s� �)c���|jd}t|j���|j���|jdd����}|j�|��dS)z�Push a new state into history. This new state will be used to hold resolution results of the next coming round. r_N��mapping�criteria�backtrack_causes)r[rUre�copyrfrg�append)r�baser`s r�_push_new_statezResolution._push_new_state|ss�� �|�B�����L�%�%�'�'��]�'�'�)�)�!�2�1�1�1�5� � � �� � ���E�"�"�"�"�"rc ��|j�||���|j�|���}|�|��}|rt |j��}ng}|j�|t|tj d��||gi��t|tj d��||i�����}|r8t |j ��}|� t||����nt||��g}tt!|��||���}|jst%|���|||<dS)N)r r )�requirement_or_candidater)r;�� identifierr?r;r8)rZ�adding_requirementrY�identify�get�listr;� find_matchesr�operator� methodcaller� attrgetterr:rirr6rr9r) rrfr r rorr;�matchesr:s r�_add_to_criteriazResolution._add_to_criteria�sy�� ��"�"�{�6�"�J�J�J��W�%�%�{�%�K�K� ��L�L��,�,� � � #� $�Y�%@� A� A� � � "� ��'�&�&�!�(���%�&8�9�9��k�]�+��� .���#�$7�8�8��.�/���'�  �  �� � H��y�4�5�5�K� � � �5�k�6�J�J� K� K� K� K�1�+�v�F�F�G�K��&�w�/�/�#�/� � � � � �#� 4�(��3�3� 3�(�����rc ��|j�||jjt |jjt jd����t |jjt jd����|jj���S)Nr9r:)ro� resolutionsr9r:rg) rY�get_preferencer`rerrfrurwrg)r�names r�_get_preferencezResolution._get_preference�s~���w�%�%��� �*�&�� �#��#�L�1�1���(�� �#��#�M�2�2���"�Z�8�&�  �  � rc���� �jj|�n#t$rYdSwxYwt��fd�|���D����S)NFc3�P�K�|] }�j�|����V��!dS�)r r2N�rY�is_satisfied_by)r#r$� current_pinrs ��rr%z8Resolution._is_current_pin_satisfying..�sL����� � �� �G� #� #��[� #� I� I� � � � � � r)r`re�KeyError�allr))rr}rr�s` @r�_is_current_pin_satisfyingz%Resolution._is_current_pin_satisfying�s����� ��*�,�T�2�K�K��� � � ��5�5� ����� � � � � ��/�/�1�1� � � � � � s �� %�%c��|jj���}|j�|���D]}|�|||����|S)N�r2rH)r`rfrhrY�get_dependenciesry)rr2rfr s r�_get_updated_criteriaz Resolution._get_updated_criteria�s_���:�&�+�+�-�-���7�3�3�i�3�H�H� K� K�K� � !� !�(�K� � !� J� J� J� J��rc�.����jj|}g}|jD]�� �����}n1#t$r$}|�|j��Yd}~�Bd}~wwxYwt��fd�|���D����}|st�|����j � �����jj� |���jj �|d����jj |<gcS|S)Nc3�P�K�|] }�j�|����V��!dSr�r�)r#r$r2rs ��rr%z7Resolution._attempt_to_pin_criterion..�sL����������'�'�A��'�K�K������rr�)r`rfr9r�rrirr�r)r0rZ�pinning�updatere�pop)rr}rrOrf�e� satisfiedr2s` @r�_attempt_to_pin_criterionz$Resolution._attempt_to_pin_criterion�sP�����J�'��-� ���"�-� � �I� ��5�5�i�@�@����)� � � �� � �a�k�*�*�*���������� ����������"�3�3�5�5������I�� B�+�I�y�A�A�A� �G�O�O�i�O� 0� 0� 0� �J� � &� &�x� 0� 0� 0� �J� � "� "�4�� .� .� .�'0�D�J� �t� $��I�I�I�� s�7� A%�A � A%c�����t�j��dkrӉjd=�j���}|j���\}}d�|j���D�����||gf���j� |�����fd�}�� ��|��}|rdSt�j��dk��dS)a�Perform backtracking. When we enter here, the stack is like this:: [ state Z ] [ state Y ] [ state X ] .... earlier states are irrelevant. 1. No pins worked for Z, so it does not have a pin. 2. We want to reset state Y to unpinned, and pin another candidate. 3. State X holds what state Y was before the pin, but does not have the incompatibility information gathered in state Y. Each iteration of the loop will: 1. Discard Z. 2. Discard Y but remember its incompatibility information gathered previously, and the failure we're dealing with right now. 3. Push a new state Y' based on X, and apply the incompatibility information from Y to Y'. 4a. If this causes Y' to conflict, we need to backtrack again. Make Y' the new Z and go back to step 2. 4b. If the incompatibilities apply cleanly, end backtracking. �r_c�@�g|]\}}|t|j��f��Sr)rsr;�r#�k�vs r� z)Resolution._backtrack..s<��-�-�-��A�q��D��,�-�-�.�-�-�-rr�c ����D�]\}}|s� �jj|}n#t$rY�)wxYw�j�|t �jjt jd����t �jjt jd��||i�����}t|��}|sdS|� |j ��t|t|j��|����jj|<��dS)Nr)r;rnFr8T)r`rfr�rYrtrrurvrwr�extendr;r6rsr:)r�r;rrxr9�incompatibilities_from_brokenrs ��r�_patch_criteriaz.Resolution._backtrack.._patch_criteria!s<���,I���(�A�(�,�!� �!�$(�J�$7��$:� � ��#�!�!�!� ��!����"�g�2�2�#$�%4� �J�/�$�1�2D�E�E�&�&�+:� �J�/�$�/�0C�D�D�� 1�2�+�+� 3� � �G�"1��!9�!9�J�%�%�$�u�u�%�,�,�Y�-H�I�I�I�-6�#-�$(��)>�$?�$?�*;�.�.�.�D�J�'��*�*� �ts �!� .�.TF) �lenr[r�re�popitemrf�itemsrirZ� backtrackingrk)r� broken_stater}r2r��successr�s` @r� _backtrackzResolution._backtrack�s$����4�$�,���1�$�$�� �R� � �<�+�+�-�-�L�*�2�:�:�<�<�O�D�)�-�-�(�1�7�7�9�9�-�-�-� )� *� 0� 0�$�� �1D� E� E� E� �G� � �9� � 5� 5� 5� � � � � � �> � � � "� "� "�%�o�'�'�G�� ��t�o�$�,���1�$�$�z�urc����jrtd����j���t t j��ig���g�_|D]P} ���jj |d����&#t$r}t|j j ���d}~wwxYw����t|��D�] }�j�|����fd��jj ���D��}|s)�j��j����jcSt'|�j���}��|��}|rK����} d�|D���jjdd�<| st�jj���n�����j�|�j� ����"t3|���) Nzalready resolvedrdrH)�indexc�F��g|]\}}��||���|��Sr)r�)r#�keyrrs �rr�z&Resolution.resolve..isC���!�!�!�"�C���6�6�s�I�F�F�!��!�!�!r)r`)r�c�&�g|]}|jD]}|���SrrE)r#�crDs rr�z&Resolution.resolve..|s;��2�2�2��q�}�2�2�23�A�2�2�2�2r)r�r`)r[� RuntimeErrorrZ�startingrU� collections� OrderedDictryr`rfrrMrr:rk�range�starting_roundr��ending�minr~r�r�rg� ending_roundrR) rr?� max_roundsr$r�� round_index�unsatisfied_namesr}�failure_causesr�s ` r�resolvezResolution.resolveMsW��� �<� 3��1�2�2� 2� ������� �#�/�1�1��!#� � � � �� �� D� D�A� D��%�%�d�j�&9�1�T�%�J�J�J�J��)� D� D� D�*�1�;�+B�C�C�C����� D���� ������ ��,�,�! F�! F�K� �G� "� "�� "� 5� 5� 5�!�!�!�!�&*�j�&9�&?�&?�&A�&A�!�!�!� �%� "�����T�Z��0�0�0��z�!�!�!��(�d�.B�C�C�C�D�!�;�;�D�A�A�N�� '��/�/�+�+��2�2�-�2�2�2�� �+�A�A�A�.� �L�.�t�z�/J�K�K�K�L��$�$�&�&�&� �G� � �{�$�*� � E� E� E� E�� �+�+�+s�"B� B*� B%�%B*N)r rrrr�propertyr`rkryr~r�r�r�r�r�rrrrWrWis��������� ��� �*�*��X�*� #� #� #�%)�%)�%)�N  �  �  � � � ���� "�"�"�HW�W�W�r<,�<,�<,�<,�<,rrWc�2�||vrdS||vrdS||���D]o} |t|��}n#t$rY�%wxYw||vr|�|��dSt ||||��r|�|��dS�pdS)NTF)rI�idr��add�_has_route_to_root)rfr��all_keys� connected�p�pkeys rr�r��s��� �i����t� �(����u� �c�]� &� &� (� (� � �� ��B�q�E�E�?�D�D��� � � � �H� ���� �9� � � �M�M�#� � � ��4�4� �h��h� � B� B� � �M�M�#� � � ��4�4� � �5s�A� A � A �Resultzmapping graph criteriac���|j}d�|���D��}d|td��<t��}|�d��dh�|j���D]�\}}t |j||���s�||vr|�|��|���D]X} |t|��}n#t$rY�%wxYw||vr|�|��|� ||���Y��t�fd�|���D��||j���S)Nc�4�i|]\}}t|��|��Sr)r�r�s r� z!_build_result..�s$��5�5�5�T�Q���1���q�5�5�5rc�$��i|] \}}|�v� ||�� Srr)r#r�r�r�s �rr�z!_build_result..�s$���D�D�D�$�!�Q�Q�)�^�^��A�^�^�^r)re�graphrf) rer�r�rr�rfr�rIr��connectr�) r`rer�r�r�rr�r�r�s @r� _build_resultr��sq����m�G�5�5�W�]�]�_�_�5�5�5�H��H�R��X�X�� �O�O�E� �I�I�d�O�O�O���I��.�.�.�0�0� %� %���Y�!�%�.�#�x��K�K� � � �e� � � �I�I�c�N�N�N��&�&�(�(� %� %�A� ���1�������� � � ��� �����5� � �� � �$���� �M�M�$�� $� $� $� $� %� �D�D�D�D�'�-�-�/�/�D�D�D���� � � �s�C� C(�'C(c��eZdZdZeZdd�ZdS)�Resolverz3The thing that performs the actual resolution work.�dc��t|j|j��}|�||���}t |��S)aTake a collection of constraints, spit out the resolution result. The return value is a representation to the final resolution result. It is a tuple subclass with three public members: * `mapping`: A dict of resolved candidates. Each key is an identifier of a requirement (as returned by the provider's `identify` method), and the value is the resolved candidate. * `graph`: A `DirectedGraph` instance representing the dependency tree. The vertices are keys of `mapping`, and each edge represents *why* a particular package is included. A special vertex `None` is included to represent parents of user-supplied requirements. * `criteria`: A dict of "criteria" that hold detailed information on how edges in the graph are derived. Each key is an identifier of a requirement, and the value is a `Criterion` instance. The following exceptions may be raised if a resolution cannot be found: * `ResolutionImpossible`: A resolution cannot be found for the given combination of requirements. The `causes` attribute of the exception is a list of (requirement, parent), giving the requirements that could not be satisfied. * `ResolutionTooDeep`: The dependency tree is too deeply nested and the resolver gave up. This is usually caused by a circular dependency, but you can try to resolve this by increasing the `max_rounds` argument. )r�)rWr\r]r�r�)rr?r�� resolutionr`s rr�zResolver.resolve�s=��8 �� �t�}�=�=� ��"�"�<�J�"�G�G���U�#�#�#rN)r�)r rrrr �base_exceptionr�rrrr�r��s3������=�=�&�N�$�$�$�$�$�$rr�)r�ru� providersr�structsrrr� namedtupler� Exceptionr rr0�objectr6rKrMrRrUrWr�r�r�r�rrr�r�sI����������'�'�'�'�'�'�D�D�D�D�D�D�D�D�D�D�0��/��}�h�7���� ����� ���� � � � � �.� � � �  �  �  �  �  �-�  �  �  �$4�$4�$4�$4�$4��$4�$4�$4�N � � � � �'� � � ������?����'�'�'�'�'��'�'�'� � ��w�(K�L�L��`,�`,�`,�`,�`,��`,�`,�`,�F ���& �� ��*B� C� C�����<#$�#$�#$�#$�#$��#$�#$�#$�#$�#$r