tree

This module contains the functions to manage path and create trees of tasks

class mosaic_orchestrator.tree.Node(value: object, children: List[Node])[source]

representing a Node in the task tree

children: List[Node]
value: object
class mosaic_orchestrator.tree.Path(steps: Union[List[str], str])[source]

represents a path of a task or input in a task hierarchy.

The string notation for paths is that each step is separated by a colon.

property length

length of the path

parent() Path[source]

a new path object containing all but the target of this path.

remove(path: Path) Path[source]

a new path object containing all but the passed path

property root

the root of the path

property target

the final step of the path

mosaic_orchestrator.tree.concat(path: Path, target: str) Path[source]

a new path object with the target added to the path.

mosaic_orchestrator.tree.is_path_string(string: object) bool[source]

check if the string ia a path string

mosaic_orchestrator.tree.prepend(root: str, other: Path) Path[source]

a new path object with the root prepended to the path.

mosaic_orchestrator.tree.traverse(tree: Union[List[Node], Node], on_each: Callable)[source]

used to traverse to a tree, on_each is called with every node of the tree.