pydevDAG._print._print module — pydevDAG 1.0 documentation

### Navigation

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

# pydevDAG._print._print module

## pydevDAG._print._print

Textual display of graph.

class `pydevDAG._print._print.` `LineArrangements`

  Bases: `object`

  Sort out nodes and their relationship to each other in printing.

  classmethod `node_strings`(config, graph, orphan, last, diffstatus, indent, node)

    Generates print information about nodes reachable from `node` including itself.

    Parameters: | LineArrangementsConfig – config graph (DiGraph) – the graph orphan (bool) – True if this node has no parents, otherwise False last (bool) – True if this node is the last child, otherwise False diffstatus (DiffStatus) – the diffstatus of the edge indent (int) – the indentation level node (Node) – the node to print
    Returns: | a table of information to be used for further display
    Return type: | dict of str * object

    Fields in table: * diffstatus - the diffstatus of the edge to this node * indent - the level of indentation * last - whether this node is the last child of its parent * node - the table of information about the node itself * orphan - whether this node has no parents

  classmethod `node_strings_from_graph`(config, graph)

    Generates print information about nodes in graph. Starts from the roots of the graph.

    Parameters: | LineArrangementsConfig – config graph (DiGraph) – the graph
    Returns: | a table of information to be used for further display
    Return type: | list of dict of str * object

    Fields in table: * diffstatus - the diffstatus of the edge to this node * indent - the level of indentation * last - whether this node is the last child of its parent * node - the table of information about the node itself * orphan - whether this node has no parents

  classmethod `node_strings_from_root`(config, graph, node)

    Generates print information about nodes reachable from `node` including itself. Assumes that the node is a root and supplies some appropriate defaults.

    Parameters: | LineArrangementsConfig – config graph (DiGraph) – the graph node (Node) – the node to print
    Returns: | a table of information to be used for further display
    Return type: | dict of str * object

    Fields in table: * diffstatus - the diffstatus of the edge to this node * indent - the level of indentation * last - whether this node is the last child of its parent * node - the table of information about the node itself * orphan - whether this node has no parents

class `pydevDAG._print._print.` `LineArrangementsConfig`(info_func, conversion_func, sort_key)

  Bases: `object`

  Class that represents the configuration for LineArrangements methods.

class `pydevDAG._print._print.` `LineInfo`(graph, keys, alignment, getters)

  Bases: `object`

  Class that generates info for a single line.

  `info`(node, keys=None, conv=<function <lambda> at 0x7fa3c18ea050>)

    Function to generate information to be printed for `node`.

    Parameters: | node (Node) – the node keys (list of str or NoneType) – list of keys for values or None conv ((str * object) -> str) – a conversion function that converts values to str
    Returns: | a mapping of keys to values
    Return type: | dict of str * (str or NoneType)

    Only values for elements at x in keys are calculated. If keys is None, return an item for every index. If keys is the empty list, return an empty dict. Return None for key in keys that can not be satisfied.

    If strings is set, convert all values to their string representation.

class `pydevDAG._print._print.` `Print`

  Bases: `object`

  Methods to print a list of lines representing a graph.

  static `calculate_widths`(column_headers, lines, padding)

    Calculate widths of every column.

    Parameters: | column_headers (list of str) – column headers lines (list of dict) – line infos padding (int) – number of spaces to pad on right
    Returns: | a table of key/length pairs
    Return type: | dict of str * int

  static `format_str`(column_widths, column_headers, alignment)

    Format string for every data value.

    Parameters: | column_widths (dict of str * int) – map of widths of each column column_headers (list of str) – column headers alignment (dict of str * str {‘<’, ‘>’, ‘^’}) – alignment for column headers
    Returns: | a format string
    Return type: | str

  static `header_str`(column_widths, column_headers, alignment)

    Get the column headers.

    Parameters: | column_widths (dict of str * int) – map of widths of each column column_headers (list of str) – column headers alignment (dict of str * str {‘<’, ‘>’, ‘^’}) – alignment for column headers
    Returns: | the column headers
    Return type: | str

  classmethod `lines`(column_headers, lines, padding, alignment)

    Yield lines to be printed.

    Parameters: | column_headers (list of str) – column headers lines (list of dict) – line infos padding (int) – number of spaces to pad on right alignment (dict of str * str {‘<’, ‘>’, ‘^’}) – alignment for column headers

class `pydevDAG._print._print.` `XformLines`

  Bases: `object`

  Use information to transform the fields in the line.

  classmethod `calculate_prefix`(line_info)

    Calculate left trailing spaces and edge characters to initial value.

    Parameters: | line_info (dict of str * object) – a map of information about the line
    Returns: | the prefix str for the first column value
    Return type: | str

  static `format_edge`(edge_str, diffstatus)

    Format the edge based on the `diffstatus`.

    Returns: | a formatted string
    Return type: | str

  classmethod `indentation`()

    Return the number of spaces for the next indentation level.

    Returns: | indentation
    Return type: | int

  classmethod `xform`(column_headers, lines)

    Transform column values and yield just the line info.

    Parameters: | column_headers (list of str) – the column headers lines (dict of str * str) – information about each line

### Navigation

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