Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core.missing typing #9584

Draft
wants to merge 13 commits into
base: main
Choose a base branch
from
6 changes: 3 additions & 3 deletions xarray/core/dataarray.py
Original file line number Diff line number Diff line change
Expand Up @@ -3592,7 +3592,7 @@ def interpolate_na(
"""
from xarray.core.missing import interp_na

return interp_na(
return interp_na( # type: ignore[return-value]
self,
dim=dim,
method=method,
Expand Down Expand Up @@ -3685,7 +3685,7 @@ def ffill(self, dim: Hashable, limit: int | None = None) -> Self:
"""
from xarray.core.missing import ffill

return ffill(self, dim, limit=limit)
return ffill(self, dim, limit=limit) # type: ignore[return-value]

def bfill(self, dim: Hashable, limit: int | None = None) -> Self:
"""Fill NaN values by propagating values backward
Expand Down Expand Up @@ -3769,7 +3769,7 @@ def bfill(self, dim: Hashable, limit: int | None = None) -> Self:
"""
from xarray.core.missing import bfill

return bfill(self, dim, limit=limit)
return bfill(self, dim, limit=limit) # type: ignore[return-value]

def combine_first(self, other: Self) -> Self:
"""Combine two DataArray objects, with union of coordinates.
Expand Down
8 changes: 4 additions & 4 deletions xarray/core/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -4077,7 +4077,7 @@ def _validate_interp_indexer(x, new_x):
# optimization: subset to coordinate range of the target index
if method in ["linear", "nearest"]:
for k, v in validated_indexers.items():
obj, newidx = missing._localize(obj, {k: v})
obj, newidx = missing._localize(obj, {k: v}) # type: ignore[assignment, arg-type]
validated_indexers[k] = newidx[k]

# optimization: create dask coordinate arrays once per Dataset
Expand Down Expand Up @@ -6758,7 +6758,7 @@ def interpolate_na(
max_gap=max_gap,
**kwargs,
)
return new
return new # type: ignore[return-value]

def ffill(self, dim: Hashable, limit: int | None = None) -> Self:
"""Fill NaN values by propagating values forward
Expand Down Expand Up @@ -6822,7 +6822,7 @@ def ffill(self, dim: Hashable, limit: int | None = None) -> Self:
from xarray.core.missing import _apply_over_vars_with_dim, ffill

new = _apply_over_vars_with_dim(ffill, self, dim=dim, limit=limit)
return new
return new # type: ignore[return-value]

def bfill(self, dim: Hashable, limit: int | None = None) -> Self:
"""Fill NaN values by propagating values backward
Expand Down Expand Up @@ -6887,7 +6887,7 @@ def bfill(self, dim: Hashable, limit: int | None = None) -> Self:
from xarray.core.missing import _apply_over_vars_with_dim, bfill

new = _apply_over_vars_with_dim(bfill, self, dim=dim, limit=limit)
return new
return new # type: ignore[return-value]

def combine_first(self, other: Self) -> Self:
"""Combine two Datasets, default to data_vars of self.
Expand Down
Loading
Loading