We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 2a288f6 commit 34e3ce0Copy full SHA for 34e3ce0
xarray/core/dataset.py
@@ -27,6 +27,7 @@
27
TypeVar,
28
Union,
29
cast,
30
+ overload,
31
)
32
33
import numpy as np
@@ -1240,8 +1241,15 @@ def loc(self) -> _LocIndexer:
1240
1241
and only when the key is a dict of the form {dim: labels}.
1242
"""
1243
return _LocIndexer(self)
1244
+
1245
- def __getitem__(self, key: Any) -> "Union[DataArray, Dataset]":
1246
+ @overload
1247
+ def __getitem__(self, key: Hashable) -> DataArray: ...
1248
1249
1250
+ def __getitem__(self, key: Any) -> Dataset: ...
1251
1252
+ def __getitem__(self, key):
1253
"""Access variables or coordinates this dataset as a
1254
:py:class:`~xarray.DataArray`.
1255
0 commit comments