From 16bee67280aab8b37f263eaa7e6cac2d46525134 Mon Sep 17 00:00:00 2001 From: Michael Niklas Date: Fri, 12 Jul 2024 23:22:01 +0200 Subject: [PATCH] fix classvars --- xarray/coding/cftime_offsets.py | 6 +++--- xarray/tests/test_cftime_offsets.py | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/xarray/coding/cftime_offsets.py b/xarray/coding/cftime_offsets.py index 90478dffe2d..9dbc60ef0f3 100644 --- a/xarray/coding/cftime_offsets.py +++ b/xarray/coding/cftime_offsets.py @@ -112,8 +112,8 @@ def get_date_type(calendar, use_cftime=True): class BaseCFTimeOffset: - _freq: ClassVar[str] - _day_option: ClassVar[DayOption] + _freq: ClassVar[str | None] = None + _day_option: ClassVar[DayOption | None] = None n: int def __init__(self, n: int = 1) -> None: @@ -124,7 +124,7 @@ def __init__(self, n: int = 1) -> None: ) self.n = n - def rule_code(self) -> str: + def rule_code(self) -> str | None: return self._freq def __eq__(self, other: object) -> bool: diff --git a/xarray/tests/test_cftime_offsets.py b/xarray/tests/test_cftime_offsets.py index eabb7d2f4d6..78aa49c7f83 100644 --- a/xarray/tests/test_cftime_offsets.py +++ b/xarray/tests/test_cftime_offsets.py @@ -511,7 +511,7 @@ def test_Microsecond_multiplied_float_error(): ], ids=_id_func, ) -def test_neg(offset, expected): +def test_neg(offset: BaseCFTimeOffset, expected: BaseCFTimeOffset) -> None: assert -offset == expected