Skip to content

Commit 22c89e3

Browse files
committed
attempt to fix the typing
1 parent 836aeca commit 22c89e3

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

xarray/core/coordinates.py

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ def merge(self, other: Mapping[Any, Any] | None) -> Dataset:
561561
variables=coords, coord_names=coord_names, indexes=indexes
562562
)
563563

564-
def __or__(self, other: Self) -> Self:
564+
def __or__(self, other: Mapping[Any, Any] | None) -> Coordinates:
565565
"""Merge two sets of coordinates to create a new Coordinates object
566566
567567
The method implements the logic used for joining coordinates in the
@@ -746,7 +746,12 @@ def copy(
746746

747747
def drop_vars(
748748
self,
749-
names: str | Iterable[Hashable] | Callable[[Self], str | Iterable[Hashable]],
749+
names: str
750+
| Iterable[Hashable]
751+
| Callable[
752+
[Coordinates | Dataset | DataArray | DataTree],
753+
str | Iterable[Hashable],
754+
],
750755
*,
751756
errors: ErrorOptions = "raise",
752757
) -> Self:
@@ -767,13 +772,13 @@ def drop_vars(
767772
- ``'ignore'``: any given names that are in the dataset are dropped and no
768773
error is raised.
769774
"""
770-
return self.to_dataset().drop_vars(names, errors=errors).coords
775+
return cast(Self, self.to_dataset().drop_vars(names, errors=errors).coords)
771776

772777
def rename_dims(
773778
self,
774779
dims_dict: Mapping[Any, Hashable] | None = None,
775780
**dims: Hashable,
776-
) -> Self:
781+
) -> Coordinates:
777782
"""Returns a new object with renamed dimensions only.
778783
779784
Parameters
@@ -797,7 +802,7 @@ def rename_vars(
797802
self,
798803
name_dict: Mapping[Any, Hashable] | None = None,
799804
**names: Hashable,
800-
) -> Self:
805+
) -> Coordinates:
801806
"""Returns a new object with renamed variables.
802807
803808
Parameters

0 commit comments

Comments
 (0)