Viewing File: /opt/hc_python/lib/python3.12/site-packages/packaging/__pycache__/dependency_groups.cpython-312.pyc

�

`�*j�'���ddlmZddlZddlmZmZddlmZddlm	Z	gd�Z
dd�ZGd	�d
e�Z
Gd�de�ZGd
�de�ZGd�d�ZGd�d�Z						dd�Zej&d�Zdd�Z						dd�Zy)�)�annotationsN)�Mapping�Sequence�)�_ErrorCollector)�Requirement)�CyclicDependencyGroup�DependencyGroupInclude�DependencyGroupResolver�DuplicateGroupNames�InvalidDependencyGroupObject�resolve_dependency_groupsc��tS�N)�__all__���J/opt/hc_python/lib/python3.12/site-packages/packaging/dependency_groups.py�__dir__rs���Nrc��eZdZdZy)rz]
    The same dependency groups were defined twice, with different non-normalized names.
    N��__name__�
__module__�__qualname__�__doc__rrrrrs��rrc�$��eZdZdZd�fd�Z�xZS)r	z5
    The dependency group includes form a cycle.
    c���||_||_||_||k(r|�d�}n
|�d|�d|�d|��}t�|�d|�d|���y)Nz includes itselfz -> �, z0Cyclic dependency group include while resolving z: )�requested_group�group�
include_group�super�__init__)�selfrr r!�reason�	__class__s     �rr#zCyclicDependencyGroup.__init__'sl���.�����
�*����E�!��w�.�/�F�%��d�5�'��E�7�$�}�o�N�F�
���>���r�&��
+�	
r)r�strr r'r!r'�return�None)rrrrr#�
__classcell__)r&s@rr	r	"s����
�
rr	c��eZdZdZy)r
ze
    A member of a dependency group was identified as a dict, but was not in a valid
    format.
    Nrrrrr
r
9s��rr
c� �eZdZdZdd�Zdd�Zy)r
�r!c��||_y)z�
        Initialize a DependencyGroupInclude.

        :param include_group: The name of the group referred to by this include.
        Nr-)r$r!s  rr#zDependencyGroupInclude.__init__Hs��+��rc�N�|jj�d|j�d�S)N�(�))r&rr!)r$s r�__repr__zDependencyGroupInclude.__repr__Ps'���.�.�)�)�*�!�D�,>�,>�+A��C�CrN)r!r'r(r))r(r')rrr�	__slots__r#r2rrrr
r
Es��"�I�+�Drr
c�\�eZdZdZ				dd�Zd	d�Zd
d�Z								dd�Z						dd�Zy)
ra\
    A resolver for Dependency Group data.

    This class handles caching, name normalization, cycle detection, and other
    parsing requirements. There are only two public methods for exploring the data:
    ``lookup()`` and ``resolve()``.

    :param dependency_groups: A mapping, as provided via pyproject
        ``[dependency-groups]``.
    c��t�}t||�|_i|_i|_i|_|j
d�y)Nz$[dependency-groups] data was invalid)r�_normalize_group_names�dependency_groups�_parsed_groups�_include_graph_ancestors�_resolve_cache�finalize)r$r7�errorss   rr#z DependencyGroupResolver.__init__`sJ��!�"��!7�8I�6�!R���

�	
��EG��%�BD������>�?rc��t|�}t�jd|�d��5}|j||�cddd�S#1swYyxYw)z�
        Lookup a group name, returning the parsed dependency data for that group.
        This will not resolve includes.

        :param group: the name of the group to lookup
        �[dependency-groups] data for � was malformedN)�_normalize_namer�on_exit�_parse_group�r$r r<s   r�lookupzDependencyGroupResolver.lookupssN�� ��&��
�
�
&�
&�+�E�9�N�C�
�
��$�$�U�F�3�
�
�
�s�A�Ac��t|�}t�jd|�d��5}|j|||�cddd�S#1swYyxYw)z
        Resolve a dependency group to a list of requirements.

        :param group: the name of the group to resolve
        r>r?N)r@rrA�_resolverCs   r�resolvezDependencyGroupResolver.resolve�sN�� ��&��
�
�
&�
&�+�E�9�N�C�
�
��=�=���v�6�
�
�
�s�A�Ac��||jvr|j|S|j||�}g}|D]�}t|t�r|j	|��%t|t
�r�t
|j�}||jj|d�vr'|jt|||j����g|jj|d��|��|j|<|j|j|||����td|����|jryt!|�|j|<|j|S)a�
        This is a helper for cached resolution to strings. It preserves the name of the
        group which the user initially requested in order to present a clearer error in
        the event that a cycle is detected.

        :param group: The normalized name of the group to resolve.
        :param requested_group: The group which was used in the original, user-facing
            request.
        rz+Invalid dependency group item after parse: )r:rB�
