o
    ­—Žj  ã                   @  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   ú[/var/www/kodo/Anonymous/send/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 )Ú_SequenceIterableViewz²Wrap 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(
	