fix repr when there are non-Fluxion modules in a tree
Some checks failed
CI / lint_and_typecheck (push) Has been cancelled
Deploy docs to GitHub Pages / Deploy docs (push) Has been cancelled
Spell checker / Spell check (push) Has been cancelled

This commit is contained in:
Pierre Chapuis 2024-08-08 15:26:55 +02:00
parent b4ee65b9b1
commit 928da1ee1c

View file

@ -358,7 +358,10 @@ class ModuleTree:
node: TreeNode = {"value": value, "class_name": class_name, "children": []} node: TreeNode = {"value": value, "class_name": class_name, "children": []}
for child in module.children(): for child in module.children():
node["children"].append(self._module_to_tree(module=child)) # type: ignore if isinstance(child, Module):
node["children"].append(self._module_to_tree(module=child))
else:
node["children"].append({"value": str(child), "class_name": child.__class__.__name__, "children": []})
return node return node
def _fold_successive_identical(self, node: TreeNode) -> None: def _fold_successive_identical(self, node: TreeNode) -> None: