diff --git a/niceml/mkdocs/mdgraph.py b/niceml/mkdocs/mdgraph.py index 459f0714..f5e45bdb 100644 --- a/niceml/mkdocs/mdgraph.py +++ b/niceml/mkdocs/mdgraph.py @@ -6,15 +6,15 @@ def get_graph_md(job: JobDefinition) -> str: """Creates a graph as str with material for mkdocs""" deps = job.graph.dependencies graph_str = "" - for key, value in deps.items(): - for _, val2 in value.items(): - if isinstance(val2, DependencyDefinition): - graph_str += f" {val2.node} --> {key.name};\n" - elif isinstance(val2, MultiDependencyDefinition): - for dependency in val2.dependencies: - graph_str += f" {dependency.node} --> {key.name};\n" + for node, node_dependencies in deps.items(): + for _, dependencies in node_dependencies.items(): + if isinstance(dependencies, DependencyDefinition): + graph_str += f" {dependencies.node} --> {node.name};\n" + elif isinstance(dependencies, MultiDependencyDefinition): + for dependency in dependencies.dependencies: + graph_str += f" {dependency.node} --> {node.name};\n" else: - raise AttributeError("'val2' is not of expected type.") + raise AttributeError("'dependencies' is not of expected type.") if len(graph_str) == 0: return ""