Skip to content

Enforce ruff/flake8-simplify rules (SIM) #10462

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

Merged
merged 8 commits into from
Jun 30, 2025
Prev Previous commit
Next Next commit
Apply ruff/flake8-simplify rule SIM114
SIM114 Combine `if` branches using logical `or` operator
  • Loading branch information
DimitriPapadopoulos committed Jun 29, 2025
commit 566199c6a42ef5fb364a888cbe2e62e8058c9a06
27 changes: 11 additions & 16 deletions xarray/core/resample_cftime.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,22 +84,17 @@ def __init__(
self.freq = to_offset(freq)
self.origin = origin

if isinstance(self.freq, MonthEnd | QuarterEnd | YearEnd):
if closed is None:
self.closed = "right"
else:
self.closed = closed
if label is None:
self.label = "right"
else:
self.label = label
# The backward resample sets ``closed`` to ``'right'`` by default
# since the last value should be considered as the edge point for
# the last bin. When origin in "end" or "end_day", the value for a
# specific ``cftime.datetime`` index stands for the resample result
# from the current ``cftime.datetime`` minus ``freq`` to the current
# ``cftime.datetime`` with a right close.
elif self.origin in ["end", "end_day"]:
if (
isinstance(self.freq, MonthEnd | QuarterEnd | YearEnd)
or
# The backward resample sets ``closed`` to ``'right'`` by default
# since the last value should be considered as the edge point for
# the last bin. When origin in "end" or "end_day", the value for a
# specific ``cftime.datetime`` index stands for the resample result
# from the current ``cftime.datetime`` minus ``freq`` to the current
# ``cftime.datetime`` with a right close.
self.origin in ["end", "end_day"]
):
if closed is None:
self.closed = "right"
else:
Expand Down
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy