
    gc                         S SK r SSKJr   " S S\5      r " S S\R
                  5      r " S S	\5      r " S
 S\5      rS r	g)    N   )collections_abcc                   `    \ rS rSrSrS rS rS rS rS r	S r
S	 rS
 rS rS rS rS rSrg)DirectedGraph   z&A graph structure with directed edges.c                 >    [        5       U l        0 U l        0 U l        g N)set	_vertices	_forwards
_backwardsselfs    f/Users/Alptekin/Desktop/izin_takip/venv/lib/python3.13/site-packages/pip/_vendor/resolvelib/structs.py__init__DirectedGraph.__init__	   s        c                 ,    [        U R                  5      $ r	   )iterr   r   s    r   __iter__DirectedGraph.__iter__       DNN##r   c                 ,    [        U R                  5      $ r	   )lenr   r   s    r   __len__DirectedGraph.__len__   s    4>>""r   c                     XR                   ;   $ r	   )r   r   keys     r   __contains__DirectedGraph.__contains__   s    nn$$r   c                 ^   [        5       n[        U R                  5      Ul        U R                  R	                  5        VVs0 s H  u  p#U[        U5      _M     snnUl        U R
                  R	                  5        VVs0 s H  u  p#U[        U5      _M     snnUl        U$ s  snnf s  snnf )z$Return a shallow copy of this graph.)r   r
   r   r   itemsr   )r   otherkvs       r   copyDirectedGraph.copy   s    dnn-151E1E1GH1G1c!f91GH26//2G2G2IJ2I$!As1vI2IJ IJs   B# B)c                     XR                   ;   a  [        S5      eU R                   R                  U5        [        5       U R                  U'   [        5       U R
                  U'   g)zAdd a new vertex to the graph.zvertex existsN)r   
ValueErroraddr
   r   r   r   s     r   r+   DirectedGraph.add   sI    .. _--3!es"ur   c                 :   U R                   R                  U5        U R                  R                  U5       H!  nU R                  U   R                  U5        M#     U R                  R                  U5       H!  nU R                  U   R                  U5        M#     g)zCRemove a vertex from the graph, disconnecting all edges from/to it.N)r   remover   popr   )r   r   fts       r   r.   DirectedGraph.remove'   st    c"##C(AOOA%%c* )$$S)ANN1$$S) *r   c                 T    XR                   U   ;   =(       a    X R                  U   ;   $ r	   )r   r   r   r0   r1   s      r   	connectedDirectedGraph.connected/   s%    OOA&&A1q0A+AAr   c                     X R                   ;  a  [        U5      eU R                  U   R                  U5        U R                  U   R                  U5        g)zWConnect two existing vertices.

Nothing happens if the vertices are already connected.
N)r   KeyErrorr   r+   r   r4   s      r   connectDirectedGraph.connect2   sF    
 NN"1+qa q!r   c              #   n   #    U R                   R                  5        H  u  pU H  nX4v   M
     M     g 7fr	   )r   r#   )r   r0   childrenr1   s       r   
iter_edgesDirectedGraph.iter_edges<   s/     >>//1KAd
  2s   35c                 2    [        U R                  U   5      $ r	   )r   r   r   s     r   iter_childrenDirectedGraph.iter_childrenA   s    DNN3'((r   c                 2    [        U R                  U   5      $ r	   )r   r   r   s     r   iter_parentsDirectedGraph.iter_parentsD   s    DOOC())r   )r   r   r   N)__name__
__module____qualname____firstlineno____doc__r   r   r   r    r'   r+   r.   r5   r9   r=   r@   rC   __static_attributes__ r   r   r   r      sB    0
$#%%*B"
)*r   r   c                   F    \ rS rSrSS jrS rS r\rS rS r	S r
S	 rS
rg)IteratorMappingH   Nc                 <    Xl         X l        U=(       d    0 U l        g r	   )_mapping	_accessor_appends)r   mappingaccessorappendss       r   r   IteratorMapping.__init__I   s    !2r   c                 d    SR                  U R                  U R                  U R                  5      $ )Nz!IteratorMapping({!r}, {!r}, {!r}))formatrP   rQ   rR   r   s    r   __repr__IteratorMapping.__repr__N   s*    299MMNNMM
 	
r   c                 R    [        U R                  =(       d    U R                  5      $ r	   )boolrP   rR   r   s    r   __bool__IteratorMapping.__bool__U   s    DMM2T]]33r   c                 H    XR                   ;   =(       d    XR                  ;   $ r	   )rP   rR   r   s     r   r    IteratorMapping.__contains__Z   s    mm#;smm';;r   c                      U R                   U   n[        R
                  " U R                  U5      U R                  R                  US5      5      $ ! [         a    [        U R                  U   5      s $ f = f)NrK   )rP   r8   r   rR   	itertoolschainrQ   get)r   r%   r&   s      r   __getitem__IteratorMapping.__getitem__]   sg    	*a A t~~a0$--2C2CAr2JKK  	*a())	*s   A "A65A6c                 r   ^  U 4S jT R                    5       n[        R                  " T R                  U5      $ )Nc              3   J   >#    U  H  oTR                   ;  d  M  Uv   M     g 7fr	   rP   .0r%   r   s     r   	<genexpr>+IteratorMapping.__iter__.<locals>.<genexpr>e   s     C=aT]],B=   #	#)rR   rb   rc   rP   r   mores   ` r   r   IteratorMapping.__iter__d   s&    C4==Ct}}d33r   c                 r   ^  [        U 4S jT R                   5       5      n[        T R                  5      U-   $ )Nc              3   J   >#    U  H  oTR                   ;  d  M  S v   M     g7f)r   Nri   rj   s     r   rl   *IteratorMapping.__len__.<locals>.<genexpr>i   s     Fm/E11mrn   )sumrR   r   rP   ro   s   ` r   r   IteratorMapping.__len__h   s+    FdmmFF4==!D((r   )rQ   rR   rP   r	   )rE   rF   rG   rH   r   rY   r]   __nonzero__r    re   r   r   rJ   rK   r   r   rM   rM   H   s-    &

4 K<L4)r   rM   c                   4    \ rS rSrSrS rS rS r\rS r	Sr
g)	_FactoryIterableViewm   a&  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.
c                     Xl         S U l        g r	   _factory	_iterable)r   factorys     r   r   _FactoryIterableView.__init__v   s    r   c                 ^    SR                  [        U 5      R                  [        U 5      5      $ Nz{}({}))rX   typerE   listr   s    r   rY   _FactoryIterableView.__repr__z   s!    tDz22DJ??r   c                 N     [        [        U 5      5        g! [         a     gf = f)NFT)nextr   StopIterationr   s    r   r]   _FactoryIterableView.__bool__}   s,    	d   		s    
$$c                     U R                   c  U R                  5       OU R                   n[        R                  " U5      u  U l         nU$ r	   )r~   r}   rb   tee)r   iterablecurrents      r   r   _FactoryIterableView.__iter__   s;    #~~5DMMO4>> 	 #,--"9r   r|   NrE   rF   rG   rH   rI   r   rY   r]   rw   r   rJ   rK   r   r   ry   ry   m   s#    @ Kr   ry   c                   4    \ rS rSrSrS rS rS r\rS r	Sr
g)	_SequenceIterableView   zWrap an iterable returned by find_matches().

This is essentially just a proxy to the underlying sequence that provides
the same interface as `_FactoryIterableView`.
c                     Xl         g r	   	_sequence)r   sequences     r   r   _SequenceIterableView.__init__   s    !r   c                 `    SR                  [        U 5      R                  U R                  5      $ r   )rX   r   rE   r   r   s    r   rY   _SequenceIterableView.__repr__   s!    tDz22DNNCCr   c                 ,    [        U R                  5      $ r	   )r\   r   r   s    r   r]   _SequenceIterableView.__bool__   r   r   c                 ,    [        U R                  5      $ r	   )r   r   r   s    r   r   _SequenceIterableView.__iter__   r   r   r   Nr   rK   r   r   r   r      s#    "D$ K$r   r   c                     [        U 5      (       a  [        U 5      $ [        U [        R                  5      (       d  [        U 5      n [        U 5      $ )zCBuild an iterable view from the value returned by `find_matches()`.)callablery   
isinstancer   Sequencer   r   )matchess    r   build_iter_viewr      s?    #G,,g7788w- ))r   )
rb   compatr   objectr   MappingrM   ry   r   r   rK   r   r   <module>r      sI     #?*F ?*D")o-- ")J6 B$F $,*r   