Skip to content

Commit bf03b31

Browse files
committed
Revert special casing display
We don't want this in general Hamilton.
1 parent f384d58 commit bf03b31

1 file changed

Lines changed: 8 additions & 11 deletions

File tree

hamilton/graph.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@
1010
import inspect
1111
import logging
1212
import os.path
13-
14-
# import pathlib
13+
import pathlib
1514
import uuid
1615
from enum import Enum
1716
from types import ModuleType
@@ -939,15 +938,13 @@ def display(
939938
# - `render()` accepts a `view` kwarg
940939
# - `render()` will append it's kwarg `format` to the filename
941940
if output_file_path:
942-
with open(output_file_path + ".dot", "w") as f:
943-
f.write(str(dot))
944-
# if keep_dot:
945-
# kwargs["view"] = kwargs.get("view", False)
946-
# dot.render(output_file_path, **kwargs)
947-
# else:
948-
# kwargs.pop("view", None)
949-
# output_file_path = f"{output_file_path}.{kwargs['format']}"
950-
# pathlib.Path(output_file_path).write_bytes(dot.pipe(**kwargs))
941+
if keep_dot:
942+
kwargs["view"] = kwargs.get("view", False)
943+
dot.render(output_file_path, **kwargs)
944+
else:
945+
kwargs.pop("view", None)
946+
output_file_path = f"{output_file_path}.{kwargs['format']}"
947+
pathlib.Path(output_file_path).write_bytes(dot.pipe(**kwargs))
951948
return dot
952949

953950
def get_impacted_nodes(self, var_changes: List[str]) -> Set[node.Node]:

0 commit comments

Comments
 (0)