Skip to content

Commit

Permalink
fixed pep8 errors
Browse files Browse the repository at this point in the history
  • Loading branch information
naylor-b committed Mar 27, 2024
1 parent 9d1a6a3 commit e86a7f2
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 15 deletions.
17 changes: 9 additions & 8 deletions openmdao/core/group.py
Expand Up @@ -4356,7 +4356,8 @@ def _get_cluster_tree(self, node_info):
groups = {}

if not mypath:
groups[''] = pydot.Cluster('', label='Model', style='filled', fillcolor=_cluster_color(''),
groups[''] = pydot.Cluster('', label='Model', style='filled',
fillcolor=_cluster_color(''),
tooltip=node_info['']['tooltip'])
pydot_graph.add_subgraph(groups[''])

Expand All @@ -4367,7 +4368,7 @@ def _get_cluster_tree(self, node_info):
# reverse the list so parents will exist before children
ancestor_list = list(all_ancestors(group))[::-1]
for path in ancestor_list:
if path.startswith(prefix) or path==mypath:
if path.startswith(prefix) or path == mypath:
if path not in groups:
parent, _, name = path.rpartition('.')
groups[path] = pydot.Cluster(path,
Expand Down Expand Up @@ -4600,7 +4601,7 @@ def write_graph(self, gtype='dataflow', recurse=True, show_vars=False,
"""
if pydot is None:
issue_warning("To view the system graph, you must install pydot. "
"You can install it via 'pip install pydot'.")
"You can install it via 'pip install pydot'.")
return

if gtype == 'tree':
Expand Down Expand Up @@ -4640,17 +4641,17 @@ def write_graph(self, gtype='dataflow', recurse=True, show_vars=False,
if the_in not in G:
G.add_node(the_in, type_='input', label=prom_in)
else:
l = prom_in[:lenpre] if prom_in.startswith(prefix) else prom_in
G.nodes[the_in]['label'] = l
label = prom_in[:lenpre] if prom_in.startswith(prefix) else prom_in
G.nodes[the_in]['label'] = label

sysout = prefix + abs_out[lenpre:].partition('.')[0]
prom_out = self._var_allprocs_abs2prom['output'][abs_out]

if sysout not in G:
G.add_node(sysout, **_base_display_map['Group'])

l = prom_out[:lenpre] if prom_out.startswith(prefix) else prom_out
G.nodes[abs_out]['label'] = l
label = prom_out[:lenpre] if prom_out.startswith(prefix) else prom_out
G.nodes[abs_out]['label'] = label
G.add_edge(sysout, abs_out)

keep.add(sysout)
Expand All @@ -4673,7 +4674,7 @@ def write_graph(self, gtype='dataflow', recurse=True, show_vars=False,

if self.pathname == '':
if not recurse:
G = nx.subgraph(G, keep)
G = nx.subgraph(G, keep)
else:
# we're not the top level group, so get our subgraph of the top level graph
ournodes = {n for n in G.nodes() if n.startswith(prefix)}
Expand Down
14 changes: 7 additions & 7 deletions openmdao/utils/graph_utils.py
Expand Up @@ -181,8 +181,7 @@ def _to_pydot_graph(G):

for u, v, meta in G.edges(data=True):
pydot_graph.add_edge(pydot.Edge(pydot_nodes[u], pydot_nodes[v],
**_filter_meta4dot(meta,
arrowsize=0.5)))
**_filter_meta4dot(meta, arrowsize=0.5)))

# layout graph from left to right
pydot_graph.set_rankdir('LR')
Expand Down Expand Up @@ -253,13 +252,14 @@ def _add_boundary_nodes(pathname, G, incoming, outgoing, exclude=()):
if in_abs in G:
connstrs.add(f" {out_abs} -> {in_abs[lenpre:]}")
tooltip += sorted(connstrs)
tooltip='\n'.join(tooltip)
tooltip = '\n'.join(tooltip)
if connstrs:
G.add_node('_Incoming', label='Incoming', shape='rarrow', fillcolor='peachpuff3',
style='filled', tooltip=f'"{tooltip}"', rank='min')
style='filled', tooltip=f'"{tooltip}"', rank='min')
for in_abs, out_abs in incoming:
if in_abs in G:
G.add_edge('_Incoming', in_abs, style='dashed', arrowhead='lnormal', arrowsize=0.5)
G.add_edge('_Incoming', in_abs, style='dashed', arrowhead='lnormal',
arrowsize=0.5)

if outgoing:
tooltip = ['External Connections:']
Expand All @@ -268,9 +268,9 @@ def _add_boundary_nodes(pathname, G, incoming, outgoing, exclude=()):
if out_abs in G:
connstrs.add(f" {out_abs[lenpre:]} -> {in_abs}")
tooltip += sorted(connstrs)
tooltip='\n'.join(tooltip)
tooltip = '\n'.join(tooltip)
G.add_node('_Outgoing', label='Outgoing', arrowhead='rarrow', fillcolor='peachpuff3',
style='filled', tooltip=f'"{tooltip}"', rank='max')
style='filled', tooltip=f'"{tooltip}"', rank='max')
for in_abs, out_abs in outgoing:
if out_abs in G:
G.add_edge(out_abs, '_Outgoing', style='dashed', shape='lnormal', arrowsize=0.5)
Expand Down

0 comments on commit e86a7f2

Please sign in to comment.