You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Oct 24, 2024. It is now read-only.
I'm working on adding conversion to a DataTree object in the Satpy library and while writing some tests I've come across a quality of life change I'm hoping is possible/allowed to add. Basically, I want to be able to check if a node is in a tree in the same way I can access that node using the / syntax. For example:
In [1]: fromdatatreeimportDataTreeIn [3]: a=DataTree.from_dict({"a/b/c": None})
In [4]: a["a/b"]
Out[4]:
DataTree('b', parent="a")
└── DataTree('c')
In [5]: "a/b"inaOut[5]: False
I expected (with very limited prior usage/knowledge of DataTree) that the __contains__ method would do the same or similar traversal as the __getitem__ method. In the above case the in line would return True.
Is there a functional reason why this can't be implemented this way? Any issues or gotchas you can foresee if I were to implement it (performance maybe?)?
Edit: Oops forgot to include the tree creation line.