|
1 | 1 | # -*- coding: utf-8 -*-
|
2 | 2 | from datetime import timedelta
|
3 | 3 | import operator
|
| 4 | +from typing import Any, Callable, Optional, Sequence, Union |
4 | 5 |
|
5 | 6 | import numpy as np
|
6 | 7 |
|
7 | 8 | from pandas._libs.tslibs import (
|
8 |
| - NaT, frequencies as libfrequencies, iNaT, period as libperiod) |
| 9 | + NaT, NaTType, frequencies as libfrequencies, iNaT, period as libperiod) |
9 | 10 | from pandas._libs.tslibs.fields import isleapyear_arr
|
10 | 11 | from pandas._libs.tslibs.period import (
|
11 | 12 | DIFFERENT_FREQ, IncompatibleFrequency, Period, get_period_field_arr,
|
|
23 | 24 | from pandas.core.dtypes.missing import isna, notna
|
24 | 25 |
|
25 | 26 | import pandas.core.algorithms as algos
|
26 |
| -from pandas.core.arrays import datetimelike as dtl |
| 27 | +from pandas.core.arrays import ExtensionArray, datetimelike as dtl |
27 | 28 | import pandas.core.common as com
|
28 | 29 |
|
29 | 30 | from pandas.tseries import frequencies
|
@@ -536,11 +537,14 @@ def _sub_period(self, other):
|
536 | 537 | @Appender(dtl.DatetimeLikeArrayMixin._addsub_int_array.__doc__)
|
537 | 538 | def _addsub_int_array(
|
538 | 539 | self,
|
539 |
| - other, # type: Union[Index, ExtensionArray, np.ndarray[int]] |
540 |
| - op # type: Callable[Any, Any] |
| 540 | + other, # type: Union[ExtensionArray, np.ndarray[int]] |
| 541 | + op # type: Callable[Any, Any] |
541 | 542 | ):
|
542 | 543 | # type: (...) -> PeriodArray
|
543 | 544 |
|
| 545 | + # TODO: ABCIndexClass is a valid type for other but had to be excluded |
| 546 | + # due to length of Py2 compatability comment; add back in once migrated |
| 547 | + # to Py3 syntax |
544 | 548 | assert op in [operator.add, operator.sub]
|
545 | 549 | if op is operator.sub:
|
546 | 550 | other = -other
|
|
0 commit comments