
    hi                        S SK Jr  S SKrS SKrS SKJr  S SKJr  SS jr    SS jr	\R                   " S S5      5       r " S	 S
\5      r " S S5      r      SS jrg)    )annotationsN)Mapping)Requirementc                N    [         R                  " SSU 5      R                  5       $ )Nz[-_.]+-)resublower)names    ڂC:\Users\ROHAN GUPTA\OneDrive\Desktop\mathbuddy-assessment\venv\Lib\site-packages\pip/_vendor/dependency_groups/_implementation.py_normalize_namer   
   s    66)S$'--//    c                   0 n0 nU R                  5        H5  u  p4[        U5      nUR                  U/ 5      R                  U5        XBU'   M7     / nUR                  5        H<  u  px[	        U5      S:  d  M  UR                  U SSR                  U5       S35        M>     U(       a  [        SSR                  U5       35      eU$ )N   z (, )z"Duplicate dependency group names: )itemsr   
setdefaultappendlenjoin
ValueError)	dependency_groupsoriginal_namesnormalized_groups
group_namevaluenormed_group_nameerrorsnormed_namenamess	            r   _normalize_group_namesr"      s     ,.N.446
+J7!!"3R8??
K/4+, 7
 F,224u:>MM[MDIIe,<+=Q?@ 5 =dii>O=PQRRr   c                       \ rS rSr% S\S'   Srg)DependencyGroupInclude#   strinclude_group N)__name__
__module____qualname____firstlineno____annotations____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$ )CyclicDependencyError(   z1
An error representing the detection of 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 -> r   z0Cyclic dependency group include while resolving z: )requested_groupgroupr'   super__init__)selfr3   r4   r'   reason	__class__s        r   r6   CyclicDependencyError.__init__-   sd    .
*!w./F%d5'E7$}oNF>r&+	
r   )r4   r'   r3   )r3   r&   r4   r&   r'   r&   returnNone)r)   r*   r+   r,   __doc__r6   r.   __classcell__)r9   s   @r   r0   r0   (   s    
 
r   r0   c                  Z    \ 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	)DependencyGroupResolver<   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                    [        U[        5      (       d  [        S5      e[        U5      U l        0 U l        0 U l        0 U l        g )Nz(Dependency Groups table is not a mapping)
isinstancer   	TypeErrorr"   r   _parsed_groups_include_graph_ancestors_resolve_cache)r7   r   s     r   r6    DependencyGroupResolver.__init__H   sM     +W55FGG!78I!J  	 EG%BDr   c                z    [        U[        5      (       d  [        S5      e[        U5      nU R	                  U5      $ )a  
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

:raises ValueError: if the data does not appear to be valid dependency group
    data
:raises TypeError: if the data is not a string
:raises LookupError: if group name is absent
:raises packaging.requirements.InvalidRequirement: if a specifier is not valid
"Dependency group name is not a str)rC   r&   rD   r   _parse_groupr7   r4   s     r   lookupDependencyGroupResolver.lookupX   s8     %%%@AA&  ''r   c                z    [        U[        5      (       d  [        S5      e[        U5      nU R	                  X5      $ )ax  
Resolve a dependency group to a list of requirements.

:param group: the name of the group to resolve

:raises TypeError: if the inputs appear to be the wrong types
:raises ValueError: if the data does not appear to be valid dependency group
    data
:raises LookupError: if group name is absent
:raises packaging.requirements.InvalidRequirement: if a specifier is not valid
rJ   )rC   r&   rD   r   _resolverL   s     r   resolveDependencyGroupResolver.resolvej   s6     %%%@AA&}}U**r   c                   XR                   ;   a  U R                   U   $ XR                  ;  a  [        SU S35      eU R                  U   n[        U[        5      (       d  [        SU S35      e/ nU H  n[        U[        5      (       a  UR                  [        U5      5        M4  [        U[        5      (       ag  [        UR                  5       5      S:w  a  [        SU 35      e[        [        UR                  5       5      5      nUR                  [!        US95        M  [        SU 35      e   [        U5      U R                   U'   U R                   U   $ )NzDependency group 'z' not foundz' is not a list)zinclude-groupzInvalid dependency group item: )r'   )rE   r   LookupErrorrC   listrD   r&   r   r   dicttuplekeysr   nextitervaluesr$   )r7   r4   	raw_groupelementsitemr'   s         r   rK   $DependencyGroupResolver._parse_group{   s8    '''&&u--... 25'EFF**51	)T**0GHH?AD$$$ D 12D$''%);;$'Ftf%MNN $T$++-%8 9 6] ST #B4&!IJJ  &+8_E"""5))r   c                   XR                   ;   a  U R                   U   $ U R                  U5      n/ nU H  n[        U[        5      (       a  UR	                  U5        M+  [        U[
        5      (       a  [        UR                  5      nX`R                  R                  US5      ;   a  [        X!UR                  5      e/ U R                  R                  US5      QUP7U R                  U'   UR                  U R                  Xb5      5        M  [        SU 35      e   [        U5      U R                   U'   U R                   U   $ )z
This is a helper for cached resolution to strings.

:param group: The 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: )rG   rK   rC   r   r   r$   r   r'   rF   getr0   extendrP   NotImplementedErrorrW   )r7   r4   r3   parsedresolved_groupr^   r'   s          r   rP    DependencyGroupResolver._resolve   s:    '''&&u--""5)D$,,%%d+D"899 /0B0B C $A$A$E$EeR$PP/'0B0B @2266ubA@@--m< %%dmmM&ST)A$H  & &+>%:E"""5))r   )rF   rE   rG   r   N)r   %Mapping[str, str | Mapping[str, str]]r;   r<   )r4   r&   r;   z0tuple[Requirement | DependencyGroupInclude, ...])r4   r&   r;   tuple[Requirement, ...])r4   r&   r3   r&   r;   rh   )r)   r*   r+   r,   r=   r6   rM   rQ   rK   rP   r.   r(   r   r   r@   r@   <   sF    	E@E 
E ($+"**	9*B"*r   r@   c               D   ^ [        U 5      m[        U4S jU 5       5      $ )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

:raises TypeError: if the inputs appear to be the wrong types
:raises ValueError: if the data does not appear to be valid dependency group data
:raises LookupError: if group name is absent
:raises packaging.requirements.InvalidRequirement: if a specifier is not valid
c              3  l   >#    U  H)  nTR                  U5        H  n[        U5      v   M     M+     g 7f)N)rQ   r&   ).0r4   rresolvers      r   	<genexpr>resolve.<locals>.<genexpr>   s+     MVEX5E5Ee5LQ5LVs   14)r@   rW   )r   groupsrm   s     @r   rQ   rQ      s!     ''89HMVMMMr   )r   r&   r;   r&   )r   rg   r;   rg   )r   rg   rp   r&   r;   ztuple[str, ...])
__future__r   dataclassesr   collections.abcr   "pip._vendor.packaging.requirementsr   r   r"   	dataclassr$   r   r0   r@   rQ   r(   r   r   <module>rv      s    "  	 # :0<**   
J 
(B* B*JN<NJMNNr   