pydevDAG._structure module — pydevDAG 1.0 documentation

### Navigation

- index
- modules |
- next |
- previous |
- pydevDAG 1.0 documentation »
- pydevDAG »
- pydevDAG package »

# pydevDAG._structure module

## pydevDAG._structure

Tools to build and manipulate graphs of device relationships.

class `pydevDAG._structure.` `DMPartitionGraphs`

  Bases: `object`

  Build graphs of relationships between device mapper devices and partitions.

  classmethod `complete`(context)

    Build a complete graph showing device mapper, partition relationships.

    Parameters: | context (Context) – a udev context
    Returns: | a graph
    Return type: | DiGraph

  static `congruence_graph`(context, device)

    Build a graph of congruence relation between device mapper devices and partition devices.

    Parameters: | context (Context) – a udev context device (Device) – the partition device
    Returns: | a graph
    Return type: | DiGraph

class `pydevDAG._structure.` `Graph`

  Bases: `object`

  Build a graph according to specifications.

  static `graph`(context, name, classes)

    Build a graph using the designated classes.

    Parameters: | context – a context name (str) – a name for the graph classes (list of type) – a list of graph classes
    Returns: | a graph
    Return type: | nx.DiGraph

class `pydevDAG._structure.` `GraphMethods`

  Bases: `object`

  Generic graph methods.

  classmethod `add_edges`(graph, sources, targets, edge_type, source_node_type, target_node_type)

    Add edges to graph from sources to targets.

    Parameters: | graph (DiGraph) – the graph sources (list of object) – source nodes targets (list of object) – target nodes edge_type (EdgeType) – type for edges source_node_type (NodeType) – type for source nodes target_node_type (NodeType) – type for target nodes

    Nodes are device_paths of each device, as these uniquely identify the device.

  classmethod `add_nodes`(graph, nodes, node_type)

    Add nodes in `nodes` to graph.

    Parameters: | graph (DiGraph) – the graph nodes (list of object) – source nodes node_type (NodeType) – a node type

    Nodes are device_paths of each device, as these uniquely identify the device.

  static `get_node_args`(nodes, node_type)

    Get node arguments, along with keys.

    Parameters: | nodes (list of object) – source nodes node_type (NodeType) – a node type
    Returns: | arguments suitable for passing to add_nodes_from()

class `pydevDAG._structure.` `PartitionGraphs`

  Bases: `object`

  Build graphs of partition relationships.

  classmethod `complete`(context)

    Build a complete graph of all partitions.

    Parameters: | context (Context) – a udev context
    Returns: | a graph
    Return type: | DiGraph

  static `partition_graph`(device)

    Make a graph of partition relationships.

    Parameters: | device (Device) – the partition device
    Returns: | a graph
    Return type: | DiGraph

class `pydevDAG._structure.` `SpindleGraphs`

  Bases: `object`

  Build graphs of relationships with actual physical disks.

  classmethod `complete`(context)

    Build a complete graph showing path/spindle relationships.

    Parameters: | context (Context) – a udev context
    Returns: | a graph
    Return type: | DiGraph

  static `spindle_graph`(device)

    Make a graph of spindle relationships.

    Parameters: | device (Device) – the partition device
    Returns: | a graph
    Return type: | DiGraph

class `pydevDAG._structure.` `SysfsBlockGraphs`

  Bases: `object`

  Composes holders/slaves graphs for block devices.

  static `complete`(context)

    Build a complete graph showing all block devices.

    Parameters: | context (Context) – a udev context
    Returns: | a graph
    Return type: | DiGraph

class `pydevDAG._structure.` `SysfsGraphs`

  Bases: `object`

  Build sysfs graphs in various ways.

  classmethod `complete`(context, **kwargs)

    Build a complete graph showing all devices.

    Parameters: | context (Context) – a udev context kwargs – arguments for filtering the devices.
    Returns: | a graph
    Return type: | DiGraph

  classmethod `parents_and_children`(context, device)

    Make a graph of the parents and children of a device.

    Parameters: | context (Context) – the libudev context device (Device) – the device
    Returns: | a graph
    Return type: | DiGraph

  static `slaves_and_holders`(context, device, recursive=True)

    Make a graph of slaves and holders of a device.

    Parameters: | context (Context) – the libudev context device (Device) – the device recursive (bool) – True for recursive, False otherwise
    Returns: | a graph
    Return type: | DiGraph

class `pydevDAG._structure.` `SysfsTraversal`

  Bases: `object`

  Build simple graph from the holders or slaves of a given device.

  classmethod `do_level`(graph, context, device, config)

    Recursively defined function to generate a graph from `device`.

    Parameters: | graph (DiGraph) – the graph context (Context) – the libudev context device (Device) – the device config (SysfsTraversalConfig) – traversal configuration

  classmethod `holders`(context, device, recursive=True)

    Yield graph of slaves of device, including the device.

    Parameters: | context (Context) – the libudev context device (Device) – the device recursive (bool) – True for recursive, False otherwise
    Returns: | a graph
    Return type: | DiGraph

  classmethod `slaves`(context, device, recursive=True)

    Yield graph of slaves of device, including the device.

    Parameters: | context (Context) – the libudev context device (Device) – the device recursive (bool) – True for recursive, False otherwise
    Returns: | a graph
    Return type: | DiGraph

  classmethod `sysfs_traversal`(context, device, config)

    General graph of a sysfs traversal.

    Parameters: | context (Context) – the libudev context device (Device) – the device config (SysfsTraversalConfig) – traversal configuration
    Returns: | a graph
    Return type: | DiGraph

class `pydevDAG._structure.` `SysfsTraversalConfig`

  Bases: `tuple`

  SysfsTraversalConfig(recursive, slaves)

  `recursive`

    Alias for field number 0

  `slaves`

    Alias for field number 1

### Navigation

- index
- modules |
- next |
- previous |
- pydevDAG 1.0 documentation »
- pydevDAG »
- pydevDAG package »