The heat.engine.dependencies Module

exception heat.engine.dependencies.CircularDependencyException(**kwargs)[source]

Bases: heat.common.exception.HeatException

msg_fmt = u’Circular Dependency Found: %(cycle)s’
class heat.engine.dependencies.Dependencies(edges=None)[source]

Bases: object

Helper class for calculating a dependency graph.

graph(reverse=False)[source]

Return a copy of the underlying dependency graph.

leaves()[source]

Return an iterator over all of the leaf nodes in the graph.

required_by(last)[source]

List the keys that require the specified node.

requires(target)[source]

List the keys that require the specified node.

roots()[source]

Return an iterator over all of the root nodes in the graph.

translate(transform)[source]

Translate all of the nodes using a transform function.

Returns a new Dependencies object.

class heat.engine.dependencies.Graph(*args)[source]

Bases: collections.defaultdict

A mutable mapping of objects to nodes in a dependency graph.

copy()[source]

Return a copy of the graph.

edges()[source]

Return an iterator over all of the edges in the graph.

map(func)[source]

Map the supplied function onto each node in the graph.

Return a dictionary derived from mapping the supplied function onto each node in the graph.

reverse_copy()[source]

Return a copy of the graph with the edges reversed.

static toposort(graph)[source]

Return a topologically sorted iterator over a dependency graph.

This is a destructive operation for the graph.

class heat.engine.dependencies.Node(requires=None, required_by=None)[source]

Bases: object

A node in a dependency graph.

copy()[source]

Return a copy of the node.

disjoint()[source]

Return True if this node is both a leaf and a stem.

require
required_by(source=None)[source]

List the keys that require this node, and optionally add new one.

requires(target=None)[source]

Add a key that this node requires, and optionally add a new one.

reverse_copy()[source]

Return a copy of the node with the edge directions reversed.

satisfy
stem()[source]

Return True if this node is a stem (required by nothing).