Skip to content

Commit 6976e99

Browse files
lkk7ferdnycmr-c
authored
Allow for newer pydot version (#2019)
Co-authored-by: "FeRD (Frank Dana)" <[email protected]> Co-authored-by: Michael R. Crusoe <[email protected]>
1 parent 0418dab commit 6976e99

File tree

5 files changed

+19
-11
lines changed

5 files changed

+19
-11
lines changed

cwltool/cwlviewer.py

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,8 @@ def _set_inner_edges(self) -> None:
9999
self._dot_graph.add_node(n)
100100
self._dot_graph.add_edge(
101101
pydot.Edge(
102-
str(inner_edge_row["source_step"]),
103-
str(inner_edge_row["target_step"]),
102+
pydot.quote_id_if_necessary(str(inner_edge_row["source_step"])),
103+
pydot.quote_id_if_necessary(str(inner_edge_row["target_step"])),
104104
)
105105
)
106106

@@ -109,7 +109,6 @@ def _set_input_edges(self) -> None:
109109
inputs_subgraph = pydot.Subgraph(graph_name="cluster_inputs")
110110
self._dot_graph.add_subgraph(inputs_subgraph)
111111
inputs_subgraph.set("rank", "same")
112-
inputs_subgraph.create_attribute_methods(["style"])
113112
inputs_subgraph.set("style", "dashed")
114113
inputs_subgraph.set("label", "Workflow Inputs")
115114

@@ -129,14 +128,18 @@ def _set_input_edges(self) -> None:
129128
)
130129
n.set_name(str(input_row["input"]))
131130
inputs_subgraph.add_node(n)
132-
self._dot_graph.add_edge(pydot.Edge(str(input_row["input"]), str(input_row["step"])))
131+
self._dot_graph.add_edge(
132+
pydot.Edge(
133+
pydot.quote_id_if_necessary(str(input_row["input"])),
134+
pydot.quote_id_if_necessary(str(input_row["step"])),
135+
)
136+
)
133137

134138
def _set_output_edges(self) -> None:
135139
get_output_edges = _get_output_edges_query()
136140
outputs_graph = pydot.Subgraph(graph_name="cluster_outputs")
137141
self._dot_graph.add_subgraph(outputs_graph)
138142
outputs_graph.set("rank", "same")
139-
outputs_graph.create_attribute_methods(["style"])
140143
outputs_graph.set("style", "dashed")
141144
outputs_graph.set("label", "Workflow Outputs")
142145
outputs_graph.set("labelloc", "b")
@@ -156,7 +159,12 @@ def _set_output_edges(self) -> None:
156159
)
157160
n.set_name(str(output_edge_row["output"]))
158161
outputs_graph.add_node(n)
159-
self._dot_graph.add_edge(pydot.Edge(output_edge_row["step"], output_edge_row["output"]))
162+
self._dot_graph.add_edge(
163+
pydot.Edge(
164+
pydot.quote_id_if_necessary(output_edge_row["step"]),
165+
pydot.quote_id_if_necessary(output_edge_row["output"]),
166+
)
167+
)
160168

161169
def _get_root_graph_uri(self) -> rdflib.term.Identifier:
162170
get_root_query = _get_root_query()

mypy-stubs/pydot.pyi

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import Any, Dict, List, Sequence, Union
1+
from typing import Any, Dict, List, Optional, Sequence, Union
22

33
PY3: Any
44
str_type = str
@@ -12,6 +12,7 @@ def is_windows() -> bool: ...
1212
def is_anaconda() -> bool: ...
1313
def get_executable_extension() -> str: ...
1414
def graph_from_dot_data(s: str) -> List["Dot"]: ...
15+
def quote_id_if_necessary(s: str, unquoted_keywords: Optional[Sequence[str]] = None) -> str: ...
1516

1617
class Common:
1718
def set_parent_graph(self, parent_graph: "Graph") -> None: ...
@@ -21,7 +22,6 @@ class Common:
2122
def get_attributes(self) -> Dict[str, str]: ...
2223
def set_sequence(self, seq: str) -> None: ...
2324
def get_sequence(self) -> str: ...
24-
def create_attribute_methods(self, obj_attributes: List[str]) -> None: ...
2525

2626
class Error(Exception):
2727
value: Any

requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ mypy-extensions
77
psutil>=5.6.6
88
importlib_resources>=1.4;python_version<'3.9'
99
coloredlogs
10-
pydot>=1.4.1,<3
10+
pydot>=1.4.1
1111
argcomplete>=1.12.0
1212
pyparsing!=3.0.2 # breaks --print-dot (pydot) https://github.com/pyparsing/pyparsing/issues/319
1313
cwl-utils>=0.32

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ def _find_package_data(base: str, globs: list[str], root: str = "cwltool") -> li
156156
"mypy-extensions",
157157
"psutil >= 5.6.6",
158158
"coloredlogs",
159-
"pydot >= 1.4.1, <3",
159+
"pydot >= 1.4.1",
160160
"argcomplete >= 1.12.0",
161161
"pyparsing != 3.0.2", # breaks --print-dot (pydot) https://github.com/pyparsing/pyparsing/issues/319
162162
"cwl-utils >= 0.32",

tests/test_context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import logging
22
import subprocess
33
import sys
4+
from collections.abc import MutableMapping
45
from io import StringIO
56
from pathlib import Path
67
from typing import cast
7-
from collections.abc import MutableMapping
88

99
from cwltool.context import RuntimeContext
1010
from cwltool.factory import Factory

0 commit comments

Comments
 (0)