datatree
datatree copied to clipboard
Typing: `DataTree[Unknown]`
Try to instantiate a DataTree
:
root = DataTree(name="root")
VSCode with Pylance will complain:
Type of "root" is partially unknown
Type of "root" is "DataTree[Unknown]"
Pylance[reportUnknownVariableType](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportUnknownVariableType)
(variable) root: DataTree[Unknown]
Going to the DataTree
class definition and hovering the Mapping
parent class:
Expected type arguments for generic class "Mapping"
Pylance[reportMissingTypeArgument](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportMissingTypeArgument)
(class) Mapping
Same for NamedNode
:
Expected type arguments for generic class "NamedNode"
Pylance[reportMissingTypeArgument](https://github.com/microsoft/pyright/blob/main/docs/configuration.md#reportMissingTypeArgument)
(class) NamedNode
A TreeNode which knows its own name.
Implements path-like relationships to other nodes in its tree.
If we compare to the Dataset
definition in xarray
:
https://github.com/pydata/xarray/blob/ff0d056ec9e99dece0202d8d73c1cb8c6c20b2a1/xarray/core/dataset.py#L511
We can see that the type parameters of Mapping
are provided