
    ցj+                       S SK Jr  S SKrS SKJrJr  SSKJr  SSKJ	r	J
r
  / SQrSS jr " S	 S
\5      r " S S\5      r " S S\5      r " S S5      r " S S5      r      SS jr\R(                  " S5      rSS jr      SS jrg)    )annotationsN)MappingSequence   )_ErrorCollector)InvalidRequirementRequirement)CyclicDependencyGroupDependencyGroupIncludeDependencyGroupResolverDuplicateGroupNamesInvalidDependencyGroupObjectresolve_dependency_groupsc                     [         $ N)__all__     U/mnt/workspace/venv-train/lib/python3.13/site-packages/packaging/dependency_groups.py__dir__r      s    Nr   c                      \ rS rSrSrSrg)r      zm
The same dependency groups were defined twice, with different non-normalized names.

.. versionadded:: 26.1
r   N__name__
__module____qualname____firstlineno____doc____static_attributes__r   r   r   r   r      s    r   r   c                  :   ^  \ rS rSrSrSU 4S jjrSS jrSrU =r$ )r
   $   zE
The dependency group includes form a cycle.

.. versionadded:: 26.1
c                   > Xl         X l        X0l        X2:X  a  U S3nOU SU SU SU 3n[        TU ]  SU SU 35        g )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(   CyclicDependencyGroup.__init__+   sd    .
*!w./F%d5'E7$}oNF>r&+	
r   c                `    U R                   U R                  U R                  U R                  44$ r   )r+   r$   r%   r&   r)   s    r   
__reduce__ CyclicDependencyGroup.__reduce__:   s(    !5!5tzz4CUCU VWWr   )r%   r&   r$   )r$   strr%   r1   r&   r1   returnNone)r2   z8tuple[type[CyclicDependencyGroup], tuple[str, str, str]])	r   r   r   r   r   r(   r/   r   __classcell__)r+   s   @r   r
   r
   $   s    
X Xr   r
   c                      \ rS rSrSrSrg)r   A   zq
A member of a dependency group was identified as a dict, but was not in a valid
format.

.. versionadded:: 26.1
r   Nr   r   r   r   r   r   A   s    r   r   c                  0    \ rS rSrSrSrSS jrSS jrSrg)	r   O   zJ
A reference to another dependency group by name.

.. versionadded:: 26.1
r&   c                    Xl         g)zp
Initialize a DependencyGroupInclude.

:param include_group: The name of the group referred to by this include.
Nr9   )r)   r&   s     r   r(   DependencyGroupInclude.__init__X   s
     +r   c                P    U R                   R                   SU R                  < S3$ )N())r+   r   r&   r.   s    r   __repr__DependencyGroupInclude.__repr__`   s'    ..))*!D,>,>+ACCr   N)r&   r1   r2   r3   )r2   r1   )	r   r   r   r   r   	__slots__r(   r?   r   r   r   r   r   r   O   s     #I+Dr   r   c                  n    \ rS rSrSr    S
S jrSS jrSS jr        SS jr      SS jr	Sr
g	)r   d   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                    [        5       n[        X5      U l        0 U l        0 U l        0 U l        UR                  S5        g )Nz$[dependency-groups] data was invalid)r   _normalize_group_namesdependency_groups_parsed_groups_include_graph_ancestors_resolve_cachefinalize)r)   rF   errorss      r   r(    DependencyGroupResolver.__init__r   sH     !"!78I!R
  	 EG%BD>?r   c                    [        U5      n[        5       R                  SU< S35       nU R                  X5      sSSS5        $ ! , (       d  f       g= f)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%   rK   s      r   lookupDependencyGroupResolver.lookup   sL      &&&+E9NC
$$U3
 
 
s   A
Ac                    [        U5      n[        5       R                  SU< S35       nU R                  XU5      sSSS5        $ ! , (       d  f       g= f)zg
Resolve a dependency group to a list of requirements.

:param group: the name of the group to resolve
rN   rO   N)rP   r   rQ   _resolverS   s      r   resolveDependencyGroupResolver.resolve   sL      &&&+E9NC
==v6
 
 
s   A
Ac                   XR                   ;   a  U R                   U   $ U R                  X5      n/ nU H  n[        U[        5      (       a  UR	                  U5        M+  [        U[
        5      (       a  [        UR                  5      nXpR                  R                  US5      ;   a'  UR                  [        X!UR                  5      5        M  / U R                  R                  US5      QUP7U R                  U'   UR                  U R                  XrU5      5        M  [        SU 35      e   UR                  (       a  g[!        U5      U R                   U'   U R                   U   $ )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: )rI   rR   
isinstancer	   appendr   rP   r&   rH   geterrorr
   extendrW   NotImplementedErrorrK   tuple)r)   r%   r$   rK   parsedresolved_groupitemr&   s           r   rW    DependencyGroupResolver._resolve   sU    '''&&u--""51D$,,%%d+D"899 /0B0B C !$A$A$E$EeR$PPLL-+D4F4FD66::5"EDDD11-@ #))mfM *A$H 5 B ==%*>%:E"""5))r   c                h   XR                   ;   a  U R                   U   $ XR                  ;  a  UR                  [        SU S35      5        gU R                  U   n[	        U[
        5      (       a   UR                  [        SU< S35      5        g[	        U[        5      (       d   UR                  [        SU< S35      5        g/ nU GH  n[	        U[
        5      (       a:  UR                  [        5         UR                  [        U5      5        S S S 5        MS  [	        U[        5      (       a  [        UR                  5       5      S:w  a   UR                  [        SU< 35      5        M  US	   n[	        U[
        5      (       d"  S
U< 3nUR                  [        U5      5        M  UR                  [!        US95        M  UR                  [        SU< 35      5        GM     UR"                  (       a  g[        U5      U R                   U'   U R                   U   $ ! , (       d  f       GMg  = f)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: rg   z6Dependency group include-group value is not a string: r9   )rG   rF   r^   LookupErrorr[   r1   	TypeErrorr   collectr   r\   r	   r   ra   keysr   r   rK   )r)   r%   rK   	raw_groupelementsrd   r&   msgs           r   rR   $DependencyGroupResolver._parse_group   s    '''&&u--...LL'9%%LMN**51	i%%LL'y0WX
 )X..LL-eY6NOP ?AD$$$ ^^$67OOK$56 87D'**%);;LL4=dXF %)$9M%mS99T#h(  Ys^4 2O Y)H'QRS7 : ==%*8_E"""5))9 87s   8H!!
H1	)rH   rG   rI   rF   N)rF   /Mapping[str, Sequence[str | Mapping[str, str]]]r2   r3   )r%   r1   r2   0tuple[Requirement | DependencyGroupInclude, ...])r%   r1   r2   tuple[Requirement, ...])r%   r1   r$   r1   rK   r   r2   rr   )r%   r1   rK   r   r2   rq   )r   r   r   r   r   r(   rT   rX   rW   rR   r   r   r   r   r   r   d   sn    @J@ 
@&478*8*+.8*8G8*	 8*t<*<*"1<*	9<*r   r   c               D   ^ [        U 5      m[        U4S jU 5       5      $ )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

.. versionadded:: 26.1
c              3  l   >#    U  H)  nTR                  U5        H  n[        U5      v   M     M+     g 7fr   )rX   r1   ).0r%   rresolvers      r   	<genexpr>,resolve_dependency_groups.<locals>.<genexpr>+  s+     MVEX5E5Ee5LQ5LVs   14)r   ra   )rF   groupsrw   s     @r   r   r     s!     ''89HMVMMMr   z[-_.]+c                J    [         R                  SU 5      R                  5       $ )N-)_NORMALIZE_PATTERNsublower)names    r   rP   rP   6  s    !!#t,2244r   c                T   0 n0 nU R                  5        H5  u  pE[        U5      nUR                  U/ 5      R                  U5        XSU'   M7     UR                  5        HF  u  px[	        U5      S:  d  M  UR                  [        SU SSR                  U5       S35      5        MH     U$ )Nr   z"Duplicate dependency group names: z (r#   r>   )itemsrP   
setdefaultr\   lenr^   r   join)	rF   rK   original_namesnormalized_groups
group_namevaluenormed_group_namenormed_namenamess	            r   rE   rE   :  s     ,.NFH.446
+J7!!"3R8??
K/4+, 7
 -224u:>LL#8"m2dii&6%7q: 5 r   )r2   z	list[str])rF   rp   rz   r1   r2   ztuple[str, ...])r   r1   r2   r1   )rF   rp   rK   r   r2   z,dict[str, Sequence[str | Mapping[str, str]]])
__future__r   recollections.abcr   r   rK   r   requirementsr   r	   r   r   
ValueErrorr   r
   r   r   r   r   compiler}   rP   rE   r   r   r   <module>r      s    " 	 - # 9* XJ X:: D D*r* r*tNFNTWNN* ZZ	* 5F 2r   