Skip to content

Commit cc94a94

Browse files
committed
Cleanup
1 parent a1e176b commit cc94a94

File tree

2 files changed

+12
-15
lines changed

2 files changed

+12
-15
lines changed

xarray/core/_aggregations.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3609,7 +3609,7 @@ def median(
36093609
if (
36103610
flox_available
36113611
and OPTIONS["use_flox"]
3612-
and module_available("flox", minversion="0.9.1")
3612+
and module_available("flox", minversion="0.9.2")
36133613
and contains_only_chunked_or_numpy(self._obj)
36143614
):
36153615
return self._flox_reduce(
@@ -5126,7 +5126,7 @@ def median(
51265126
if (
51275127
flox_available
51285128
and OPTIONS["use_flox"]
5129-
and module_available("flox", minversion="0.9.1")
5129+
and module_available("flox", minversion="0.9.2")
51305130
and contains_only_chunked_or_numpy(self._obj)
51315131
):
51325132
return self._flox_reduce(
@@ -6544,7 +6544,7 @@ def median(
65446544
if (
65456545
flox_available
65466546
and OPTIONS["use_flox"]
6547-
and module_available("flox", minversion="0.9.1")
6547+
and module_available("flox", minversion="0.9.2")
65486548
and contains_only_chunked_or_numpy(self._obj)
65496549
):
65506550
return self._flox_reduce(
@@ -7952,7 +7952,7 @@ def median(
79527952
if (
79537953
flox_available
79547954
and OPTIONS["use_flox"]
7955-
and module_available("flox", minversion="0.9.1")
7955+
and module_available("flox", minversion="0.9.2")
79567956
and contains_only_chunked_or_numpy(self._obj)
79577957
):
79587958
return self._flox_reduce(

xarray/util/generate_aggregations.py

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -464,19 +464,16 @@ def generate_code(self, method, has_keep_attrs):
464464
**kwargs,
465465
)"""
466466

467-
else:
468-
return (
469-
"""\
467+
min_version_check = f"""
468+
and module_available("flox", minversion="{method.min_flox_version}")"""
469+
470+
return (
471+
"""\
470472
if (
471473
flox_available
472474
and OPTIONS["use_flox"]"""
473-
+ (
474-
f"""
475-
and module_available("flox", minversion="{method.min_flox_version}")"""
476-
if method.min_flox_version is not None
477-
else ""
478-
)
479-
+ f"""
475+
+ (min_version_check if method.min_flox_version is not None else "")
476+
+ f"""
480477
and contains_only_chunked_or_numpy(self._obj)
481478
):
482479
return self._flox_reduce(
@@ -493,7 +490,7 @@ def generate_code(self, method, has_keep_attrs):
493490
keep_attrs=keep_attrs,
494491
**kwargs,
495492
)"""
496-
)
493+
)
497494

498495

499496
class GenericAggregationGenerator(AggregationGenerator):

0 commit comments

Comments
 (0)