Qf%^ddlmZddgZdZdZGddZGddeZGd dZy ) ) GenericAliasTopologicalSorter CycleErrorceZdZdZdZy) _NodeInfonode npredecessors successorsc.||_d|_g|_yNrr )selfr s //opt/alt/python312/lib64/python3.12/graphlib.py__init__z_NodeInfo.__init__ s N)__name__ __module__ __qualname__ __slots__rrrr r s 5I rr ceZdZ y)rN)rrrrrrrrs   rc\eZdZ d dZdZdZdZdZdZdZ d Z d Z d Z e eZy) rNci|_d|_d|_d|_|,|j D]\}}|j |g|yyr) _node2info _ready_nodes _npassedout _nfinisheditemsadd)rgraphr predecessorss rrzTopologicalSorter.__init__,sS   &+kkm"l- -'4 rct|jj|x}t|x|j|<}|SN)rgetr )rr results r _get_nodeinfozTopologicalSorter._get_nodeinfo6s8oo))$/ /F 8-6t_ ? ?!OO224 4q18LAFF4   " 3e< <  s A? A?c |j tdt|j}|j}|D]}t||_|jj |xjt|z c_|SNprepare() must be called first) rr*tupler _NODE_OUTr clearrr+)rr'n2ir s r get_readyzTopologicalSorter.get_readyls     $=> >t(()ooD&/CI # ! CK' rc |j td|j|jkxst |jSr7)rr*rrboolrs r is_activezTopologicalSorter.is_activesF     $=> >!1!11LT$:K:K5LLrc"|jSr%)rAr@s r__bool__zTopologicalSorter.__bool__s~~rc  |j td|j}|D]}|j|x}td|d|j}|t k7r,|dk\rtd|d|t k(rtd|dt |_|jD]G}||}|xjdzc_|jdk(s-|jj|I|xjdz c_ y)Nr8znode z was not added using add()rz% was not passed out (still not ready)z was already marked done) rr*rr&r r: _NODE_DONEr r,r)rnodesr<r r-stat successorsuccessor_infos rdonezTopologicalSorter.dones     $=> >ooD GGDM)2 50J!KLL))Dy 19$x'LMZ'$uTH4L%MNN &0H "&00 !$Y,,1,!//14%%,,Y7 1 OOq O9rc|j}g}g}t}i}|D]}||vr ||vr||vro|||d|gzcS|j||jt ||j j t|||<|j||r |d}ny#t$r$||j=|jYnwxYw|rC8)Nr) rsetr!r,iterr __next__r+ StopIterationpop)rr<stackitstackseen node2stackir s rr2zTopologicalSorter._find_cyclesoou Dt|4<{*$[%6%89TFBBHHTNNN4D (<(<#=#F#FG(+E K%LL&&*wr{} / 8 )&' 4 & s" B11*CCc#K |j|jr;|j}|Ed{|j||jr:yy7&wr%)r5rAr=rK)r node_groups r static_orderzTopologicalSorter.static_ordersR  nn)J! ! ! DIIz "nn !s7A"A #A"A"r%)rrrrr(r!r5r=rArCrKr2rX classmethodr__class_getitem__rrrrr)sGP. .6=,4 M -!^#J #$L1rN) typesr__all__r:rFr r*rrrrrr]s>  -   "    Q2Q2r