Skip to content

Commit d8687b2

Browse files
committed
ENH(op): move prepare_plot() up to Abstract Op class
1 parent fef2bb6 commit d8687b2

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

graphtik/base.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -909,3 +909,22 @@ def rename_driver(ren_args: RenArgs) -> str:
909909
(renamed_provides[k], rename_driver(ren_args._replace(name=v)),)
910910
for k, v in kw.get("aliases", self.aliases) # pylint: disable=no-member
911911
]
912+
913+
def prepare_plot_args(self, plot_args: PlotArgs) -> PlotArgs:
914+
"""Delegate to a provisional network with a single op . """
915+
from .pipeline import compose
916+
from .plot import graphviz_html_string
917+
918+
is_user_label = bool(plot_args.graph and plot_args.graph.get("graphviz.label"))
919+
plottable = compose(self.name, self)
920+
plot_args = plot_args.with_defaults(name=self.name)
921+
plot_args = plottable.prepare_plot_args(plot_args)
922+
assert plot_args.graph, plot_args
923+
924+
## Operations don't need another name visible.
925+
#
926+
if is_user_label:
927+
del plot_args.graph.graph["graphviz.label"]
928+
plot_args = plot_args._replace(plottable=self)
929+
930+
return plot_args

0 commit comments

Comments
 (0)