o
    j'                     @  s   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	 g dZ
d&d
dZG dd deZG dd deZG dd deZG dd dZG dd dZd'ddZedZd(dd Zd)d$d%ZdS )*    )annotationsN)MappingSequence   )_ErrorCollector)Requirement)CyclicDependencyGroupDependencyGroupIncludeDependencyGroupResolverDuplicateGroupNamesInvalidDependencyGroupObjectresolve_dependency_groupsreturn	list[str]c                   C  s   t S N)__all__ r   r   h/var/www/html/Deteccion_Ine/venv/lib/python3.10/site-packages/pip/_vendor/packaging/dependency_groups.py__dir__   s   r   c                   @     e Zd ZdZdS )r   z]
    The same dependency groups were defined twice, with different non-normalized names.
    N__name__
__module____qualname____doc__r   r   r   r   r          r   c                      s"   e Zd ZdZd
 fdd	Z  ZS )r   z5
    The dependency group includes form a cycle.
    requested_groupstrgroupinclude_groupr   Nonec                   s\   || _ || _|| _||kr| d}n| d| d| d| }t d| d|  d S )Nz includes itselfz -> , z0Cyclic dependency group include while resolving z: )r   r   r   super__init__)selfr   r   r   reason	__class__r   r   r#   '   s   zCyclicDependencyGroup.__init__)r   r   r   r   r   r   r   r    )r   r   r   r   r#   __classcell__r   r   r&   r   r   "   s    r   c                   @  r   )r   ze
    A member of a dependency group was identified as a dict, but was not in a valid
    format.
    Nr   r   r   r   r   r   9   r   r   c                   @  s$   e Zd ZdZdddZddd	Zd
S )r	   r   r   r   r   r    c                 C  s
   || _ dS )z
        Initialize a DependencyGroupInclude.

        :param include_group: The name of the group referred to by this include.
        Nr)   )r$   r   r   r   r   r#   H   s   
zDependencyGroupInclude.__init__c                 C  s   | j j d| jdS )N())r'   r   r   )r$   r   r   r   __repr__P   s   zDependencyGroupInclude.__repr__N)r   r   r   r    )r   r   )r   r   r   	__slots__r#   r,   r   r   r   r   r	   E   s    
r	   c                   @  sB   e Zd ZdZdddZdddZdddZdddZdddZdS )r
   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]``.
    dependency_groups/Mapping[str, Sequence[str | Mapping[str, str]]]r   r    c                 C  s2   t  }t||| _i | _i | _i | _|d d S )Nz$[dependency-groups] data was invalid)r   _normalize_group_namesr.   _parsed_groups_include_graph_ancestors_resolve_cachefinalize)r$   r.   errorsr   r   r   r#   `   s   z DependencyGroupResolver.__init__r   r   0tuple[Requirement | DependencyGroupInclude, ...]c                 C  sL   t |}t d|d}| ||W  d   S 1 sw   Y  dS )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   r5   r   r   r   lookups   s   

$zDependencyGroupResolver.lookuptuple[Requirement, ...]c                 C  sN   t |}t d|d}| |||W  d   S 1 s w   Y  dS )z
        Resolve a dependency group to a list of requirements.

        :param group: the name of the group to resolve
        r7   r8   N)r9   r   r:   _resolver<   r   r   r   resolve   s   
$zDependencyGroupResolver.resolver   r5   r   c                 C  s   || j v r
| j | S | ||}g }|D ]K}t|tr!|| qt|trYt|j}|| j	|dv r?|
t|||j qg | j	|d|R | j|< || ||| qtd| |jredS 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: )r3   r;   
isinstancer   appendr	   r9   r   r2   geterrorr   extendr?   NotImplementedErrorr5   tuple)r$   r   r   r5   parsedZresolved_groupitemr   r   r   r   r?      s<   





z DependencyGroupResolver._resolvec                 C  s(  || j v r
| j | S || jvr|td| d dS | j| }t|tr3|td|d dS t|tsE|td|d dS g }|D ]>}t|trX|t	| qIt|t
r}t| dkrp|td| qI|d	 }|t|d
 qI|td| qIt|| j |< | j | S )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: rJ   r)   )r1   r.   rD   LookupErrorrA   r   	TypeErrorr   rB   r   r   rG   keysr   r	   )r$   r   r5   Z	raw_groupelementsrI   r   r   r   r   r;      sD   









z$DependencyGroupResolver._parse_groupN)r.   r/   r   r    )r   r   r   r6   )r   r   r   r>   )r   r   r   r   r5   r   r   r>   )r   r   r5   r   r   r6   )	r   r   r   r   r#   r=   r@   r?   r;   r   r   r   r   r
   T   s    



:r
   r.   r/   groupsr   tuple[str, ...]c                  s   t |  t fdd|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
    c                 3  s(    | ]}  |D ]}t|V  q	qd S r   )r@   r   ).0r   rresolverr   r   	<genexpr>
  s   & z,resolve_dependency_groups.<locals>.<genexpr>)r
   rG   )r.   rO   r   rS   r   r      s   
r   z[-_.]+namec                 C  s   t d|  S )N-)_NORMALIZE_PATTERNsublower)rV   r   r   r   r9     s   r9   r5   r   ,dict[str, Sequence[str | Mapping[str, str]]]c           	   
   C  s   i }i }|   D ]\}}t|}||g | |||< q|  D ]\}}t|dkr=|td| dd| d q"|S )Nr   z"Duplicate dependency group names: z (r!   r+   )itemsr9   
setdefaultrB   lenrD   r   join)	r.   r5   original_namesZnormalized_groups
group_namevalueZnormed_group_nameZnormed_namenamesr   r   r   r0     s&   
r0   )r   r   )r.   r/   rO   r   r   rP   )rV   r   r   r   )r.   r/   r5   r   r   r[   )
__future__r   recollections.abcr   r   r5   r   requirementsr   r   r   
ValueErrorr   r   r   r	   r
   r   compilerX   r9   r0   r   r   r   r   <module>   s"    

	 
,

