\hcddlZddlmZGddeZGddej ZGdd eZGd d eZd Z y) N)collections_abccXeZdZdZdZdZdZdZdZdZ dZ d Z d Z d Z d Zd Zy) DirectedGraphz&A graph structure with directed edges.c>t|_i|_i|_yN)set _vertices _forwards _backwardsselfs a/root/niggaflix-v3/playground/venv/lib/python3.12/site-packages/pip/_vendor/resolvelib/structs.py__init__zDirectedGraph.__init__ sc,t|jSr)iterr r s r__iter__zDirectedGraph.__iter__DNN##rc,t|jSr)lenr r s r__len__zDirectedGraph.__len__s4>>""rc||jvSr)r rkeys r __contains__zDirectedGraph.__contains__sdnn$$rcVt}t|j|_|jj Dcic]\}}|t|c}}|_|j j Dcic]\}}|t|c}}|_|Scc}}wcc}}w)z$Return a shallow copy of this graph.)rr r r itemsr )rotherkvs rcopyzDirectedGraph.copys~dnn-151E1E1GHA1c!f9H26//2G2G2IJ$!QAs1vIJ IJs B>B%c||jvr td|jj|t|j|<t|j |<y)zAdd a new vertex to the graph.z vertex existsN)r ValueErroraddr r r rs rr%zDirectedGraph.addsK $.. _- - 3!es"urc2|jj||jj|D] }|j|j|"|jj|D] }|j|j|"y)zCRemove a vertex from the graph, disconnecting all edges from/to it.N)r remover popr )rrfts rr'zDirectedGraph.remove's~ c"##C( +A OOA  % %c * +$$S) *A NN1  $ $S ) *rcJ||j|vxr||j|vSr)r r rr)r*s r connectedzDirectedGraph.connected/s)DOOA&&A1q0A+AArc||jvr t||j|j||j|j|y)zgConnect two existing vertices. Nothing happens if the vertices are already connected. N)r KeyErrorr r%r r,s rconnectzDirectedGraph.connect2sH DNN "1+  qa  q!rc#jK|jjD]\}}|D]}||f ywr)r r)rr)childrenr*s r iter_edgeszDirectedGraph.iter_edges<s>>>//1 KAx d   s13c2t|j|Sr)rr rs r iter_childrenzDirectedGraph.iter_childrenAsDNN3'((rc2t|j|Sr)rr rs r iter_parentszDirectedGraph.iter_parentsDsDOOC())rN)__name__ __module__ __qualname____doc__rrrrr"r%r'r-r0r3r5r7rrrrsB0 $#%%*B" )*rrc<eZdZd dZdZdZeZdZdZdZ dZ y) IteratorMappingNc6||_||_|xsi|_yr)_mapping _accessor_appends)rmappingaccessorappendss rrzIteratorMapping.__init__Is ! 2 rcddj|j|j|jS)Nz!IteratorMapping({!r}, {!r}, {!r}))formatr@rArBr s r__repr__zIteratorMapping.__repr__Ns*299 MM NN MM  rcHt|jxs |jSr)boolr@rBr s r__bool__zIteratorMapping.__bool__UsDMM2T]]33rc>||jvxs||jvSr)r@rBrs rrzIteratorMapping.__contains__Zsdmm#;sdmm';;rc |j|}t j |j ||jj|dS#t$rt|j|cYSwxYw)Nr<)r@r/rrB itertoolschainrAget)rr r!s r __getitem__zIteratorMapping.__getitem__]sg * a At~~a0$--2C2CAr2JKK * a() ) *sA!A43A4cnfdjD}tjj|S)Nc3@K|]}|jvs|ywrr@.0r rs r z+IteratorMapping.__iter__..esCaAT]],BC)rBrNrOr@rmores` rrzIteratorMapping.__iter__ds&C4==Ct}}d33rcptfdjD}tj|zS)Nc3@K|]}|jvsdyw)rNrTrUs rrWz*IteratorMapping.__len__..isFq /E1FrX)sumrBrr@rYs` rrzIteratorMapping.__len__hs+FdmmFF4==!D((rr) r8r9r:rrHrK __nonzero__rrQrrr<rrr>r>Hs-&  4K<L4)rr>c,eZdZdZdZdZdZeZdZy)_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. c ||_d|_yr)_factory _iterable)rfactorys rrz_FactoryIterableView.__init__vs rc^djt|jt|SNz{}({}))rGtyper8listr s rrHz_FactoryIterableView.__repr__zs!tDz22DJ??rcL tt|y#t$rYywxYw)NFT)nextr StopIterationr s rrKz_FactoryIterableView.__bool__}s,  d   s  ##c|j|jn |j}tj|\|_}|Sr)rcrbrNtee)riterablecurrents rrz_FactoryIterableView.__iter__s;#~~5DMMO4>> #,--"9rN r8r9r:r;rrHrKr^rr<rrr`r`ms#@Krr`c,eZdZdZdZdZdZeZdZy)_SequenceIterableViewzWrap an iterable returned by find_matches(). This is essentially just a proxy to the underlying sequence that provides the same interface as `_FactoryIterableView`. c||_yr) _sequence)rsequences rrz_SequenceIterableView.__init__s !rc`djt|j|jSrf)rGrgr8rtr s rrHz_SequenceIterableView.__repr__s!tDz22DNNCCrc,t|jSr)rJrtr s rrKz_SequenceIterableView.__bool__rrc,t|jSr)rrtr s rrz_SequenceIterableView.__iter__rrNrpr<rrrrrrs# "D$K$rrrct|r t|St|tjs t |}t |S)zCBuild an iterable view from the value returned by `find_matches()`.)callabler` isinstancerSequencerhrr)matchess rbuild_iter_viewr~s9#G,, g77 8w-  ))r) rNcompatrobjectrMappingr>r`rrr~r<rrrsI#?*F?*D")o--")J6B$F$,*r