o
    !7h                     @  s^  d dl mZ d dlZd dlmZ d dlmZmZmZm	Z	m
Z
mZmZmZmZmZ edZedZedZee	e eg e	e f f Zerfdd	lmZ G d
d deeeef ZG dd deeeeef ZnedddgZedg dZG dd dee ZG dd deee
e f eeeef ZG dd de	e ZG dd de	e ZdddZe	ZdS )     )annotationsN)
namedtuple)
TYPE_CHECKINGCallableGenericIterableIteratorMapping
NamedTupleSequenceTypeVarUnionKTRTCT   )	Criterionc                   @  s   e Zd ZU ded< ded< dS )RequirementInformationr   requirementz	CT | NoneparentN)__name__
__module____qualname____annotations__ r   r   s/var/www/epreuve.sigeris.cm/public_html/epreuve/venv/lib/python3.10/site-packages/pip/_vendor/resolvelib/structs.pyr      s   
 r   c                   @  s*   e Zd ZU dZded< ded< ded< dS )	StatezResolution state in a round.zdict[KT, CT]mappingzdict[KT, Criterion[RT, CT]]criteriaz$list[RequirementInformation[RT, CT]]backtrack_causesN)r   r   r   __doc__r   r   r   r   r   r      s
   
 r   r   r   )r   r   r   c                   @  s   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+ddZ	d+ddZ
d,ddZd-ddZd.dd Zd/d!d"Zd/d#d$Zd%S )0DirectedGraphz&A graph structure with directed edges.returnNonec                 C  s   t  | _i | _i | _d S N)set	_vertices	_forwards
_backwardsselfr   r   r   __init__0   s   
zDirectedGraph.__init__Iterator[KT]c                 C  
   t | jS r$   )iterr&   r)   r   r   r   __iter__5      
zDirectedGraph.__iter__intc                 C  r-   r$   )lenr&   r)   r   r   r   __len__8   r0   zDirectedGraph.__len__keyr   boolc                 C  s
   || j v S r$   )r&   r*   r4   r   r   r   __contains__;   r0   zDirectedGraph.__contains__DirectedGraph[KT]c                 C  sF   t |  }t| j|_dd | j D |_dd | j D |_|S )z$Return a shallow copy of this graph.c                 S     i | ]	\}}|t |qS r   r%   .0kvr   r   r   
<dictcomp>B       z&DirectedGraph.copy.<locals>.<dictcomp>c                 S  r9   r   r:   r;   r   r   r   r?   C   r@   )typer%   r&   r'   itemsr(   )r*   otherr   r   r   copy>   s
   
zDirectedGraph.copyc                 C  s:   || j v r	td| j | t | j|< t | j|< dS )zAdd a new vertex to the graph.zvertex existsN)r&   
ValueErroraddr%   r'   r(   r6   r   r   r   rF   F   s
   
zDirectedGraph.addc                 C  sT   | j | | j|D ]
}| j| | q| j|D ]
}| j| | qdS )zCRemove a vertex from the graph, disconnecting all edges from/to it.N)r&   remover'   popr(   )r*   r4   ftr   r   r   rG   N   s   zDirectedGraph.removerI   rJ   c                 C  s   || j | v o|| j| v S r$   )r(   r'   r*   rI   rJ   r   r   r   	connectedV   s   zDirectedGraph.connectedc                 C  s6   || j vr	t|| j| | | j| | dS )zgConnect two existing vertices.

        Nothing happens if the vertices are already connected.
        N)r&   KeyErrorr'   rF   r(   rK   r   r   r   connectY   s   
zDirectedGraph.connectIterator[tuple[KT, KT]]c                 c  s.    | j  D ]\}}|D ]}||fV  qqd S r$   )r'   rB   )r*   rI   childrenrJ   r   r   r   
iter_edgesc   s   zDirectedGraph.iter_edgesc                 C     t | j| S r$   )r.   r'   r6   r   r   r   iter_childrenh      zDirectedGraph.iter_childrenc                 C  rR   r$   )r.   r(   r6   r   r   r   iter_parentsk   rT   zDirectedGraph.iter_parentsN)r"   r#   r"   r,   r"   r1   )r4   r   r"   r5   )r"   r8   )r4   r   r"   r#   )rI   r   rJ   r   r"   r5   )rI   r   rJ   r   r"   r#   )r"   rO   )r4   r   r"   r,   )r   r   r   r    r+   r/   r3   r7   rD   rF   rG   rL   rN   rQ   rS   rU   r   r   r   r   r!   -   s    











