Skip to content

Commit 321a8f9

Browse files
Apply ruff/flake8-pyi rule PYI034
PYI034 such methods usually return `self` at runtime
1 parent 51b7594 commit 321a8f9

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@ ignore = [
284284
# don't enforce absolute imports
285285
"asv_bench/**" = ["TID252"]
286286
# looks like ruff bugs
287+
"xarray/core/_typed_ops.py" = ["PYI034"]
287288
"xarray/namedarray/_typing.py" = ["PYI018"]
288289

289290
[tool.ruff.lint.isort]

xarray/core/accessor_dt.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import numpy as np
77
import pandas as pd
8+
from typing_extensions import Self
89

910
from xarray.coding.calendar_ops import _decimal_year
1011
from xarray.coding.times import infer_calendar_name
@@ -650,7 +651,7 @@ def total_seconds(self) -> T_DataArray:
650651
class CombinedDatetimelikeAccessor(
651652
DatetimeAccessor[T_DataArray], TimedeltaAccessor[T_DataArray]
652653
):
653-
def __new__(cls, obj: T_DataArray) -> CombinedDatetimelikeAccessor:
654+
def __new__(cls, obj: T_DataArray) -> Self:
654655
# CombinedDatetimelikeAccessor isn't really instantiated. Instead
655656
# we need to choose which parent (datetime or timedelta) is
656657
# appropriate. Since we're checking the dtypes anyway, we'll just

0 commit comments

Comments
 (0)