Spaces:
Runtime error
Runtime error
ugmSorcero
commited on
Commit
·
e4aa90a
1
Parent(s):
236ecdd
Fixes linting
Browse files
interface/draw_pipelines.py
CHANGED
|
@@ -6,6 +6,7 @@ import plotly.graph_objs as go
|
|
| 6 |
import streamlit as st
|
| 7 |
import numpy as np
|
| 8 |
|
|
|
|
| 9 |
@st.cache(allow_output_mutation=True)
|
| 10 |
def get_pipeline_graph(pipeline):
|
| 11 |
# Controls for how the graph is drawn
|
|
@@ -16,7 +17,10 @@ def get_pipeline_graph(pipeline):
|
|
| 16 |
|
| 17 |
G = pipeline.graph
|
| 18 |
initial_coordinate = (0, len(G.nodes))
|
| 19 |
-
fixed_pos = {
|
|
|
|
|
|
|
|
|
|
| 20 |
pos = nx.spring_layout(G, pos=fixed_pos, seed=42)
|
| 21 |
|
| 22 |
for node in G.nodes:
|
|
@@ -27,7 +31,7 @@ def get_pipeline_graph(pipeline):
|
|
| 27 |
node_y = []
|
| 28 |
node_name = []
|
| 29 |
for node in G.nodes():
|
| 30 |
-
node_name.append(G.nodes[node][
|
| 31 |
x, y = G.nodes[node]["pos"]
|
| 32 |
node_x.append(x)
|
| 33 |
node_y.append(y)
|
|
@@ -64,10 +68,10 @@ def get_pipeline_graph(pipeline):
|
|
| 64 |
y=node_y,
|
| 65 |
mode="markers+text",
|
| 66 |
textposition="middle right",
|
| 67 |
-
hoverinfo=
|
| 68 |
text=node_name,
|
| 69 |
marker=dict(showscale=False, color=nodeColor, size=nodeSize),
|
| 70 |
-
textfont=dict(size=18)
|
| 71 |
)
|
| 72 |
|
| 73 |
fig = go.Figure(
|
|
@@ -87,6 +91,7 @@ def get_pipeline_graph(pipeline):
|
|
| 87 |
|
| 88 |
return fig
|
| 89 |
|
|
|
|
| 90 |
def addEdge(
|
| 91 |
start,
|
| 92 |
end,
|
|
@@ -222,4 +227,3 @@ def add_arrows(
|
|
| 222 |
y_arrows = arrow_line_1y_coords + arrow_line_2y_coords
|
| 223 |
|
| 224 |
return x_arrows, y_arrows
|
| 225 |
-
|
|
|
|
| 6 |
import streamlit as st
|
| 7 |
import numpy as np
|
| 8 |
|
| 9 |
+
|
| 10 |
@st.cache(allow_output_mutation=True)
|
| 11 |
def get_pipeline_graph(pipeline):
|
| 12 |
# Controls for how the graph is drawn
|
|
|
|
| 17 |
|
| 18 |
G = pipeline.graph
|
| 19 |
initial_coordinate = (0, len(G.nodes))
|
| 20 |
+
fixed_pos = {
|
| 21 |
+
node: np.array([initial_coordinate[0], initial_coordinate[1] - float(idx)])
|
| 22 |
+
for idx, node in enumerate(G.nodes)
|
| 23 |
+
}
|
| 24 |
pos = nx.spring_layout(G, pos=fixed_pos, seed=42)
|
| 25 |
|
| 26 |
for node in G.nodes:
|
|
|
|
| 31 |
node_y = []
|
| 32 |
node_name = []
|
| 33 |
for node in G.nodes():
|
| 34 |
+
node_name.append(G.nodes[node]["component"].name)
|
| 35 |
x, y = G.nodes[node]["pos"]
|
| 36 |
node_x.append(x)
|
| 37 |
node_y.append(y)
|
|
|
|
| 68 |
y=node_y,
|
| 69 |
mode="markers+text",
|
| 70 |
textposition="middle right",
|
| 71 |
+
hoverinfo="none",
|
| 72 |
text=node_name,
|
| 73 |
marker=dict(showscale=False, color=nodeColor, size=nodeSize),
|
| 74 |
+
textfont=dict(size=18),
|
| 75 |
)
|
| 76 |
|
| 77 |
fig = go.Figure(
|
|
|
|
| 91 |
|
| 92 |
return fig
|
| 93 |
|
| 94 |
+
|
| 95 |
def addEdge(
|
| 96 |
start,
|
| 97 |
end,
|
|
|
|
| 227 |
y_arrows = arrow_line_1y_coords + arrow_line_2y_coords
|
| 228 |
|
| 229 |
return x_arrows, y_arrows
|
|
|