
    #j+                       d dl mZ d dlZd dlmZmZ ddlmZ ddlm	Z	m
Z
 g dZddZ G d	 d
e      Z G d de      Z G d de      Z G d d      Z G d d      Z	 	 	 	 	 	 ddZ ej(                  d      ZddZ	 	 	 	 	 	 ddZy)    )annotationsN)MappingSequence   )_ErrorCollector)InvalidRequirementRequirement)CyclicDependencyGroupDependencyGroupIncludeDependencyGroupResolverDuplicateGroupNamesInvalidDependencyGroupObjectresolve_dependency_groupsc                     t         S N)__all__     _/var/www/oz-panel.ru/ozpay-pub/venv/lib/python3.12/site-packages/packaging/dependency_groups.py__dir__r      s    Nr   c                      e Zd ZdZy)r   zy
    The same dependency groups were defined twice, with different non-normalized names.

    .. versionadded:: 26.1
    N__name__
__module____qualname____doc__r   r   r   r   r      s    r   r   c                  ,     e Zd ZdZd fdZddZ xZS )r
   zQ
    The dependency group includes form a cycle.

    .. versionadded:: 26.1
    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__)selfr    r!   r"   reason	__class__s        r   r$   zCyclicDependencyGroup.__init__+   sl    .
*E!w./F%d5'E7$}oNF>r&+	
r   c                `    | j                   | j                  | j                  | j                  ffS r   )r'   r    r!   r"   r%   s    r   
__reduce__z CyclicDependencyGroup.__reduce__:   s(    !5!5tzz4CUCU VWWr   )r    strr!   r+   r"   r+   returnNone)r,   z8tuple[type[CyclicDependencyGroup], tuple[str, str, str]])r   r   r   r   r$   r*   __classcell__)r'   s   @r   r
   r
   $   s    
Xr   r
   c                      e Zd ZdZy)r   z
    A member of a dependency group was identified as a dict, but was not in a valid
    format.

    .. versionadded:: 26.1
    Nr   r   r   r   r   r   A   s    r   r   c                  $    e Zd ZdZdZddZddZy)r   zV
    A reference to another dependency group by name.

    .. versionadded:: 26.1
    r"   c                    || _         y)z
        Initialize a DependencyGroupInclude.

        :param include_group: The name of the group referred to by this include.
        Nr1   )r%   r"   s     r   r$   zDependencyGroupInclude.__init__X   s     +r   c                N    | j                   j                   d| j                  dS )N())r'   r   r"   r)   s    r   __repr__zDependencyGroupInclude.__repr__`   s'    ..))*!D,>,>+ACCr   N)r"   r+   r,   r-   )r,   r+   )r   r   r   r   	__slots__r$   r6   r   r   r   r   r   O   s     #I+Dr   r   c                  \    e Zd ZdZ	 	 	 	 ddZd	dZd
dZ	 	 	 	 	 	 	 	 ddZ	 	 	 	 	 	 ddZy)r   ax  
    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]``.

    .. versionadded:: 26.1
    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%   r;   errorss      r   r$   z DependencyGroupResolver.__init__r   sJ     !"!78I6!R
  	 EG%BD>?r   c                    t        |      }t               j                  d|d      5 }| j                  ||      cddd       S # 1 sw Y   yxY w)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   lookupzDependencyGroupResolver.lookup   sS      &&&+E9NC
 	4$$UF3	4 	4 	4s   AAc                    t        |      }t               j                  d|d      5 }| j                  |||      cddd       S # 1 sw Y   yxY w)z
        Resolve a dependency group to a list of requirements.

        :param group: the name of the group to resolve
        rB   rC   N)rD   r   rE   _resolverG   s      r   resolvezDependencyGroupResolver.resolve   sS      &&&+E9NC
 	7==v6	7 	7 	7s   AAc                   || j                   v r| j                   |   S | j                  ||      }g }|D ]  }t        |t              r|j	                  |       %t        |t
              rt        |j                        }|| j                  j                  |d      v r'|j                  t        |||j                               g | j                  j                  |d      || j                  |<   |j                  | j                  |||             t        d|        |j                  ryt!        |      | 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.
        r   z+Invalid dependency group item after parse: )r>   rF   
