Skip to content

Commit

Permalink
Add overload for Mapping behavior
Browse files Browse the repository at this point in the history
Sadly this is not working with my version of mypy. See python/mypy#7328
  • Loading branch information
nbren12 committed Jun 10, 2020
1 parent 34e3ce0 commit 414ee30
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -1241,13 +1241,18 @@ def loc(self) -> _LocIndexer:
and only when the key is a dict of the form {dim: labels}.
"""
return _LocIndexer(self)


@overload
def __getitem__(self, key: Hashable) -> DataArray: ...
def __getitem__(self, key: Hashable) -> DataArray:
...

@overload
def __getitem__(self, key: Any) -> Dataset: ...
def __getitem__(self, key: Mapping) -> "Dataset":
...

@overload
def __getitem__(self, key: List) -> "Dataset":
...

def __getitem__(self, key):
"""Access variables or coordinates this dataset as a
Expand Down

0 comments on commit 414ee30

Please sign in to comment.