§
    øyIfs	  ã                  ó6   — d Z ddlmZ ddlmZmZ dd„Zdd
„ZdS )z'Helper methods related to graph theory.é    )Úannotations)ÚOrderedDictÚdefaultdictÚgraphúdict[str, set[str]]Úreturnú	list[str]c                ól  ‡— t          |                      ¦   «         ¦  «        Št          |                      ¦   «         ¦  «        D ]}|D ]}|| vrt          ¦   «         | |<   ŒŒt	          t           ¦  «        }|                      ¦   «         D ]%\  }}|D ]}||                              |¦  «         ŒŒ&g }d„ |                      ¦   «         D ¦   «         }d„ |                     ¦   «         D ¦   «         }	t          d„ | D ¦   «         ¦  «        }
|
r^|
D ]}||	v r nŒ	nR|
|= |                     |¦  «         ||         D ]/}||xx         dz  cc<   ||         s|	                     |¦  «         Œ0|
°^ˆfd„|D ¦   «         }t          |¦  «        t          ‰¦  «        k     r t          | ¦  «         d}t          |¦  «        ‚|S )Nc                ó4   — i | ]\  }}|t          |¦  «        “ŒS © )Úlen)Ú.0ÚkÚvs      úB/var/www/piapp/venv/lib/python3.11/site-packages/tox/util/graph.pyú
<dictcomp>z+stable_topological_sort.<locals>.<dictcomp>   s$   € Ð2Ð2Ð2™D˜A˜qˆa•�Q‘”Ð2Ð2Ð2ó    c                ó   — h | ]	\  }}|°|’Œ
S r   r   )r   ÚnÚds      r   ú	<setcomp>z*stable_topological_sort.<locals>.<setcomp>   s!   € Ð<Ð<Ð<™D˜A˜q¸!Ð<�aÐ<Ð<Ð<r   c              3  ó   K  — | ]}|d fV — Œ	d S )Nr   )r   Úis     r   ú	<genexpr>z*stable_topological_sort.<locals>.<genexpr>   s&   è è € Ð9Ð9¨a  D 	Ð9Ð9Ð9Ð9Ð9Ð9r   é   c                ó   •— g | ]}|‰v ¯|‘Œ	S r   r   )r   r   Úto_orders     €r   ú
<listcomp>z+stable_topological_sort.<locals>.<listcomp>+   s   ø€ Ð3Ð3Ð3�A Q¨( ] ]ˆa ] ] ]r   z<could not order tox environments and failed to detect circle)ÚsetÚkeysÚlistÚvaluesr   ÚitemsÚaddr   Úappendr   Úidentify_cycleÚ
ValueError)r   r"   ÚvalueÚinverse_graphÚkeyÚdependsÚdependÚtopologyÚdegreeÚready_to_visitÚneed_to_visitÚnodeÚto_nodeÚresultÚmsgr   s                  @r   Ústable_topological_sortr5      s  ø€ Ý�5—:’:‘<”<Ñ Ô €Hõ �u—|’|‘~”~Ñ&Ô&ð %ð %ˆØð 	%ð 	%ˆEØ˜EÐ!Ð!Ý"™uœu��e‘øð	%õ  ¥Ñ$Ô$€MØŸš™œð +ð +‰ˆˆWØð 	+ð 	+ˆFØ˜&Ô!×%Ò% cÑ*Ô*Ð*Ð*ð	+ð €HØ2Ð2 E§K¢K¡M¤MÐ2Ñ2Ô2€FØ<Ð< F§L¢L¡N¤NÐ<Ñ<Ô<€NÝÐ9Ð9°5Ð9Ñ9Ô9Ñ9Ô9€MØ
ð ,à!ð 	ð 	ˆDØ�~Ð%Ð%Ø�ð &ð Ø˜$Ðà�Š˜ÑÔÐð % TÔ*ð 	,ð 	,ˆGØ�7ˆOˆOŒO˜qÑ ˆOˆO‰OØ˜'”?ð ,Ø×"Ò" 7Ñ+Ô+Ð+øð ð ,ð" 4Ð3Ð3Ð3˜Ð3Ñ3Ô3€Få
ˆ6�{„{•S˜‘]”]Ò"Ð"Ý�uÑÔÐØLˆÝ˜‰oŒoÐØ€Mr   ÚNonec                óê   ‡ ‡‡‡— t          ¦   «         Št          ¦   «         Šdˆ ˆˆˆfd„Š‰ D ]F} ‰|¦  «        }|�7d                     |                     ¦   «         ¦  «        › }t	          |¦  «        ‚ŒGd S )NÚvertexÚstrr   údict[str, None] | Nonec                ó¦   •— | ‰v rd S ‰                      | ¦  «         d ‰| <   ‰                     | d¦  «        D ]}|‰v s ‰|¦  «        r‰c S Œ‰| = d S )Nr   )r$   Úget)r8   Úneighborr   ÚpathÚvisitÚvisiteds     €€€€r   r?   zidentify_cycle.<locals>.visit8   s}   ø€ Ø�WÐÐØ�4Ø�Š�FÑÔÐØˆˆV‰ØŸ	š	 &¨"Ñ-Ô-ð 	ð 	ˆHØ˜4ÐÐ 5 5¨¡?¤?ÐØ���ð  à�ˆLØˆtr   z | )r8   r9   r   r:   )r   r   Újoinr    r'   )r   r1   r3   r4   r>   r?   r@   s   `   @@@r   r&   r&   4   s    øøøø€ Ý'™MœM€DÝ‰eŒe€Gð	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð ð "ð "ˆØ��t‘”ˆØÐØ—Z’Z §¢¡¤Ñ.Ô.Ð0ˆCÝ˜S‘/”/Ð!ð ð"ð "r   N)r   r   r   r	   )r   r   r   r6   )Ú__doc__Ú
__future__r   Úcollectionsr   r   r5   r&   r   r   r   ú<module>rE      sh   ðØ -Ð -à "Ð "Ð "Ð "Ð "Ð "à 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0ð)ð )ð )ð )ðX"ð "ð "ð "ð "ð "r   