Skip to content

Commit

Permalink
Add overload to get_axis_num
Browse files Browse the repository at this point in the history
  • Loading branch information
Illviljan committed Dec 12, 2023
1 parent 0bf38c2 commit 6231ae2
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions xarray/core/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,14 @@ def __iter__(self: Any) -> Iterator[Any]:
raise TypeError("iteration over a 0-d array")
return self._iter()

@overload
def get_axis_num(self, dim: Iterable[Hashable]) -> tuple[int, ...]:
...

@overload
def get_axis_num(self, dim: Hashable) -> int:
...

def get_axis_num(self, dim: Hashable | Iterable[Hashable]) -> int | tuple[int, ...]:
"""Return axis number(s) corresponding to dimension(s) in this array.
Expand Down

0 comments on commit 6231ae2

Please sign in to comment.