reno.diagrams.DiagramNode#

class reno.diagrams.DiagramNode(ref, diagram)#

Bases: object

Parent class for any type of node representing a reference in a model.

Methods

__init__(ref, diagram)

Initialize a new node for the passed parent diagram and the provided reno component.

add_edge(edge)

Add the given edge to _both_ involved nodes.

add_to_graphviz([g])

Add this node to the digraphviz Digraph, accounting for sparklines if needed.

check_str_or_listpart_in_dict(keys, dictionary)

Utility function to retrieve the value in a dictionary where the key is found in the passed value (either a singular string which would be a direct match, or a list where the key is found in that list).

check_str_or_listpart_in_list(vals, ...)

Utility function to determine if a passed value (either a string or list of strings) is in (or at least one instance of the list is in) the passed containing list.

configure_color(config)

Determine what colors should be used for this node given the configuration.

configure_render(config)

Decide if this node should be rendered based on configuration and underlying reference.

generate_sparkline()

Returns the filepath of the saved plot so graphviz can display in a node.

graphviz_ref_node([g])

Add a node for the reference itself to the graph.

map_edges()

Find all connected nodes and determine how corresponding edges need to be drawn.

Attributes

Parameters:
__annotations__ = {'default_color': 'ClassVar[dict[str, str]]', 'default_font_color': 'ClassVar[dict[str, str]]', 'default_sparkline_edge_color': 'ClassVar[dict[str, str]]', 'other_attrs': 'ClassVar[dict[str, str]]', 'shape': 'ClassVar[str]', 'style': 'ClassVar[str]'}#
__dict__ = mappingproxy({'__module__': 'reno.diagrams', '__annotations__': {'default_color': 'ClassVar[dict[str, str]]', 'default_font_color': 'ClassVar[dict[str, str]]', 'default_sparkline_edge_color': 'ClassVar[dict[str, str]]', 'shape': 'ClassVar[str]', 'style': 'ClassVar[str]', 'other_attrs': 'ClassVar[dict[str, str]]', 'theme': 'str', 'edges': 'list[DiagramEdge]'}, '__doc__': 'Parent class for any type of node representing a reference in a model.', 'default_color': {'light': 'transparent', 'dark': '#333333'}, 'default_font_color': {'light': 'black', 'dark': '#e6e6e6'}, 'default_sparkline_edge_color': {'light': 'black', 'dark': '#e6e6e6'}, 'shape': 'rect', 'style': 'filled', 'other_attrs': {}, '__init__': <function DiagramNode.__init__>, 'configure_render': <function DiagramNode.configure_render>, 'configure_color': <function DiagramNode.configure_color>, 'check_str_or_listpart_in_list': <function DiagramNode.check_str_or_listpart_in_list>, 'check_str_or_listpart_in_dict': <function DiagramNode.check_str_or_listpart_in_dict>, 'graphviz_ref_node': <function DiagramNode.graphviz_ref_node>, 'add_to_graphviz': <function DiagramNode.add_to_graphviz>, 'add_edge': <staticmethod(<function DiagramNode.add_edge>)>, 'map_edges': <function DiagramNode.map_edges>, 'generate_sparkline': <function DiagramNode.generate_sparkline>, '__dict__': <attribute '__dict__' of 'DiagramNode' objects>, '__weakref__': <attribute '__weakref__' of 'DiagramNode' objects>})#
__module__ = 'reno.diagrams'#
__weakref__#

list of weak references to the object

static add_edge(edge)#

Add the given edge to _both_ involved nodes.

Static method because this doesn’t depend on either node in particular.

Parameters:

edge (DiagramEdge)

Return type:

None

add_to_graphviz(g=None)#

Add this node to the digraphviz Digraph, accounting for sparklines if needed.

Parameters:

g (Digraph)

Return type:

None

check_str_or_listpart_in_dict(keys, dictionary)#

Utility function to retrieve the value in a dictionary where the key is found in the passed value (either a singular string which would be a direct match, or a list where the key is found in that list).

This is primarily used for getting values associated with groups (e.g. colors).

Parameters:
  • keys (str | list)

  • dictionary (dict[str, str])

Return type:

str

check_str_or_listpart_in_list(vals, containing_list)#

Utility function to determine if a passed value (either a string or list of strings) is in (or at least one instance of the list is in) the passed containing list.

This is primarily used for checking containment of a group name/list of group names in set of group names.

Parameters:
  • vals (str | list)

  • containing_list (list[str])

Return type:

bool

configure_color(config)#

Determine what colors should be used for this node given the configuration.

Parameters:

config (RenderConfig)

Return type:

None

configure_render(config)#

Decide if this node should be rendered based on configuration and underlying reference.

Precedence/priority in this determination (earlier in the list overrides later): 1. An implicit reference is never rendered 2. If a universe is specified and the reference isn’t in it, don’t render it. 3. Individually specified show/hide references 4. Show/hide color groups 5. Default model hide groups 6. Blanket variable/metric on/off

Parameters:

config (RenderConfig)

Return type:

None

default_color: ClassVar[dict[str, str]] = {'dark': '#333333', 'light': 'transparent'}#
default_font_color: ClassVar[dict[str, str]] = {'dark': '#e6e6e6', 'light': 'black'}#
default_sparkline_edge_color: ClassVar[dict[str, str]] = {'dark': '#e6e6e6', 'light': 'black'}#
generate_sparkline()#

Returns the filepath of the saved plot so graphviz can display in a node.

Return type:

str

graphviz_ref_node(g=None)#

Add a node for the reference itself to the graph.

Parameters:

g (Digraph)

Return type:

None

map_edges()#

Find all connected nodes and determine how corresponding edges need to be drawn.

Return type:

None

other_attrs: ClassVar[dict[str, str]] = {}#
shape: ClassVar[str] = 'rect'#
style: ClassVar[str] = 'filled'#