Skip to content

Commit

Permalink
docstring and fix
Browse files Browse the repository at this point in the history
  • Loading branch information
Licini committed Jan 4, 2024
1 parent 37f85f0 commit 01266b7
Showing 1 changed file with 6 additions and 10 deletions.
16 changes: 6 additions & 10 deletions src/compas/datastructures/tree/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,8 @@ class TreeNode(Data):
Parameters
----------
name : str, optional
The name of the tree ndoe.
attributes : dict[str, Any], optional
User-defined attributes of the datastructure.
**kwargs : dict[str, Any], optional
User-defined attributes of the tree node.
Attributes
----------
Expand Down Expand Up @@ -94,7 +92,7 @@ def data(self):

@classmethod
def from_data(cls, data):
node = cls(attributes=data["attributes"])
node = cls(**data["attributes"])
for child in data["children"]:
node.add(cls.from_data(child))
return node
Expand Down Expand Up @@ -206,10 +204,8 @@ class Tree(Datastructure):
Parameters
----------
name : str, optional
The name of the datastructure.
attributes : dict[str, Any], optional
User-defined attributes of the datastructure.
**kwargs : dict[str, Any], optional
User-defined attributes of the tree.
Attributes
----------
Expand Down Expand Up @@ -264,7 +260,7 @@ def data(self):

@classmethod
def from_data(cls, data):
tree = cls(attributes=data["attributes"])
tree = cls(**data["attributes"])
root = TreeNode.from_data(data["root"])
tree.add(root)
return tree
Expand Down

0 comments on commit 01266b7

Please sign in to comment.