
    Xi'                       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	  / 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)Requirement)CyclicDependencyGroupDependencyGroupIncludeDependencyGroupResolverDuplicateGroupNamesInvalidDependencyGroupObjectresolve_dependency_groupsc                     [         $ N)__all__     N/var/www/html/venv/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      zU
The same dependency groups were defined twice, with different non-normalized names.
r   N__name__
__module____qualname____firstlineno____doc____static_attributes__r   r   r   r   r      s    r   r   c                  0   ^  \ rS rSrSrSU 4S jjrSrU =r$ )r	   "   z-
The dependency group includes form a cycle.
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   )r$   r%   r#   )r#   strr$   r,   r%   r,   returnNone)r   r   r   r   r   r'   r   __classcell__)r*   s   @r   r	   r	   "   s    
 
r   r	   c                      \ rS rSrSrSrg)r   9   zY
A member of a dependency group was identified as a dict, but was not in a valid
format.
r   Nr   r   r   r   r   r   9   s    r   r   c                  ,    \ rS rSrSrSS jrSS jrSrg)r
   E   r%   c                    Xl         g)zp
Initialize a DependencyGroupInclude.

:param include_group: The name of the group referred to by this include.
Nr4   )r(   r%   s     r   r'   DependencyGroupInclude.__init__H   s
     +r   c                P    U R                   R                   SU R                  < S3$ )N())r*   r   r%   )r(   s    r   __repr__DependencyGroupInclude.__repr__P   s'    ..))*!D,>,>+ACCr   N)r%   r,   r-   r.   )r-   r,   )r   r   r   r   	__slots__r'   r:   r   r   r   r   r
   r
   E   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   T   a@  
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                    [        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(   rA   errorss      r   r'    DependencyGroupResolver.__init__`   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$   rF   s      r   lookupDependencyGroupResolver.lookups   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
rI   rJ   N)rK   r   rL   _resolverN   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: )rD   rM   
isinstancer   appendr
   rK   r%   rC   geterrorr	   extendrR   NotImplementedErrorrF   tuple)r(   r$   r#   rF   parsedresolved_groupitemr%   s           r   rR    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                p   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 H  n[	        U[
        5      (       a  UR                  [        U5      5        M4  [	        U[        5      (       a\  [        UR                  5       5      S:w  a   UR                  [        SU< 35      5        M  US	   nUR                  [        US
95        M  UR                  [        SU< 35      5        M     [        U5      U R                   U'   U R                   U   $ )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: rb   r4   )rB   rA   rY   LookupErrorrV   r,   	TypeErrorr   rW   r   r   r\   keysr   r
   )r(   r$   rF   	raw_groupelementsr_   r%   s          r   rM   $DependencyGroupResolver._parse_group   s    '''&&u--...LL'9%%LMN**51	i%%LL'y0WX
 )X..LL-eY6NOP ?AD$$$ D 12D'**%);;LL4=dXF %)$9MOO$:$WXY)H'QRS# & &+8_E"""5))r   )rC   rB   rD   rA   N)rA   /Mapping[str, Sequence[str | Mapping[str, str]]]r-   r.   )r$   r,   r-   0tuple[Requirement | DependencyGroupInclude, ...])r$   r,   r-   tuple[Requirement, ...])r$   r,   r#   r,   rF   r   r-   rk   )r$   r,   rF   r   r-   rj   )r   r   r   r   r   r'   rO   rS   rR   rM   r   r   r   r   r   r   T   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
c              3  l   >#    U  H)  nTR                  U5        H  n[        U5      v   M     M+     g 7fr   )rS   r,   ).0r$   rresolvers      r   	<genexpr>,resolve_dependency_groups.<locals>.<genexpr>
  s+     MVEX5E5Ee5LQ5LVs   14)r   r\   )rA   groupsrp   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   rK   rK     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"   r9   )itemsrK   
setdefaultrW   lenrY   r   join)	rA   rF   original_namesnormalized_groups
group_namevaluenormed_group_namenormed_namenamess	            r   r@   r@     s     ,.NFH.446
+J7!!"3R8??
K/4+, 7
 -224u:>LL#8"m2dii&6%7q: 5 r   )r-   z	list[str])rA   ri   rs   r,   r-   ztuple[str, ...])ry   r,   r-   r,   )rA   ri   rF   r   r-   z,dict[str, Sequence[str | Mapping[str, str]]])
__future__r   recollections.abcr   r   rF   r   requirementsr   r   r   
ValueErrorr   r	   r   r
   r   r   compilerv   rK   r@   r   r   r   <module>r      s    " 	 - # %* 
J 
.: D Dc* c*VNFNTWNN& ZZ	* 5F 2r   