Skip to content

Commit 1ad2e51

Browse files
committed
typing
1 parent 8d2d7ad commit 1ad2e51

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

xarray/core/groupby.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1357,7 +1357,12 @@ def where(self, cond, other=dtypes.NA) -> T_Xarray:
13571357
"""
13581358
return ops.where_method(self, cond, other)
13591359

1360-
def _first_or_last(self, op: str, skipna: bool | None, keep_attrs: bool | None):
1360+
def _first_or_last(
1361+
self,
1362+
op: Literal["first" | "last"],
1363+
skipna: bool | None,
1364+
keep_attrs: bool | None,
1365+
):
13611366
if all(
13621367
isinstance(maybe_slice, slice)
13631368
and (maybe_slice.stop == maybe_slice.start + 1)
@@ -1369,13 +1374,12 @@ def _first_or_last(self, op: str, skipna: bool | None, keep_attrs: bool | None):
13691374
if keep_attrs is None:
13701375
keep_attrs = _get_keep_attrs(default=True)
13711376
if (
1372-
skipna
1373-
and module_available("flox", minversion="0.9.16")
1377+
module_available("flox", minversion="0.9.16")
13741378
and OPTIONS["use_flox"]
13751379
and contains_only_chunked_or_numpy(self._obj)
13761380
):
13771381
result, *_ = self._flox_reduce(
1378-
dim=None, func=f"nan{op}" if skipna else op, keep_attrs=keep_attrs
1382+
dim=None, func=op, skipna=skipna, keep_attrs=keep_attrs
13791383
)
13801384
else:
13811385
result = self.reduce(

0 commit comments

Comments
 (0)