isinstancer�appendr
r@r!r9�get�errorr	�extendrF�NotImplementedErrorr<�tuple)r$r rr<�parsed�resolved_group�itemr!s        rrFz DependencyGroupResolver._resolve�sY���D�'�'�'��&�&�u�-�-��"�"�5�&�1�����D��$��,��%�%�d�+��D�"8�9� /��0B�0B� C�
�!�D�$A�$A�$E�$E�e�R�$P�P��L�L�-�+�U�D�4F�4F���D��6�6�:�:�5�"�E�D��D�D�1�1�-�@�#�)�)��
�
�m�_�f�M��*�A�$��H���5�B�=�=��%*�>�%:����E�"��"�"�5�)�)rc�6�||jvr|j|S||jvr|jtd|�d���y|j|}t	|t
�r|jt
d|�d���yt	|t�s|jt
d|�d���yg}|D]�}t	|t
�r|jt|���.t	|t�r[t|j��dk7r|jtd|�����x|d	}|jt|�
����|jt
d|������t|�|j|<|j|S)NzDependency group 'z' not foundrzDependency group z' contained a string rather than a list.z is not a sequence type.)�
include-groupzInvalid dependency group item: rTr-)r8r7rL�LookupErrorrIr'�	TypeErrorrrJrrrO�keysr
r
)r$r r<�	raw_group�elementsrRr!s       rrBz$DependencyGroupResolver._parse_group�s����D�'�'�'��&�&�u�-�-���.�.�.��L�L��'9�%���%L�M�N���*�*�5�1�	��i��%��L�L��'��y�0W�X��
�
��)�X�.��L�L��-�e�Y�6N�O�P�
��?A���D��$��$�����D� 1�2��D�'�*������%�);�;��L�L�4�=�d�X�F���%)��$9�M��O�O�$:��$W�X����Y�)H���'Q�R�S�#�&&+�8�_����E�"��"�"�5�)�)rN)r7�/Mapping[str, Sequence[str | Mapping[str, str]]]r(r))r r'r(�0tuple[Requirement | DependencyGroupInclude, ...])r r'r(�tuple[Requirement, ...])r r'rr'r<rr(r\)r r'r<rr(r[)	rrrrr#rDrGrFrBrrrrrTsn��	�@�J�@�
�@�&4�7�8*��8*�+.�8*�8G�8*�	 �8*�t/*��/*�"1�/*�	9�/*rrc�B��t|��t�fd�|D��S)z�
    Resolve a dependency group to a tuple of requirements, as strings.

    :param dependency_groups: the parsed contents of the ``[dependency-groups]`` table
        from ``pyproject.toml``
    :param groups: the name of the group(s) to resolve
    c3�`�K�|]%}�j|�D]}t|�����'y�wr)rGr')�.0r �r�resolvers   �r�	<genexpr>z,resolve_dependency_groups.<locals>.<genexpr>
s*�����M�V�E�X�5E�5E�e�5L���Q��5L��V�s�+.)rrO)r7�groupsras  @rrr�s!���'�'8�9�H��M�V�M�M�Mrz[-_.]+c�J�tjd|�j�S)N�-)�_NORMALIZE_PATTERN�sub�lower)�names rr@r@s���!�!�#�t�,�2�2�4�4rc�N�i}i}|j�D]6\}}t|�}|j|g�j|�|||<�8|j�D]D\}}t	|�dkDs�|jt
d|�ddj|��d����F|S)Nrz"Duplicate dependency group names: z (rr1)�itemsr@�
setdefaultrJ�lenrLr�join)	r7r<�original_names�normalized_groups�
group_name�value�normed_group_name�normed_name�namess	         rr6r6s���,.�N�FH��.�4�4�6��
�E�+�J�7���!�!�"3�R�8�?�?�
�K�/4��+�,�7�
-�2�2�4���U��u�:��>��L�L�#�8�"�m�2�d�i�i��&6�%7�q�:��
�5��r)r(z	list[str])r7rZrcr'r(ztuple[str, ...])rir'r(r')r7rZr<rr(z,dict[str, Sequence[str | Mapping[str, str]]])�
__future__r�re�collections.abcrrr<r�requirementsrrr�
ValueErrorrr	r
r
rr�compilerfr@r6rrr�<module>r|s���"�	�-�#�%�����*��
�J�
�.�:��D�D�c*�c*�VN�F�N�TW�N��N�& �R�Z�Z�	�*��5��F����2�r
Back to Directory File Manager