Skip to content

Commit

Permalink
mypy fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
jbrockmendel committed Dec 7, 2023
1 parent 64a7bf6 commit 12c4575
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions pandas/core/arrays/period.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 12c4575

Please sign in to comment.