Typing: `DataTree[Unknown]`
Closed this issue · 1 comments
etienneschalk commented
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
:
We can see that the type parameters of Mapping
are provided
TomNicholas commented
This was probably closed by pydata/xarray#9445 - we can re-open upstream if not.