weldx.asdf.utils.
drop_none_attr
Utility function simplify to_tree methods of dataclass objects.
to_tree
The function requires the node to be convertible to dictionary via __dict__. And can therefore be applied to all classes created using the @dataclass operator. The result is “clean” dictionary with all None entries removed. A simple to_tree function could be implemented as such:
__dict__
def to_tree(cls, node, ctx): tree = drop_none_attr(node) return tree
node – node to write to asdf-tree
The node dictionary with None entries removed.
dict