Jz`f%^SSKJr SS/rSrSr"SS5r"SS\5r"S S5rg ) ) GenericAliasTopologicalSorter CycleErrorc\rSrSrSrSrSrg) _NodeInfo node npredecessors successorsc,XlSUl/UlgNrr )selfr s !/usr/lib64/python3.13/graphlib.py__init___NodeInfo.__init__ s )rr r N)__name__ __module__ __qualname____firstlineno__ __slots__r__static_attributes__rrr r s 5I rr c\rSrSrSrSrg)ra#Subclass of ValueError raised by TopologicalSorter.prepare if cycles exist in the working graph. If multiple cycles exist, only one undefined choice among them will be reported and included in the exception. The detected cycle can be accessed via the second element in the *args* attribute of the exception instance and consists in a list of nodes, such that each node is, in the graph, an immediate predecessor of the next node in the list. In the reported list, the first and the last node will be the same, to make it clear that it is cyclic. rN)rrrr__doc__rrrrrrs   rch\rSrSrSrSSjrSrSrSrSr S r S r S r S r S r\"\5rSrg)r)zFProvides functionality to topologically sort a graph of hashable nodesNc0UlSUlSUlSUlUb-UR 5Hup#UR "U/UQ76 M ggr) _node2info _ready_nodes _npassedout _nfinisheditemsadd)rgraphr predecessorss rrTopologicalSorter.__init__,sT   &+kkm ."- - . rcvURRU5=nc[U5=URU'nU$N)r#getr )rr results r _get_nodeinfoTopologicalSorter._get_nodeinfo6s8oo))$/ /F 8-6t_ ? ?!OO224 18LFAFF   " 3e< <  s B BcURc [S5e[UR5nURnUHn[X#lM URR 5 U=R[U5- slU$)ayReturn a tuple of all the nodes that are ready. Initially it returns all nodes with no predecessors; once those are marked as processed by calling "done", further calls will return all new nodes that have all their predecessors already processed. Once no more progress can be made, empty tuples are returned. Raises ValueError if called without calling "prepare" previously. prepare() must be called first) r$r3tupler# _NODE_OUTr clearr%r4)rr/n2ir s r get_readyTopologicalSorter.get_readyls~    $=> >t(()oo 0D&/CI # 0 ! CK' rcURc [S5eURUR:=(d [ UR5$)aReturn ``True`` if more progress can be made and ``False`` otherwise. Progress can be made if cycles do not block the resolution and either there are still nodes ready that haven't yet been returned by "get_ready" or the number of nodes marked "done" is less than the number that have been returned by "get_ready". Raises ValueError if called without calling "prepare" previously. rB)r$r3r&r%boolrs r is_activeTopologicalSorter.is_activesA    $=> >!1!11LT$:K:K5LLrc"UR5$r-)rLrKs r__bool__TopologicalSorter.__bool__s~~rc@URc [S5eURnUHnURU5=nc[SU<S35eURnU[ :wa>US:a[SU<S35eU[ :Xa[SU<S35eSU<SU35e[ UlURHInX&nU=RS -slURS:XdM.URRU5 MK U=RS - sl M g) aMarks a set of nodes returned by "get_ready" as processed. This method unblocks any successor of each node in *nodes* for being returned in the future by a call to "get_ready". Raises :exec:`ValueError` if any node in *nodes* has already been marked as processed by a previous call to this method, if a node was not added to the graph by using "add" or if called without calling "prepare" previously or if node has not yet been returned by "get_ready". NrBznode z was not added using add()rz% was not passed out (still not ready)z was already marked donez: unknown status ) r$r3r#r.r rD _NODE_DONErr5r&)rnodesrFr r6stat successorsuccessor_infos rdoneTopologicalSorter.dones6    $=> >oo !D GGDM)2 50J!KLL))Dy 19$x'LMZ'$uTH4L%MNNIE$1B4&"II5&0H "&00 8 !$,,1,!//14%%,,Y7  8 OOq O9 !rcURn/n/n[5n0nUHnXd;aM Xd;aXe;a X%USU/-s $O_URU5 UR[ XR 5R 5 [U5XV'URU5 U(a US"5nOMM g![a# XRR5 UR5 Of=fU(aMLNA)Nr) r#setr(r5iterr__next__r4 StopIterationpop)rrFstackitstackseen node2stackir s rr<TopologicalSorter._find_cyclesoou  D|<*$%6%89TFBB+HHTNNN4 (<(<#=#F#FG(+E K%LL&&&r{} /  8 )&' 4 & es) B;;*C('C(c## UR5 UR5(aAUR5nUShvN UR"U6 UR5(aM@ggN,7f)a)Returns an iterable of nodes in a topological order. The particular order that is returned may depend on the specific order in which the items were inserted in the graph. Using this method does not require to call "prepare" or "done". If any cycle is detected, :exc:`CycleError` will be raised. N)r?rLrGrX)r node_groups r static_orderTopologicalSorter.static_ordersP nn)J! ! ! IIz "nn !s;A,A*(A,(A,)rXr#r%r&r(r$r-)rrrrrrr0r(r?rGrLrOrXr<rg classmethodr__class_getitem__rrrrrr)sGP. .6=,4 M -!^#J #$L1rN) typesr__all__rDrSr r3rrrrrrms>  -   "    Q2Q2r