From 12c4575ee11f47f63526a8ce8542a65dcb4156bc Mon Sep 17 00:00:00 2001 From: Brock Date: Thu, 7 Dec 2023 10:16:44 -0800 Subject: [PATCH] mypy fixup --- pandas/core/arrays/period.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/pandas/core/arrays/period.py b/pandas/core/arrays/period.py index 457419cacf9e7..5f267a9f816e7 100644 --- a/pandas/core/arrays/period.py +++ b/pandas/core/arrays/period.py @@ -370,10 +370,15 @@ def _unbox_scalar( # type: ignore[override] def _scalar_from_string(self, value: str) -> Period: return Period(value, freq=self.freq) - def _check_compatible_with(self, other: Period | NaTType | PeriodArray) -> None: + # error: Argument 1 of "_check_compatible_with" is incompatible with + # supertype "DatetimeLikeArrayMixin"; supertype defines the argument type + # as "Period | Timestamp | Timedelta | NaTType" + def _check_compatible_with(self, other: Period | NaTType | PeriodArray) -> None: # type: ignore[override] if other is NaT: return - self._require_matching_freq(other.freq) + # error: Item "NaTType" of "Period | NaTType | PeriodArray" has no + # attribute "freq" + self._require_matching_freq(other.freq) # type: ignore[union-attr] # -------------------------------------------------------------------- # Data / Attributes