isinstancer	   appendr   rD   r"   r=   geterrorr
   extendrJ   NotImplementedErrorr@   tuple)r%   r!   r    r@   parsedresolved_groupitemr"   s           r   rJ   z DependencyGroupResolver._resolve   s^    D'''&&u--""5&1 	D$,%%d+D"89 /0B0B C !D$A$A$E$EeR$PPLL-+UD4F4FD66::5"EDDD11-@ #))m_fM *A$H 5	B ==%*>%:E"""5))r   c                
   || j                   v r| j                   |   S || j                  vr|j                  t        d| d             y| j                  |   }t	        |t
              r|j                  t        d|d             yt	        |t              s|j                  t        d|d             yg }|D ]  }t	        |t
              r9|j                  t              5  |j                  t        |             d d d        Mt	        |t              rt        |j                               dk7  r|j                  t        d|             |d	   }t	        |t
              s d
|}|j                  t        |             |j                  t!        |             |j                  t        d|              |j"                  ryt        |      | j                   |<   | j                   |   S # 1 sw Y   FxY w)NzDependency group 'z' not foundr   zDependency group z' contained a string rather than a list.z is not a sequence type.)include-groupzInvalid dependency group item: rX   z6Dependency group include-group value is not a string: r1   )r<   r;   rP   LookupErrorrM   r+   	TypeErrorr   collectr   rN   r	   r   rS   keysr   r   r@   )r%   r!   r@   	raw_groupelementsrV   r"   msgs           r   rF   z$DependencyGroupResolver._parse_group   s    D'''&&u--...LL'9%%LMN**51	i%LL'y0WX
 )X.LL-eY6NOP ?A 	TD$$ ^^$67 7OOK$567 7D'*%);;LL4=dXF %)$9M%mS9T#h(  Ys^4 2O Y)H'QRS7	T: ==%*8_E"""5))97 7s   %G88H	N)r;   /Mapping[str, Sequence[str | Mapping[str, str]]]r,   r-   )r!   r+   r,   0tuple[Requirement | DependencyGroupInclude, ...])r!   r+   r,   tuple[Requirement, ...])r!   r+   r    r+   r@   r   r,   rb   )r!   r+   r@   r   r,   ra   )	r   r   r   r   r$   rH   rK   rJ   rF   r   r   r   r   r   d   sn    @J@ 
@&478*8*+.8*8G8*	 8*t<*<*"1<*	9<*r   r   c               B    t        |       t        fd|D              S )a  
    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

    .. versionadded:: 26.1
    c              3  `   K   | ]%  }j                  |      D ]  }t        |        ' y wr   )rK   r+   ).0r!   rresolvers      r   	<genexpr>z,resolve_dependency_groups.<locals>.<genexpr>+  s,     MEX5E5Ee5LMQMMs   +.)r   rS   )r;   groupsrg   s     @r   r   r     s!     ''89HMVMMMr   z[-_.]+c                J    t         j                  d|       j                         S )N-)_NORMALIZE_PATTERNsublower)names    r   rD   rD   6  s    !!#t,2244r   c                N   i }i }| j                         D ]6  \  }}t        |      }|j                  |g       j                  |       |||<   8 |j                         D ]D  \  }}t	        |      dkD  s|j                  t        d| ddj                  |       d             F |S )Nr   z"Duplicate dependency group names: z (r   r5   )itemsrD   
setdefaultrN   lenrP   r   join)	r;   r@   original_namesnormalized_groups
group_namevaluenormed_group_namenormed_namenamess	            r   r:   r:   :  s     ,.NFH.446 5
E+J7!!"3R8??
K/4+,5
 -224 Uu:>LL#8"m2dii&6%7q: r   )r,   z	list[str])r;   r`   ri   r+   r,   ztuple[str, ...])ro   r+   r,   r+   )r;   r`   r@   r   r,   z,dict[str, Sequence[str | Mapping[str, str]]])
__future__r   recollections.abcr   r   r@   r   requirementsr   r	   r   r   
ValueErrorr   r
   r   r   r   r   compilerl   rD   r:   r   r   r   <module>r      s    " 	 - # 9* XJ X:: D D*r* r*tNFNTWNN*  RZZ	* 5F 2r   