pydevDAG._utils module

pydevDAG._utils

Generic utilities.

class pydevDAG._utils.Dict

Bases: object

Set or get the values of objects located in arbitrarily nested dicts.

static get_value(tree, keys)

Get value.

Parameters:
  • tree (dict) – arbitrarily nested dict
  • keys (list of str) – list of keys
Returns:

the result of traversing tree by means of keys

Return type:

object

Raises DAGValueError:
 

if the value can not be found

static set_value(tree, keys, value, force=False)

Set value.

Parameters:
  • tree (dict) – arbitrarily nested dict
  • keys (list of str) – list of keys
  • value (object) – the value to set
  • force (bool) – if True, make new empty dict entries if lookup fails
Raises DAGValueError:
 

on bad parameters

Bad parameters are considered to have been passed if: * An empty list of keys, don’t know what to set. * A prefix of the list yields a non-dict value.

class pydevDAG._utils.ExtendedLookup(config)

Bases: object

Get the result of looking at multiple attributes of a node at once.

get_values(tree)

Generate values for keys.

Parameters:tree (dict) – arbitrarily nested dict

Yields in sequence, the values for each key, None if no value found.

class pydevDAG._utils.GraphUtils

Bases: object

Generic utilties for graphs.

static get_roots(graph)

Get the roots of a graph.

Parameters:graph (DiGraph) – the graph
Returns:the roots of the graph
Return type:list of Node
static reverse(graph, copy=True)

Reverse a graph and indicate its status.

Parameters:
  • graph (DiGraph) – the graph
  • copy (bool) – if True, make a new copy of the graph
Returns:

a reversed graph

Return type:

DiGraph

classmethod set_direction(graph, set_reversed=False, copy=True)

Set a graph’s direction.

Parameters:
  • graph (DiGraph) – the graph
  • set_reversed (bool) – if True, direction is reversed
  • copy (bool) – if True, make a new copy of the graph
Returns:

a reversed graph

Return type:

DiGraph

Table Of Contents

Previous topic

pydevDAG._traversal module

Next topic

pydevDAG.version module

This Page