r!   c                   @  sV   e Zd Z	d!d"d
dZd#ddZd$ddZd%ddZd&ddZd'ddZd(dd Z	dS ))IteratorMappingNr   Mapping[KT, RT]accessorCallable[[RT], Iterable[CT]]appends Mapping[KT, Iterable[CT]] | Noner"   r#   c                 C  s   || _ || _|p	i | _d S r$   )_mapping	_accessor_appends)r*   r   rZ   r\   r   r   r   r+   p   s   zIteratorMapping.__init__strc                 C  s   d | j| j| jS )Nz!IteratorMapping({!r}, {!r}, {!r}))formatr^   r_   r`   r)   r   r   r   __repr__z   s
   zIteratorMapping.__repr__r5   c                 C  s   t | jp| jS r$   )r5   r^   r`   r)   r   r   r   __bool__   s   zIteratorMapping.__bool__r4   objectc                 C  s   || j v p	|| jv S r$   )r^   r`   r6   r   r   r   r7      s   zIteratorMapping.__contains__r=   r   Iterator[CT]c                 C  sL   z| j | }W n ty   t| j|  Y S w t| || j|dS )Nr   )r^   rM   r.   r`   	itertoolschainr_   get)r*   r=   r>   r   r   r   __getitem__   s   zIteratorMapping.__getitem__r,   c                   s"    fdd j D }t j|S )Nc                 3  s    | ]
}| j vr|V  qd S r$   r^   r<   r=   r)   r   r   	<genexpr>       z+IteratorMapping.__iter__.<locals>.<genexpr>)r`   rg   rh   r^   r*   morer   r)   r   r/      s   zIteratorMapping.__iter__r1   c                   s&   t  fdd jD }t j| S )Nc                 3  s    | ]
}| j vrd V  qdS )r   Nrk   rl   r)   r   r   rm      rn   z*IteratorMapping.__len__.<locals>.<genexpr>)sumr`   r2   r^   ro   r   r)   r   r3      s   zIteratorMapping.__len__r$   )r   rY   rZ   r[   r\   r]   r"   r#   r"   ra   r"   r5   )r4   re   r"   r5   )r=   r   r"   rf   rV   rW   )
r   r   r   r+   rc   rd   r7   rj   r/   r3   r   r   r   r   rX   o   s    





rX   c                   @  s8   e Zd ZdZdddZdd	d
ZdddZdddZdS )_FactoryIterableViewa:  Wrap an iterator factory returned by `find_matches()`.

    Calling `iter()` on this class would invoke the underlying iterator
    factory, making it a "collection with ordering" that can be iterated
    through multiple times, but lacks random access methods presented in
    built-in Python sequence types.
    factoryCallable[[], Iterable[RT]]r"   r#   c                 C  s   || _ d | _d S r$   )_factory	_iterable)r*   ru   r   r   r   r+      s   
z_FactoryIterableView.__init__ra   c                 C  s   t | j dt|  dS N())rA   r   listr)   r   r   r   rc      s   z_FactoryIterableView.__repr__r5   c                 C  s(   z	t t|  W dS  ty   Y dS w )NFT)nextr.   StopIterationr)   r   r   r   rd      s   z_FactoryIterableView.__bool__Iterator[RT]c                 C  s,   | j d u r	|  n| j }t|\| _ }|S r$   )rx   rw   rg   tee)r*   iterablecurrentr   r   r   r/      s   z_FactoryIterableView.__iter__N)ru   rv   r"   r#   rr   rs   r"   r   r   r   r   r    r+   rc   rd   r/   r   r   r   r   rt      s    


rt   c                   @  s8   e Zd ZdZdddZddd	ZdddZdddZdS )_SequenceIterableViewzWrap an iterable returned by find_matches().

    This is essentially just a proxy to the underlying sequence that provides
    the same interface as `_FactoryIterableView`.
    sequenceSequence[RT]c                 C  s
   || _ d S r$   )	_sequence)r*   r   r   r   r   r+      r0   z_SequenceIterableView.__init__r"   ra   c                 C  s   t | j d| j dS ry   )rA   r   r   r)   r   r   r   rc      s   z_SequenceIterableView.__repr__r5   c                 C  r-   r$   )r5   r   r)   r   r   r   rd      r0   z_SequenceIterableView.__bool__r   c                 C  r-   r$   )r.   r   r)   r   r   r   r/      r0   z_SequenceIterableView.__iter__N)r   r   rr   rs   r   r   r   r   r   r   r      s    


r   matchesMatches[CT]r"   Iterable[CT]c                 C  s*   t | rt| S t| tst| } t| S )zCBuild an iterable view from the value returned by `find_matches()`.)callablert   
isinstancer   r|   r   )r   r   r   r   build_iter_view   s
   
r   )r   r   r"   r   )
__future__r   rg   collectionsr   typingr   r   r   r   r   r	   r
   r   r   r   r   r   r   Matchesresolvers.criterionr   r   r   r!   rX   rt   r   r   IterableViewr   r   r   r   <module>   s,    0(B(
	