Generic class for resolving an order of checking ‘things’ assuming each thing has a name, and knows the names of its direct dependencies.

Module Contents#



Entry in the orderer.


Class that orders entries so their 'needed_by' entries are processed first.



class raesl.compile.typechecking.orderer.OrdererEntry(name: str, data: TypeOfData)#

Entry in the orderer.

  • name – Name of the entry.

  • data – Data associated with the entry.


List of entries that depend on this entry. May only be accessed by the Orderer.


List of entries that need this entry. May only be accessed by the Orderer.


Return repr(self).

class raesl.compile.typechecking.orderer.Orderer#

Class that orders entries so their ‘needed_by’ entries are processed first.


Entries that do not depend on other entries.


Entries that depend on other entries.

add_dependency(provide: str, needs: Iterable[str], data: TypeOfData = None)#

Add a dependency where the ‘provide’ name depends on the ‘needs’ names.

  • provide – Name of the ‘thing’ that this dependency provides.

  • needs – Names of ‘things’ that are required by the provide ‘thing’.

  • data – Optional data associated with ‘provide’. At most one such data item should exist, class cannot handle multiple data items.

resolve() Tuple[List[OrdererEntry], List[OrdererEntry] | None]#

Resolve the dependency chain by peeling away independent entries. This should cause some dependent entries to become independent, allowing them to be peeled as well.


Ordered sequence of entries containing name and associated data, and

optionally a cycle of entries if at least one cycle exists. Note that the Orderer returns one arbitrary cycle in such a case.

find_entry(name: str) OrdererEntry | None#

Try to find an entry with the provided name. Useful for duplicate name detection.


The found entry (treat as read-only), or None.

_find_create_entry(name: str, data: TypeOfData = None) OrdererEntry#

Find or create an entry with the provide name.

  • name – name of the entry to find or create.

  • data – Optional data associated with the name. It is copied into the entry whenever possible without overwriting existing data.


The entry.