File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1010import inspect
1111import logging
1212import os .path
13-
14- # import pathlib
13+ import pathlib
1514import uuid
1615from enum import Enum
1716from 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 ]:
You can’t perform that action at this time.
0 commit comments