done
This commit is contained in:
		| @ -0,0 +1,29 @@ | ||||
| __all__ = [ | ||||
|     "Period", | ||||
|     "Timestamp", | ||||
|     "Timedelta", | ||||
|     "NaT", | ||||
|     "NaTType", | ||||
|     "iNaT", | ||||
|     "nat_strings", | ||||
|     "BaseOffset", | ||||
|     "Tick", | ||||
|     "OutOfBoundsDatetime", | ||||
| ] | ||||
| from pandas._libs.tslibs.nattype import ( | ||||
|     NaT, | ||||
|     NaTType, | ||||
|     iNaT, | ||||
|     nat_strings, | ||||
| ) | ||||
| from pandas._libs.tslibs.np_datetime import ( | ||||
|     OutOfBoundsDatetime as OutOfBoundsDatetime, | ||||
|     OutOfBoundsTimedelta as OutOfBoundsTimedelta, | ||||
| ) | ||||
| from pandas._libs.tslibs.offsets import ( | ||||
|     BaseOffset, | ||||
|     Tick, | ||||
| ) | ||||
| from pandas._libs.tslibs.period import Period | ||||
| from pandas._libs.tslibs.timedeltas import Timedelta | ||||
| from pandas._libs.tslibs.timestamps import Timestamp | ||||
| @ -0,0 +1,3 @@ | ||||
| from datetime import datetime | ||||
|  | ||||
| class ABCTimestamp(datetime): ... | ||||
| @ -0,0 +1 @@ | ||||
| class OutOfBoundsTimedelta(ValueError): ... | ||||
| @ -0,0 +1,157 @@ | ||||
| # pyright: strict | ||||
| from datetime import ( | ||||
|     datetime, | ||||
|     timedelta, | ||||
|     tzinfo as _tzinfo, | ||||
| ) | ||||
| from typing import Literal | ||||
|  | ||||
| import numpy as np | ||||
| from typing_extensions import ( | ||||
|     Self, | ||||
|     TypeAlias, | ||||
| ) | ||||
|  | ||||
| from pandas._libs.tslibs.period import Period | ||||
| from pandas._typing import ( | ||||
|     Frequency, | ||||
|     NpDtype, | ||||
|     TimestampNonexistent, | ||||
|     TimeUnit, | ||||
| ) | ||||
|  | ||||
| NaT: NaTType | ||||
| iNaT: int | ||||
| nat_strings: set[str] | ||||
|  | ||||
| _NaTComparisonTypes: TypeAlias = ( | ||||
|     datetime | timedelta | Period | np.datetime64 | np.timedelta64 | ||||
| ) | ||||
|  | ||||
| class _NatComparison: | ||||
|     def __call__(self, other: _NaTComparisonTypes) -> bool: ... | ||||
|  | ||||
| class NaTType: | ||||
|     value: np.int64 | ||||
|     def __hash__(self) -> int: ... | ||||
|     def asm8(self) -> np.datetime64: ... | ||||
|     def to_datetime64(self) -> np.datetime64: ... | ||||
|     def to_numpy( | ||||
|         self, dtype: NpDtype | None = ..., copy: bool = ... | ||||
|     ) -> np.datetime64 | np.timedelta64: ... | ||||
|     @property | ||||
|     def is_leap_year(self) -> bool: ... | ||||
|     @property | ||||
|     def is_month_start(self) -> bool: ... | ||||
|     @property | ||||
|     def is_quarter_start(self) -> bool: ... | ||||
|     @property | ||||
|     def is_year_start(self) -> bool: ... | ||||
|     @property | ||||
|     def is_month_end(self) -> bool: ... | ||||
|     @property | ||||
|     def is_quarter_end(self) -> bool: ... | ||||
|     @property | ||||
|     def is_year_end(self) -> bool: ... | ||||
|     @property | ||||
|     def day_of_year(self) -> float: ... | ||||
|     @property | ||||
|     def dayofyear(self) -> float: ... | ||||
|     @property | ||||
|     def days_in_month(self) -> float: ... | ||||
|     @property | ||||
|     def daysinmonth(self) -> float: ... | ||||
|     @property | ||||
|     def day_of_week(self) -> float: ... | ||||
|     @property | ||||
|     def dayofweek(self) -> float: ... | ||||
|     @property | ||||
|     def week(self) -> float: ... | ||||
|     @property | ||||
|     def weekofyear(self) -> float: ... | ||||
|     def day_name(self) -> float: ... | ||||
|     def month_name(self) -> float: ... | ||||
|     def weekday(self) -> float: ... | ||||
|     def isoweekday(self) -> float: ... | ||||
|     def total_seconds(self) -> float: ... | ||||
|     def today(self, tz: _tzinfo | str | None = None) -> NaTType: ... | ||||
|     def now(self, tz: _tzinfo | str | None = None) -> NaTType: ... | ||||
|     def to_pydatetime(self) -> NaTType: ... | ||||
|     def date(self) -> NaTType: ... | ||||
|     def round( | ||||
|         self, | ||||
|         freq: Frequency, | ||||
|         ambiguous: bool | Literal["raise"] | NaTType = "raise", | ||||
|         nonexistent: TimestampNonexistent = "raise", | ||||
|     ) -> NaTType: ... | ||||
|     def floor( | ||||
|         self, | ||||
|         freq: Frequency, | ||||
|         ambiguous: bool | Literal["raise"] | NaTType = "raise", | ||||
|         nonexistent: TimestampNonexistent = "raise", | ||||
|     ) -> NaTType: ... | ||||
|     def ceil( | ||||
|         self, | ||||
|         freq: Frequency, | ||||
|         ambiguous: bool | Literal["raise"] | NaTType = "raise", | ||||
|         nonexistent: TimestampNonexistent = "raise", | ||||
|     ) -> NaTType: ... | ||||
|     def tz_convert(self) -> NaTType: ... | ||||
|     def tz_localize( | ||||
|         self, | ||||
|         tz: _tzinfo | str | None, | ||||
|         ambiguous: bool | Literal["raise"] | NaTType = "raise", | ||||
|         nonexistent: TimestampNonexistent = "raise", | ||||
|     ) -> NaTType: ... | ||||
|     def replace( | ||||
|         self, | ||||
|         year: int | None = ..., | ||||
|         month: int | None = ..., | ||||
|         day: int | None = ..., | ||||
|         hour: int | None = ..., | ||||
|         minute: int | None = ..., | ||||
|         second: int | None = ..., | ||||
|         microsecond: int | None = ..., | ||||
|         nanosecond: int | None = ..., | ||||
|         tzinfo: _tzinfo | None = ..., | ||||
|         fold: int | None = ..., | ||||
|     ) -> NaTType: ... | ||||
|     @property | ||||
|     def year(self) -> float: ... | ||||
|     @property | ||||
|     def quarter(self) -> float: ... | ||||
|     @property | ||||
|     def month(self) -> float: ... | ||||
|     @property | ||||
|     def day(self) -> float: ... | ||||
|     @property | ||||
|     def hour(self) -> float: ... | ||||
|     @property | ||||
|     def minute(self) -> float: ... | ||||
|     @property | ||||
|     def second(self) -> float: ... | ||||
|     @property | ||||
|     def millisecond(self) -> float: ... | ||||
|     @property | ||||
|     def microsecond(self) -> float: ... | ||||
|     @property | ||||
|     def nanosecond(self) -> float: ... | ||||
|     # inject Timedelta properties | ||||
|     @property | ||||
|     def days(self) -> float: ... | ||||
|     @property | ||||
|     def microseconds(self) -> float: ... | ||||
|     @property | ||||
|     def nanoseconds(self) -> float: ... | ||||
|     # inject Period properties | ||||
|     @property | ||||
|     def qyear(self) -> float: ... | ||||
|     def __eq__(self, other: object) -> bool: ... | ||||
|     def __ne__(self, other: object) -> bool: ... | ||||
|     __lt__: _NatComparison | ||||
|     __le__: _NatComparison | ||||
|     __gt__: _NatComparison | ||||
|     __ge__: _NatComparison | ||||
|     @property | ||||
|     def unit(self) -> TimeUnit: ... | ||||
|     def as_unit(self, unit: TimeUnit, round_ok: bool = True) -> Self: ... | ||||
| @ -0,0 +1,2 @@ | ||||
| class OutOfBoundsDatetime(ValueError): ... | ||||
| class OutOfBoundsTimedelta(ValueError): ... | ||||
| @ -0,0 +1,255 @@ | ||||
| from collections.abc import Collection | ||||
| from datetime import ( | ||||
|     date, | ||||
|     datetime, | ||||
|     time, | ||||
|     timedelta, | ||||
| ) | ||||
| from typing import ( | ||||
|     Any, | ||||
|     Literal, | ||||
|     TypeVar, | ||||
|     overload, | ||||
| ) | ||||
|  | ||||
| from dateutil.relativedelta import weekday as WeekdayClass | ||||
| import numpy as np | ||||
| from pandas import Timestamp | ||||
| from typing_extensions import Self | ||||
|  | ||||
| from pandas._typing import npt | ||||
|  | ||||
| from pandas.tseries.holiday import AbstractHolidayCalendar | ||||
|  | ||||
| _DatetimeT = TypeVar("_DatetimeT", bound=datetime) | ||||
| _TimedeltaT = TypeVar("_TimedeltaT", bound=timedelta) | ||||
|  | ||||
| class ApplyTypeError(TypeError): ... | ||||
|  | ||||
| class BaseOffset: | ||||
|     n: int | ||||
|     def __init__(self, n: int = ..., normalize: bool = ...) -> None: ... | ||||
|     def __eq__(self, other: object) -> bool: ... | ||||
|     def __ne__(self, other: object) -> bool: ... | ||||
|     def __hash__(self) -> int: ... | ||||
|     @property | ||||
|     def kwds(self) -> dict[str, Any]: ... | ||||
|     @property | ||||
|     def base(self) -> BaseOffset: ... | ||||
|     @overload | ||||
|     def __add__(self, other: npt.NDArray[np.object_]) -> npt.NDArray[np.object_]: ... | ||||
|     @overload | ||||
|     def __add__(self, other: _DatetimeT) -> _DatetimeT: ...  # type: ignore[overload-overlap]  # pyright: ignore[reportOverlappingOverload] | ||||
|     @overload | ||||
|     def __add__(self, other: date) -> Timestamp: ... | ||||
|     @overload | ||||
|     def __add__(self, other: BaseOffset) -> Self: ... | ||||
|     @overload | ||||
|     def __add__(self, other: _TimedeltaT) -> _TimedeltaT: ... | ||||
|     @overload | ||||
|     def __radd__(self, other: npt.NDArray[np.object_]) -> npt.NDArray[np.object_]: ... | ||||
|     @overload | ||||
|     def __radd__(self, other: _DatetimeT) -> _DatetimeT: ...  # type: ignore[overload-overlap]  # pyright: ignore[reportOverlappingOverload] | ||||
|     @overload | ||||
|     def __radd__(self, other: date) -> Timestamp: ... | ||||
|     @overload | ||||
|     def __radd__(self, other: BaseOffset) -> Self: ... | ||||
|     @overload | ||||
|     def __radd__(self, other: _TimedeltaT) -> _TimedeltaT: ... | ||||
|     def __sub__(self, other: BaseOffset) -> Self: ... | ||||
|     @overload | ||||
|     def __rsub__(self, other: npt.NDArray[np.object_]) -> npt.NDArray[np.object_]: ... | ||||
|     @overload | ||||
|     def __rsub__(self, other: _DatetimeT) -> _DatetimeT: ...  # type: ignore[overload-overlap]  # pyright: ignore[reportOverlappingOverload] | ||||
|     @overload | ||||
|     def __rsub__(self, other: date) -> Timestamp: ... | ||||
|     @overload | ||||
|     def __rsub__(self, other: BaseOffset) -> Self: ... | ||||
|     @overload | ||||
|     def __rsub__(self, other: _TimedeltaT) -> _TimedeltaT: ... | ||||
|     @overload | ||||
|     def __mul__(self, other: np.ndarray) -> np.ndarray: ... | ||||
|     @overload | ||||
|     def __mul__(self, other: int) -> Self: ... | ||||
|     @overload | ||||
|     def __rmul__(self, other: np.ndarray) -> np.ndarray: ... | ||||
|     @overload | ||||
|     def __rmul__(self, other: int) -> Self: ... | ||||
|     def __neg__(self) -> Self: ... | ||||
|     def copy(self) -> Self: ... | ||||
|     @property | ||||
|     def name(self) -> str: ... | ||||
|     @property | ||||
|     def rule_code(self) -> str: ... | ||||
|     @property | ||||
|     def freqstr(self) -> str: ... | ||||
|     def rollback(self, dt: datetime) -> datetime: ... | ||||
|     def rollforward(self, dt: datetime) -> datetime: ... | ||||
|     def is_on_offset(self, dt: datetime) -> bool: ... | ||||
|     @property | ||||
|     def nanos(self) -> int: ... | ||||
|  | ||||
| class SingleConstructorOffset(BaseOffset): ... | ||||
|  | ||||
| class Tick(SingleConstructorOffset): | ||||
|     def __init__(self, n: int = ..., normalize: bool = ...) -> None: ... | ||||
|     @property | ||||
|     def nanos(self) -> int: ... | ||||
|  | ||||
| class Day(Tick): ... | ||||
| class Hour(Tick): ... | ||||
| class Minute(Tick): ... | ||||
| class Second(Tick): ... | ||||
| class Milli(Tick): ... | ||||
| class Micro(Tick): ... | ||||
| class Nano(Tick): ... | ||||
|  | ||||
| class RelativeDeltaOffset(BaseOffset): | ||||
|     def __init__(self, n: int = ..., normalize: bool = ..., **kwds: Any) -> None: ... | ||||
|  | ||||
| # Changed from implementation because it is not allowed for `PeriodDtype` | ||||
| class BusinessDay(BaseOffset): | ||||
|     def __init__( | ||||
|         self, n: int = ..., normalize: bool = ..., offset: timedelta = ... | ||||
|     ) -> None: ... | ||||
|     def __reduce__(self): ... | ||||
|  | ||||
| class BusinessHour(SingleConstructorOffset): | ||||
|     def __init__( | ||||
|         self, | ||||
|         n: int = ..., | ||||
|         normalize: bool = ..., | ||||
|         start: str | time | Collection[str | time] = ..., | ||||
|         end: str | time | Collection[str | time] = ..., | ||||
|         offset: timedelta = ..., | ||||
|     ) -> None: ... | ||||
|  | ||||
| class WeekOfMonthMixin(SingleConstructorOffset): | ||||
|     def __init__( | ||||
|         self, n: int = ..., weekday: Literal[0, 1, 2, 3, 4, 5, 6] = ... | ||||
|     ) -> None: ... | ||||
|  | ||||
| class YearOffset(SingleConstructorOffset): | ||||
|     def __init__( | ||||
|         self, n: int = ..., normalize: bool = ..., month: int | None = ... | ||||
|     ) -> None: ... | ||||
|  | ||||
| class BYearEnd(YearOffset): ... | ||||
| class BYearBegin(YearOffset): ... | ||||
| class YearEnd(YearOffset): ... | ||||
| class YearBegin(YearOffset): ... | ||||
|  | ||||
| class QuarterOffset(SingleConstructorOffset): | ||||
|     def __init__( | ||||
|         self, n: int = ..., normalize: bool = ..., startingMonth: int | None = ... | ||||
|     ) -> None: ... | ||||
|  | ||||
| class BQuarterEnd(QuarterOffset): ... | ||||
| class BQuarterBegin(QuarterOffset): ... | ||||
| class QuarterEnd(QuarterOffset): ... | ||||
| class QuarterBegin(QuarterOffset): ... | ||||
| class MonthOffset(SingleConstructorOffset): ... | ||||
| class MonthEnd(MonthOffset): ... | ||||
| class MonthBegin(MonthOffset): ... | ||||
| class BusinessMonthEnd(MonthOffset): ... | ||||
| class BusinessMonthBegin(MonthOffset): ... | ||||
|  | ||||
| class SemiMonthOffset(SingleConstructorOffset): | ||||
|     def __init__( | ||||
|         self, n: int = ..., normalize: bool = ..., day_of_month: int | None = ... | ||||
|     ) -> None: ... | ||||
|  | ||||
| class SemiMonthEnd(SemiMonthOffset): ... | ||||
| class SemiMonthBegin(SemiMonthOffset): ... | ||||
|  | ||||
| class Week(SingleConstructorOffset): | ||||
|     def __init__( | ||||
|         self, n: int = ..., normalize: bool = ..., weekday: int | None = ... | ||||
|     ) -> None: ... | ||||
|  | ||||
| class WeekOfMonth(WeekOfMonthMixin): | ||||
|     def __init__( | ||||
|         self, n: int = ..., normalize: bool = ..., week: int = ..., weekday: int = ... | ||||
|     ) -> None: ... | ||||
|  | ||||
| class LastWeekOfMonth(WeekOfMonthMixin): ... | ||||
|  | ||||
| class FY5253Mixin(SingleConstructorOffset): | ||||
|     def __init__( | ||||
|         self, | ||||
|         n: int = ..., | ||||
|         normalize: bool = ..., | ||||
|         weekday: int = ..., | ||||
|         startingMonth: int = ..., | ||||
|         variation: str = ..., | ||||
|     ) -> None: ... | ||||
|  | ||||
| class FY5253(FY5253Mixin): ... | ||||
| class FY5253Quarter(FY5253Mixin): ... | ||||
| class Easter(SingleConstructorOffset): ... | ||||
|  | ||||
| class _CustomBusinessMonth(SingleConstructorOffset): | ||||
|     def __init__( | ||||
|         self, | ||||
|         n: int = ..., | ||||
|         normalize: bool = ..., | ||||
|         offset: timedelta = ..., | ||||
|         holidays: list | None = ..., | ||||
|     ) -> None: ... | ||||
|  | ||||
| class CustomBusinessDay(BusinessDay): | ||||
|     def __init__( | ||||
|         self, | ||||
|         n: int = ..., | ||||
|         normalize: bool = ..., | ||||
|         holidays: list = ..., | ||||
|         calendar: AbstractHolidayCalendar | np.busdaycalendar = ..., | ||||
|     ) -> None: ... | ||||
|  | ||||
| class CustomBusinessHour(BusinessHour): | ||||
|     def __init__( | ||||
|         self, | ||||
|         n: int = ..., | ||||
|         normalize: bool = ..., | ||||
|         start: str | time | Collection[str | time] = ..., | ||||
|         end: str | time | Collection[str | time] = ..., | ||||
|         offset: timedelta = ..., | ||||
|         holidays: list | None = ..., | ||||
|     ) -> None: ... | ||||
|  | ||||
| class CustomBusinessMonthEnd(_CustomBusinessMonth): ... | ||||
| class CustomBusinessMonthBegin(_CustomBusinessMonth): ... | ||||
|  | ||||
| class DateOffset(RelativeDeltaOffset): | ||||
|     def __init__( | ||||
|         self, | ||||
|         *, | ||||
|         n: int = ..., | ||||
|         normalize: bool = ..., | ||||
|         years: int = ..., | ||||
|         months: int = ..., | ||||
|         weeks: int = ..., | ||||
|         days: int = ..., | ||||
|         hours: int = ..., | ||||
|         minutes: int = ..., | ||||
|         seconds: int = ..., | ||||
|         milliseconds: int = ..., | ||||
|         microseconds: int = ..., | ||||
|         nanoseconds: int = ..., | ||||
|         year: int = ..., | ||||
|         month: int = ..., | ||||
|         day: int = ..., | ||||
|         weekday: int | WeekdayClass = ..., | ||||
|         hour: int = ..., | ||||
|         minute: int = ..., | ||||
|         second: int = ..., | ||||
|         microsecond: int = ..., | ||||
|         nanosecond: int = ..., | ||||
|     ) -> None: ... | ||||
|  | ||||
| BDay = BusinessDay | ||||
| BMonthEnd = BusinessMonthEnd | ||||
| BMonthBegin = BusinessMonthBegin | ||||
| CBMonthEnd = CustomBusinessMonthEnd | ||||
| CBMonthBegin = CustomBusinessMonthBegin | ||||
| CDay = CustomBusinessDay | ||||
| @ -0,0 +1,2 @@ | ||||
| class DateParseError(ValueError): | ||||
|     def __init__(self, *args, **kwargs) -> None: ... | ||||
| @ -0,0 +1,232 @@ | ||||
| import datetime | ||||
| from typing import ( | ||||
|     Literal, | ||||
|     overload, | ||||
| ) | ||||
|  | ||||
| import numpy as np | ||||
| from pandas import ( | ||||
|     Index, | ||||
|     PeriodIndex, | ||||
|     Series, | ||||
|     Timedelta, | ||||
|     TimedeltaIndex, | ||||
| ) | ||||
| from pandas.core.series import ( | ||||
|     OffsetSeries, | ||||
|     PeriodSeries, | ||||
|     TimedeltaSeries, | ||||
| ) | ||||
| from typing_extensions import TypeAlias | ||||
|  | ||||
| from pandas._libs.tslibs import NaTType | ||||
| from pandas._libs.tslibs.offsets import BaseOffset | ||||
| from pandas._libs.tslibs.timestamps import Timestamp | ||||
| from pandas._typing import ( | ||||
|     ShapeT, | ||||
|     np_1darray, | ||||
|     np_ndarray, | ||||
| ) | ||||
|  | ||||
| class IncompatibleFrequency(ValueError): ... | ||||
|  | ||||
| _PeriodAddSub: TypeAlias = ( | ||||
|     Timedelta | datetime.timedelta | np.timedelta64 | np.int64 | int | BaseOffset | ||||
| ) | ||||
|  | ||||
| _PeriodFreqHow: TypeAlias = Literal[ | ||||
|     "S", | ||||
|     "E", | ||||
|     "start", | ||||
|     "end", | ||||
| ] | ||||
|  | ||||
| _PeriodToTimestampHow: TypeAlias = ( | ||||
|     _PeriodFreqHow | ||||
|     | Literal[ | ||||
|         "Start", | ||||
|         "Finish", | ||||
|         "Begin", | ||||
|         "End", | ||||
|         "s", | ||||
|         "e", | ||||
|         "finish", | ||||
|         "begin", | ||||
|     ] | ||||
| ) | ||||
|  | ||||
| class PeriodMixin: | ||||
|     @property | ||||
|     def end_time(self) -> Timestamp: ... | ||||
|     @property | ||||
|     def start_time(self) -> Timestamp: ... | ||||
|  | ||||
| class Period(PeriodMixin): | ||||
|     def __init__( | ||||
|         self, | ||||
|         value: ( | ||||
|             Period | str | datetime.datetime | datetime.date | Timestamp | None | ||||
|         ) = ..., | ||||
|         freq: str | BaseOffset | None = ..., | ||||
|         ordinal: int | None = ..., | ||||
|         year: int | None = ..., | ||||
|         month: int | None = ..., | ||||
|         quarter: int | None = ..., | ||||
|         day: int | None = ..., | ||||
|         hour: int | None = ..., | ||||
|         minute: int | None = ..., | ||||
|         second: int | None = ..., | ||||
|     ) -> None: ... | ||||
|     @overload | ||||
|     def __sub__(self, other: _PeriodAddSub) -> Period: ... | ||||
|     @overload | ||||
|     def __sub__(self, other: Period) -> BaseOffset: ... | ||||
|     @overload | ||||
|     def __sub__(self, other: NaTType) -> NaTType: ... | ||||
|     @overload | ||||
|     def __sub__(self, other: PeriodIndex) -> Index: ... | ||||
|     @overload | ||||
|     def __sub__(self, other: TimedeltaSeries) -> PeriodSeries: ... | ||||
|     @overload | ||||
|     def __sub__(self, other: TimedeltaIndex) -> PeriodIndex: ... | ||||
|     @overload | ||||
|     def __add__(self, other: _PeriodAddSub) -> Period: ... | ||||
|     @overload | ||||
|     def __add__(self, other: NaTType) -> NaTType: ... | ||||
|     @overload | ||||
|     def __add__(self, other: Index) -> PeriodIndex: ... | ||||
|     @overload | ||||
|     def __add__(self, other: OffsetSeries | TimedeltaSeries) -> PeriodSeries: ... | ||||
|     #  ignore[misc] here because we know all other comparisons | ||||
|     #  are False, so we use Literal[False] | ||||
|     @overload | ||||
|     def __eq__(self, other: Period) -> bool: ...  # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] | ||||
|     @overload | ||||
|     def __eq__(self, other: Index) -> np_1darray[np.bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __eq__(self, other: PeriodSeries) -> Series[bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __eq__(self, other: np_ndarray[ShapeT, np.object_]) -> np_ndarray[ShapeT, np.bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __eq__(self, other: object) -> Literal[False]: ... | ||||
|     @overload | ||||
|     def __ge__(self, other: Period) -> bool: ... | ||||
|     @overload | ||||
|     def __ge__(self, other: PeriodIndex) -> np_1darray[np.bool]: ... | ||||
|     @overload | ||||
|     def __ge__(self, other: PeriodSeries) -> Series[bool]: ... | ||||
|     @overload | ||||
|     def __ge__( | ||||
|         self, other: np_ndarray[ShapeT, np.object_] | ||||
|     ) -> np_ndarray[ShapeT, np.bool]: ... | ||||
|     @overload | ||||
|     def __gt__(self, other: Period) -> bool: ... | ||||
|     @overload | ||||
|     def __gt__(self, other: PeriodIndex) -> np_1darray[np.bool]: ... | ||||
|     @overload | ||||
|     def __gt__(self, other: PeriodSeries) -> Series[bool]: ... | ||||
|     @overload | ||||
|     def __gt__( | ||||
|         self, other: np_ndarray[ShapeT, np.object_] | ||||
|     ) -> np_ndarray[ShapeT, np.bool]: ... | ||||
|     @overload | ||||
|     def __le__(self, other: Period) -> bool: ... | ||||
|     @overload | ||||
|     def __le__(self, other: PeriodIndex) -> np_1darray[np.bool]: ... | ||||
|     @overload | ||||
|     def __le__(self, other: PeriodSeries) -> Series[bool]: ... | ||||
|     @overload | ||||
|     def __le__( | ||||
|         self, other: np_ndarray[ShapeT, np.object_] | ||||
|     ) -> np_ndarray[ShapeT, np.bool]: ... | ||||
|     @overload | ||||
|     def __lt__(self, other: Period) -> bool: ... | ||||
|     @overload | ||||
|     def __lt__(self, other: PeriodIndex) -> np_1darray[np.bool]: ... | ||||
|     @overload | ||||
|     def __lt__(self, other: PeriodSeries) -> Series[bool]: ... | ||||
|     @overload | ||||
|     def __lt__( | ||||
|         self, other: np_ndarray[ShapeT, np.object_] | ||||
|     ) -> np_ndarray[ShapeT, np.bool]: ... | ||||
|     #  ignore[misc] here because we know all other comparisons | ||||
|     #  are False, so we use Literal[False] | ||||
|     @overload | ||||
|     def __ne__(self, other: Period) -> bool: ...  # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] | ||||
|     @overload | ||||
|     def __ne__(self, other: Index) -> np_1darray[np.bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __ne__(self, other: PeriodSeries) -> Series[bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __ne__(self, other: np_ndarray[ShapeT, np.object_]) -> np_ndarray[ShapeT, np.bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __ne__(self, other: object) -> Literal[True]: ... | ||||
|     # Ignored due to indecipherable error from mypy: | ||||
|     # Forward operator "__add__" is not callable  [misc] | ||||
|     @overload | ||||
|     def __radd__(self, other: _PeriodAddSub) -> Period: ...  # type: ignore[misc] | ||||
|     # Real signature is -> PeriodIndex, but conflicts with Index.__add__ | ||||
|     # Changing Index is very hard due to Index inheritance | ||||
|     #   Signatures of "__radd__" of "Period" and "__add__" of "Index" | ||||
|     #   are unsafely overlapping | ||||
|     @overload | ||||
|     def __radd__(self, other: Index) -> Index: ... | ||||
|     @overload | ||||
|     def __radd__(self, other: TimedeltaSeries) -> PeriodSeries: ... | ||||
|     @overload | ||||
|     def __radd__(self, other: NaTType) -> NaTType: ... | ||||
|     @property | ||||
|     def day(self) -> int: ... | ||||
|     @property | ||||
|     def dayofweek(self) -> int: ... | ||||
|     @property | ||||
|     def dayofyear(self) -> int: ... | ||||
|     @property | ||||
|     def daysinmonth(self) -> int: ... | ||||
|     @property | ||||
|     def days_in_month(self) -> int: ... | ||||
|     @property | ||||
|     def end_time(self) -> Timestamp: ... | ||||
|     @property | ||||
|     def freq(self) -> BaseOffset: ... | ||||
|     @property | ||||
|     def freqstr(self) -> str: ... | ||||
|     @property | ||||
|     def hour(self) -> int: ... | ||||
|     @property | ||||
|     def minute(self) -> int: ... | ||||
|     @property | ||||
|     def month(self) -> int: ... | ||||
|     @property | ||||
|     def quarter(self) -> int: ... | ||||
|     @property | ||||
|     def qyear(self) -> int: ... | ||||
|     @property | ||||
|     def second(self) -> int: ... | ||||
|     @property | ||||
|     def ordinal(self) -> int: ... | ||||
|     @property | ||||
|     def is_leap_year(self) -> bool: ... | ||||
|     @property | ||||
|     def start_time(self) -> Timestamp: ... | ||||
|     @property | ||||
|     def week(self) -> int: ... | ||||
|     @property | ||||
|     def weekday(self) -> int: ... | ||||
|     @property | ||||
|     def weekofyear(self) -> int: ... | ||||
|     @property | ||||
|     def year(self) -> int: ... | ||||
|     @property | ||||
|     def day_of_year(self) -> int: ... | ||||
|     @property | ||||
|     def day_of_week(self) -> int: ... | ||||
|     def asfreq(self, freq: str | BaseOffset, how: _PeriodFreqHow = "end") -> Period: ... | ||||
|     @classmethod | ||||
|     def now(cls, freq: str | BaseOffset = ...) -> Period: ... | ||||
|     def strftime(self, fmt: str) -> str: ... | ||||
|     def to_timestamp( | ||||
|         self, | ||||
|         freq: str | BaseOffset | None = ..., | ||||
|         how: _PeriodToTimestampHow = "S", | ||||
|     ) -> Timestamp: ... | ||||
| @ -0,0 +1,406 @@ | ||||
| # pyright: strict | ||||
| import datetime as dt | ||||
| from datetime import timedelta | ||||
| from typing import ( | ||||
|     ClassVar, | ||||
|     Literal, | ||||
|     NamedTuple, | ||||
|     overload, | ||||
| ) | ||||
|  | ||||
| import numpy as np | ||||
| import pandas as pd | ||||
| from pandas import ( | ||||
|     DatetimeIndex, | ||||
|     Index, | ||||
|     PeriodIndex, | ||||
|     Series, | ||||
|     TimedeltaIndex, | ||||
| ) | ||||
| from pandas.core.series import ( | ||||
|     TimedeltaSeries, | ||||
|     TimestampSeries, | ||||
| ) | ||||
| from typing_extensions import ( | ||||
|     Self, | ||||
|     TypeAlias, | ||||
| ) | ||||
|  | ||||
| from pandas._libs.tslibs import ( | ||||
|     BaseOffset, | ||||
|     NaTType, | ||||
| ) | ||||
| from pandas._libs.tslibs.period import Period | ||||
| from pandas._libs.tslibs.timestamps import Timestamp | ||||
| from pandas._typing import ( | ||||
|     ShapeT, | ||||
|     TimeUnit, | ||||
|     np_1darray, | ||||
|     np_ndarray, | ||||
|     npt, | ||||
| ) | ||||
|  | ||||
| class Components(NamedTuple): | ||||
|     days: int | ||||
|     hours: int | ||||
|     minutes: int | ||||
|     seconds: int | ||||
|     milliseconds: int | ||||
|     microseconds: int | ||||
|     nanoseconds: int | ||||
|  | ||||
| # This should be kept consistent with the keys in the dict timedelta_abbrevs | ||||
| # in pandas/_libs/tslibs/timedeltas.pyx | ||||
| TimeDeltaUnitChoices: TypeAlias = Literal[ | ||||
|     "W", | ||||
|     "w", | ||||
|     "D", | ||||
|     "d", | ||||
|     "days", | ||||
|     "day", | ||||
|     "hours", | ||||
|     "hour", | ||||
|     "hr", | ||||
|     "h", | ||||
|     "m", | ||||
|     "minute", | ||||
|     "min", | ||||
|     "minutes", | ||||
|     "s", | ||||
|     "seconds", | ||||
|     "sec", | ||||
|     "second", | ||||
|     "ms", | ||||
|     "milliseconds", | ||||
|     "millisecond", | ||||
|     "milli", | ||||
|     "millis", | ||||
|     "us", | ||||
|     "microseconds", | ||||
|     "microsecond", | ||||
|     "µs", | ||||
|     "micro", | ||||
|     "micros", | ||||
|     "ns", | ||||
|     "nanoseconds", | ||||
|     "nano", | ||||
|     "nanos", | ||||
|     "nanosecond", | ||||
| ] | ||||
|  | ||||
| UnitChoices: TypeAlias = ( | ||||
|     TimeDeltaUnitChoices | ||||
|     | Literal[ | ||||
|         "Y", | ||||
|         "y", | ||||
|         "M", | ||||
|     ] | ||||
| ) | ||||
|  | ||||
| class Timedelta(timedelta): | ||||
|     min: ClassVar[Timedelta]  # pyright: ignore[reportIncompatibleVariableOverride] | ||||
|     max: ClassVar[Timedelta]  # pyright: ignore[reportIncompatibleVariableOverride] | ||||
|     resolution: ClassVar[  # pyright: ignore[reportIncompatibleVariableOverride] | ||||
|         Timedelta | ||||
|     ] | ||||
|     value: int | ||||
|     def __new__( | ||||
|         cls, | ||||
|         value: str | float | Timedelta | timedelta | np.timedelta64 = ..., | ||||
|         unit: TimeDeltaUnitChoices = ..., | ||||
|         *, | ||||
|         days: float | np.integer | np.floating = ..., | ||||
|         seconds: float | np.integer | np.floating = ..., | ||||
|         microseconds: float | np.integer | np.floating = ..., | ||||
|         milliseconds: float | np.integer | np.floating = ..., | ||||
|         minutes: float | np.integer | np.floating = ..., | ||||
|         hours: float | np.integer | np.floating = ..., | ||||
|         weeks: float | np.integer | np.floating = ..., | ||||
|     ) -> Self: ... | ||||
|     # GH 46171 | ||||
|     # While Timedelta can return pd.NaT, having the constructor return | ||||
|     # a Union with NaTType makes things awkward for users of pandas | ||||
|     @property | ||||
|     def days(self) -> int: ... | ||||
|     @property | ||||
|     def nanoseconds(self) -> int: ... | ||||
|     @property | ||||
|     def seconds(self) -> int: ... | ||||
|     @property | ||||
|     def microseconds(self) -> int: ... | ||||
|     def total_seconds(self) -> float: ... | ||||
|     def to_pytimedelta(self) -> timedelta: ... | ||||
|     def to_timedelta64(self) -> np.timedelta64: ... | ||||
|     @property | ||||
|     def asm8(self) -> np.timedelta64: ... | ||||
|     # TODO: round/floor/ceil could return NaT? | ||||
|     def round(self, freq: str | BaseOffset) -> Self: ... | ||||
|     def floor(self, freq: str | BaseOffset) -> Self: ... | ||||
|     def ceil(self, freq: str | BaseOffset) -> Self: ... | ||||
|     @property | ||||
|     def resolution_string(self) -> str: ... | ||||
|     # Override due to more types supported than dt.timedelta | ||||
|     @overload  # type: ignore[override] | ||||
|     def __add__(self, other: timedelta | Timedelta | np.timedelta64) -> Timedelta: ... | ||||
|     @overload | ||||
|     def __add__(self, other: dt.datetime | np.datetime64 | Timestamp) -> Timestamp: ... | ||||
|     @overload | ||||
|     def __add__(self, other: NaTType) -> NaTType: ... | ||||
|     @overload | ||||
|     def __add__(self, other: Period) -> Period: ... | ||||
|     @overload | ||||
|     def __add__(self, other: dt.date) -> dt.date: ... | ||||
|     @overload | ||||
|     def __add__(self, other: PeriodIndex) -> PeriodIndex: ... | ||||
|     @overload | ||||
|     def __add__(self, other: DatetimeIndex) -> DatetimeIndex: ... | ||||
|     @overload | ||||
|     def __add__( | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.timedelta64]: ... | ||||
|     @overload | ||||
|     def __add__( | ||||
|         self, other: np_ndarray[ShapeT, np.datetime64] | ||||
|     ) -> np_ndarray[ShapeT, np.datetime64]: ... | ||||
|     @overload | ||||
|     def __add__(self, other: pd.TimedeltaIndex) -> pd.TimedeltaIndex: ... | ||||
|     @overload | ||||
|     def __add__( | ||||
|         self, | ||||
|         other: TimedeltaSeries, | ||||
|     ) -> TimedeltaSeries: ... | ||||
|     @overload | ||||
|     def __add__(self, other: TimestampSeries) -> TimestampSeries: ... | ||||
|     @overload | ||||
|     def __radd__(self, other: np.datetime64) -> Timestamp: ... | ||||
|     @overload | ||||
|     def __radd__(self, other: timedelta | Timedelta | np.timedelta64) -> Timedelta: ... | ||||
|     @overload | ||||
|     def __radd__(self, other: NaTType) -> NaTType: ... | ||||
|     @overload | ||||
|     def __radd__( | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.timedelta64]: ... | ||||
|     @overload | ||||
|     def __radd__( | ||||
|         self, other: np_ndarray[ShapeT, np.datetime64] | ||||
|     ) -> np_ndarray[ShapeT, np.datetime64]: ... | ||||
|     @overload | ||||
|     def __radd__(self, other: pd.TimedeltaIndex) -> pd.TimedeltaIndex: ... | ||||
|     @overload | ||||
|     def __radd__(self, other: pd.PeriodIndex) -> pd.PeriodIndex: ... | ||||
|     # Override due to more types supported than dt.timedelta | ||||
|     @overload  # type: ignore[override] | ||||
|     def __sub__(self, other: timedelta | Timedelta | np.timedelta64) -> Timedelta: ... | ||||
|     @overload | ||||
|     def __sub__(self, other: NaTType) -> NaTType: ... | ||||
|     @overload | ||||
|     def __sub__( | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.timedelta64]: ... | ||||
|     @overload | ||||
|     def __sub__(self, other: pd.TimedeltaIndex) -> TimedeltaIndex: ... | ||||
|     @overload | ||||
|     def __sub__( | ||||
|         self, other: TimedeltaSeries | Series[pd.Timedelta] | ||||
|     ) -> TimedeltaSeries: ... | ||||
|     @overload | ||||
|     def __rsub__(self, other: timedelta | Timedelta | np.timedelta64) -> Timedelta: ... | ||||
|     @overload | ||||
|     def __rsub__(self, other: dt.datetime | Timestamp | np.datetime64) -> Timestamp: ...  # type: ignore[misc] | ||||
|     @overload | ||||
|     def __rsub__(self, other: NaTType) -> NaTType: ... | ||||
|     @overload | ||||
|     def __rsub__(self, other: Period) -> Period: ... | ||||
|     @overload | ||||
|     def __rsub__(self, other: PeriodIndex) -> PeriodIndex: ... | ||||
|     @overload | ||||
|     def __rsub__(self, other: DatetimeIndex) -> DatetimeIndex: ... | ||||
|     @overload | ||||
|     def __rsub__( | ||||
|         self, other: np_ndarray[ShapeT, np.datetime64] | ||||
|     ) -> np_ndarray[ShapeT, np.datetime64]: ... | ||||
|     @overload | ||||
|     def __rsub__( | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.timedelta64]: ... | ||||
|     @overload | ||||
|     def __rsub__(self, other: pd.TimedeltaIndex) -> pd.TimedeltaIndex: ... | ||||
|     def __neg__(self) -> Timedelta: ... | ||||
|     def __pos__(self) -> Timedelta: ... | ||||
|     def __abs__(self) -> Timedelta: ... | ||||
|     # Override due to more types supported than dt.timedelta | ||||
|     @overload  # type: ignore[override] | ||||
|     def __mul__(self, other: float) -> Timedelta: ... | ||||
|     @overload | ||||
|     def __mul__( | ||||
|         self, other: np_ndarray[ShapeT, np.integer] | np_ndarray[ShapeT, np.floating] | ||||
|     ) -> np_ndarray[ShapeT, np.timedelta64]: ... | ||||
|     @overload | ||||
|     def __mul__(self, other: Series[int]) -> TimedeltaSeries: ... | ||||
|     @overload | ||||
|     def __mul__(self, other: Series[float]) -> TimedeltaSeries: ... | ||||
|     @overload | ||||
|     def __mul__(self, other: Index[int] | Index[float]) -> TimedeltaIndex: ... | ||||
|     @overload | ||||
|     def __rmul__(self, other: float) -> Timedelta: ... | ||||
|     @overload | ||||
|     def __rmul__( | ||||
|         self, other: np_ndarray[ShapeT, np.floating] | np_ndarray[ShapeT, np.integer] | ||||
|     ) -> np_ndarray[ShapeT, np.timedelta64]: ... | ||||
|     @overload | ||||
|     def __rmul__(self, other: Series[int]) -> TimedeltaSeries: ... | ||||
|     @overload | ||||
|     def __rmul__(self, other: Series[float]) -> TimedeltaSeries: ... | ||||
|     # maybe related to https://github.com/python/mypy/issues/10755 | ||||
|     @overload | ||||
|     def __rmul__(self, other: Index[int] | Index[float]) -> TimedeltaIndex: ... | ||||
|     # Override due to more types supported than dt.timedelta | ||||
|     # error: Signature of "__floordiv__" incompatible with supertype "timedelta" | ||||
|     @overload  # type: ignore[override] | ||||
|     def __floordiv__(self, other: timedelta | Timedelta | np.timedelta64) -> int: ... | ||||
|     @overload | ||||
|     def __floordiv__(self, other: float) -> Timedelta: ... | ||||
|     @overload | ||||
|     def __floordiv__( | ||||
|         self, other: np_ndarray[ShapeT, np.integer] | np_ndarray[ShapeT, np.floating] | ||||
|     ) -> np_ndarray[ShapeT, np.timedelta64]: ... | ||||
|     @overload | ||||
|     def __floordiv__( | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.int_]: ... | ||||
|     @overload | ||||
|     def __floordiv__(self, other: Index[int] | Index[float]) -> TimedeltaIndex: ... | ||||
|     @overload | ||||
|     def __floordiv__(self, other: Series[int]) -> TimedeltaSeries: ... | ||||
|     @overload | ||||
|     def __floordiv__(self, other: Series[float]) -> TimedeltaSeries: ... | ||||
|     @overload | ||||
|     def __floordiv__(self, other: TimedeltaSeries) -> Series[int]: ... | ||||
|     @overload | ||||
|     def __floordiv__(self, other: NaTType | None) -> float: ... | ||||
|     @overload | ||||
|     def __rfloordiv__(self, other: timedelta | Timedelta | str) -> int: ... | ||||
|     @overload | ||||
|     def __rfloordiv__(self, other: NaTType | None) -> float: ... | ||||
|     @overload | ||||
|     def __rfloordiv__( | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.int_]: ... | ||||
|     # Override due to more types supported than dt.timedelta | ||||
|     @overload  # type: ignore[override] | ||||
|     def __truediv__(self, other: timedelta | Timedelta | NaTType) -> float: ... | ||||
|     @overload | ||||
|     def __truediv__(self, other: float) -> Timedelta: ... | ||||
|     @overload | ||||
|     def __truediv__( | ||||
|         self, other: np_ndarray[ShapeT, np.integer] | np_ndarray[ShapeT, np.floating] | ||||
|     ) -> np_ndarray[ShapeT, np.timedelta64]: ... | ||||
|     @overload | ||||
|     def __truediv__(self, other: TimedeltaSeries) -> Series[float]: ... | ||||
|     @overload | ||||
|     def __truediv__(self, other: Series[int]) -> TimedeltaSeries: ... | ||||
|     @overload | ||||
|     def __truediv__(self, other: Series[float]) -> TimedeltaSeries: ... | ||||
|     @overload | ||||
|     def __truediv__(self, other: Index[int] | Index[float]) -> TimedeltaIndex: ... | ||||
|     def __rtruediv__(self, other: timedelta | Timedelta | NaTType) -> float: ... | ||||
|     # Override due to more types supported than dt.timedelta | ||||
|     @overload | ||||
|     def __eq__(self, other: timedelta | Timedelta | np.timedelta64) -> bool: ...  # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] | ||||
|     @overload | ||||
|     def __eq__(self, other: TimedeltaSeries | Series[pd.Timedelta]) -> Series[bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __eq__(self, other: Index) -> np_1darray[np.bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __eq__(  # type: ignore[overload-overlap] | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.bool_]: ... | ||||
|     @overload | ||||
|     def __eq__(self, other: object) -> Literal[False]: ... | ||||
|     # Override due to more types supported than dt.timedelta | ||||
|     @overload | ||||
|     def __ne__(self, other: timedelta | Timedelta | np.timedelta64) -> bool: ...  # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] | ||||
|     @overload | ||||
|     def __ne__(self, other: TimedeltaSeries | Series[pd.Timedelta]) -> Series[bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __ne__(self, other: Index) -> np_1darray[np.bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __ne__(  # type: ignore[overload-overlap] | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.bool_]: ... | ||||
|     @overload | ||||
|     def __ne__(self, other: object) -> Literal[True]: ... | ||||
|     # Override due to more types supported than dt.timedelta | ||||
|     @overload  # type: ignore[override] | ||||
|     def __mod__(self, other: timedelta) -> Timedelta: ... | ||||
|     @overload | ||||
|     def __mod__(self, other: float) -> Timedelta: ... | ||||
|     @overload | ||||
|     def __mod__(self, other: Series[int] | Series[float]) -> TimedeltaSeries: ... | ||||
|     @overload | ||||
|     def __mod__(self, other: Index[int] | Index[float]) -> TimedeltaIndex: ... | ||||
|     @overload | ||||
|     def __mod__( | ||||
|         self, other: np_ndarray[ShapeT, np.integer] | np_ndarray[ShapeT, np.floating] | ||||
|     ) -> np_ndarray[ShapeT, np.timedelta64]: ... | ||||
|     @overload | ||||
|     def __mod__( | ||||
|         self, other: Series[int] | Series[float] | TimedeltaSeries | ||||
|     ) -> TimedeltaSeries: ... | ||||
|     def __divmod__(self, other: timedelta) -> tuple[int, Timedelta]: ... | ||||
|     # Mypy complains Forward operator "<inequality op>" is not callable, so ignore misc | ||||
|     # for le, lt ge and gt | ||||
|     # Override due to more types supported than dt.timedelta | ||||
|     @overload  # type: ignore[override] | ||||
|     def __le__(self, other: timedelta | Timedelta | np.timedelta64) -> bool: ...  # type: ignore[misc] | ||||
|     @overload | ||||
|     def __le__(self, other: TimedeltaIndex) -> np_1darray[np.bool]: ... | ||||
|     @overload | ||||
|     def __le__( | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.bool_]: ... | ||||
|     @overload | ||||
|     def __le__(self, other: TimedeltaSeries | Series[pd.Timedelta]) -> Series[bool]: ... | ||||
|     # Override due to more types supported than dt.timedelta | ||||
|     @overload  # type: ignore[override] | ||||
|     def __lt__(self, other: timedelta | Timedelta | np.timedelta64) -> bool: ...  # type: ignore[misc] | ||||
|     @overload | ||||
|     def __lt__(self, other: TimedeltaIndex) -> np_1darray[np.bool]: ... | ||||
|     @overload | ||||
|     def __lt__( | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.bool_]: ... | ||||
|     @overload | ||||
|     def __lt__(self, other: TimedeltaSeries | Series[pd.Timedelta]) -> Series[bool]: ... | ||||
|     # Override due to more types supported than dt.timedelta | ||||
|     @overload  # type: ignore[override] | ||||
|     def __ge__(self, other: timedelta | Timedelta | np.timedelta64) -> bool: ...  # type: ignore[misc] | ||||
|     @overload | ||||
|     def __ge__(self, other: TimedeltaIndex) -> np_1darray[np.bool]: ... | ||||
|     @overload | ||||
|     def __ge__( | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.bool_]: ... | ||||
|     @overload | ||||
|     def __ge__(self, other: TimedeltaSeries | Series[pd.Timedelta]) -> Series[bool]: ... | ||||
|     # Override due to more types supported than dt.timedelta | ||||
|     @overload  # type: ignore[override] | ||||
|     def __gt__(self, other: timedelta | Timedelta | np.timedelta64) -> bool: ...  # type: ignore[misc] | ||||
|     @overload | ||||
|     def __gt__(self, other: TimedeltaIndex) -> np_1darray[np.bool]: ... | ||||
|     @overload | ||||
|     def __gt__( | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.bool_]: ... | ||||
|     @overload | ||||
|     def __gt__(self, other: TimedeltaSeries | Series[pd.Timedelta]) -> Series[bool]: ... | ||||
|     def __hash__(self) -> int: ... | ||||
|     def isoformat(self) -> str: ... | ||||
|     def to_numpy(self) -> np.timedelta64: ... | ||||
|     @property | ||||
|     def components(self) -> Components: ... | ||||
|     def view(self, dtype: npt.DTypeLike = ...) -> object: ... | ||||
|     @property | ||||
|     def unit(self) -> TimeUnit: ... | ||||
|     def as_unit(self, unit: TimeUnit, round_ok: bool = True) -> Self: ... | ||||
| @ -0,0 +1,352 @@ | ||||
| # pyright: strict | ||||
| from datetime import ( | ||||
|     date as _date, | ||||
|     datetime, | ||||
|     time as _time, | ||||
|     timedelta, | ||||
|     tzinfo as _tzinfo, | ||||
| ) | ||||
| from datetime import _IsoCalendarDate  # pyright: ignore[reportPrivateUsage] | ||||
| import sys | ||||
| from time import struct_time | ||||
| from typing import ( | ||||
|     ClassVar, | ||||
|     Literal, | ||||
|     SupportsIndex, | ||||
|     overload, | ||||
| ) | ||||
|  | ||||
| import numpy as np | ||||
| from pandas import ( | ||||
|     DatetimeIndex, | ||||
|     TimedeltaIndex, | ||||
| ) | ||||
| from pandas.core.indexes.base import Index | ||||
| from pandas.core.series import ( | ||||
|     Series, | ||||
|     TimedeltaSeries, | ||||
|     TimestampSeries, | ||||
| ) | ||||
| from typing_extensions import ( | ||||
|     Never, | ||||
|     Self, | ||||
|     TypeAlias, | ||||
| ) | ||||
|  | ||||
| from pandas._libs.tslibs import ( | ||||
|     BaseOffset, | ||||
|     Period, | ||||
|     Tick, | ||||
|     Timedelta, | ||||
| ) | ||||
| from pandas._typing import ( | ||||
|     ShapeT, | ||||
|     TimestampNonexistent, | ||||
|     TimeUnit, | ||||
|     np_1darray, | ||||
|     np_ndarray, | ||||
| ) | ||||
|  | ||||
| _Ambiguous: TypeAlias = bool | Literal["raise", "NaT"] | ||||
|  | ||||
| # Repeated from `_typing.pyi` so as to satisfy mixed strict / non-strict paths. | ||||
| # https://github.com/pandas-dev/pandas-stubs/pull/1151#issuecomment-2715130190 | ||||
| TimeZones: TypeAlias = str | _tzinfo | None | int | ||||
|  | ||||
| class Timestamp(datetime, SupportsIndex): | ||||
|     min: ClassVar[Timestamp]  # pyright: ignore[reportIncompatibleVariableOverride] | ||||
|     max: ClassVar[Timestamp]  # pyright: ignore[reportIncompatibleVariableOverride] | ||||
|  | ||||
|     resolution: ClassVar[  # pyright: ignore[reportIncompatibleVariableOverride] | ||||
|         Timedelta | ||||
|     ] | ||||
|     value: int | ||||
|     def __new__( | ||||
|         cls, | ||||
|         ts_input: np.integer | float | str | _date | datetime | np.datetime64 = ..., | ||||
|         year: int | None = ..., | ||||
|         month: int | None = ..., | ||||
|         day: int | None = ..., | ||||
|         hour: int | None = ..., | ||||
|         minute: int | None = ..., | ||||
|         second: int | None = ..., | ||||
|         microsecond: int | None = ..., | ||||
|         tzinfo: _tzinfo | None = ..., | ||||
|         *, | ||||
|         nanosecond: int | None = ..., | ||||
|         tz: TimeZones = ..., | ||||
|         unit: str | int | None = ..., | ||||
|         fold: Literal[0, 1] | None = ..., | ||||
|     ) -> Self: ... | ||||
|     # GH 46171 | ||||
|     # While Timestamp can return pd.NaT, having the constructor return | ||||
|     # a Union with NaTType makes things awkward for users of pandas | ||||
|     @property | ||||
|     def year(self) -> int: ... | ||||
|     @property | ||||
|     def month(self) -> int: ... | ||||
|     @property | ||||
|     def day(self) -> int: ... | ||||
|     @property | ||||
|     def hour(self) -> int: ... | ||||
|     @property | ||||
|     def minute(self) -> int: ... | ||||
|     @property | ||||
|     def second(self) -> int: ... | ||||
|     @property | ||||
|     def microsecond(self) -> int: ... | ||||
|     @property | ||||
|     def nanosecond(self) -> int: ... | ||||
|     @property | ||||
|     def tzinfo(self) -> _tzinfo | None: ... | ||||
|     @property | ||||
|     def tz(self) -> _tzinfo | None: ... | ||||
|     @property | ||||
|     def fold(self) -> int: ... | ||||
|  | ||||
|     if sys.version_info >= (3, 12): | ||||
|         @classmethod | ||||
|         def fromtimestamp(  # pyright: ignore[reportIncompatibleMethodOverride]  # pyrefly: ignore | ||||
|             cls, t: float, tz: _tzinfo | str | None = ... | ||||
|         ) -> Self: ... | ||||
|     else: | ||||
|         @classmethod | ||||
|         def fromtimestamp(cls, t: float, tz: _tzinfo | str | None = ...) -> Self: ... | ||||
|  | ||||
|     @classmethod | ||||
|     def utcfromtimestamp(cls, ts: float) -> Self: ... | ||||
|     @classmethod | ||||
|     def today(cls, tz: _tzinfo | str | None = None) -> Self: ... | ||||
|     @classmethod | ||||
|     def fromordinal( | ||||
|         cls, | ||||
|         ordinal: int, | ||||
|         tz: _tzinfo | str | None = ..., | ||||
|     ) -> Self: ... | ||||
|     @classmethod | ||||
|     def now(cls, tz: _tzinfo | str | None = None) -> Self: ... | ||||
|     @classmethod | ||||
|     def utcnow(cls) -> Self: ... | ||||
|     # error: Signature of "combine" incompatible with supertype "datetime" | ||||
|     @classmethod | ||||
|     def combine(cls, date: _date, time: _time) -> Self: ...  # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] | ||||
|     @classmethod | ||||
|     def fromisoformat(cls, date_string: str) -> Self: ... | ||||
|     def strftime(self, format: str) -> str: ... | ||||
|     def __format__(self, fmt: str) -> str: ... | ||||
|     def toordinal(self) -> int: ... | ||||
|     def timetuple(self) -> struct_time: ... | ||||
|     def timestamp(self) -> float: ... | ||||
|     def utctimetuple(self) -> struct_time: ... | ||||
|     def date(self) -> _date: ... | ||||
|     def time(self) -> _time: ... | ||||
|     def timetz(self) -> _time: ... | ||||
|     # Override since fold is more precise than datetime.replace(fold:int) | ||||
|     # Here it is restricted to be 0 or 1 using a Literal | ||||
|     # Violation of Liskov substitution principle | ||||
|     def replace(  # type:ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] # pyrefly: ignore | ||||
|         self, | ||||
|         year: int | None = ..., | ||||
|         month: int | None = ..., | ||||
|         day: int | None = ..., | ||||
|         hour: int | None = ..., | ||||
|         minute: int | None = ..., | ||||
|         second: int | None = ..., | ||||
|         microsecond: int | None = ..., | ||||
|         tzinfo: _tzinfo | None = ..., | ||||
|         fold: Literal[0, 1] | None = ..., | ||||
|     ) -> Timestamp: ... | ||||
|     def astimezone(self, tz: _tzinfo | None = ...) -> Self: ... | ||||
|     def ctime(self) -> str: ... | ||||
|     def isoformat(  # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] | ||||
|         self, | ||||
|         sep: str = "T", | ||||
|         timespec: Literal[ | ||||
|             "auto", | ||||
|             "hours", | ||||
|             "minutes", | ||||
|             "seconds", | ||||
|             "milliseconds", | ||||
|             "microseconds", | ||||
|             "nanoseconds", | ||||
|         ] = "auto", | ||||
|     ) -> str: ... | ||||
|     @classmethod | ||||
|     def strptime(cls, date_string: Never, format: Never) -> Never: ...  # type: ignore[override] # pyright: ignore[reportIncompatibleMethodOverride] | ||||
|     def utcoffset(self) -> timedelta | None: ... | ||||
|     def tzname(self) -> str | None: ... | ||||
|     def dst(self) -> timedelta | None: ... | ||||
|     # Mypy complains Forward operator "<inequality op>" is not callable, so ignore misc | ||||
|     # for le, lt ge and gt | ||||
|     @overload  # type: ignore[override] | ||||
|     def __le__(self, other: Timestamp | datetime | np.datetime64) -> bool: ...  # type: ignore[misc] | ||||
|     @overload | ||||
|     def __le__(self, other: DatetimeIndex) -> np_1darray[np.bool]: ... | ||||
|     @overload | ||||
|     def __le__( | ||||
|         self, other: np_ndarray[ShapeT, np.datetime64] | ||||
|     ) -> np_ndarray[ShapeT, np.bool]: ... | ||||
|     @overload | ||||
|     def __le__(self, other: TimestampSeries) -> Series[bool]: ... | ||||
|     @overload  # type: ignore[override] | ||||
|     def __lt__(self, other: Timestamp | datetime | np.datetime64) -> bool: ...  # type: ignore[misc] | ||||
|     @overload | ||||
|     def __lt__(self, other: DatetimeIndex) -> np_1darray[np.bool]: ... | ||||
|     @overload | ||||
|     def __lt__( | ||||
|         self, other: np_ndarray[ShapeT, np.datetime64] | ||||
|     ) -> np_ndarray[ShapeT, np.bool]: ... | ||||
|     @overload | ||||
|     def __lt__(self, other: TimestampSeries) -> Series[bool]: ... | ||||
|     @overload  # type: ignore[override] | ||||
|     def __ge__(self, other: Timestamp | datetime | np.datetime64) -> bool: ...  # type: ignore[misc] | ||||
|     @overload | ||||
|     def __ge__(self, other: DatetimeIndex) -> np_1darray[np.bool]: ... | ||||
|     @overload | ||||
|     def __ge__( | ||||
|         self, other: np_ndarray[ShapeT, np.datetime64] | ||||
|     ) -> np_ndarray[ShapeT, np.bool]: ... | ||||
|     @overload | ||||
|     def __ge__(self, other: TimestampSeries) -> Series[bool]: ... | ||||
|     @overload  # type: ignore[override] | ||||
|     def __gt__(self, other: Timestamp | datetime | np.datetime64) -> bool: ...  # type: ignore[misc] | ||||
|     @overload | ||||
|     def __gt__(self, other: DatetimeIndex) -> np_1darray[np.bool]: ... | ||||
|     @overload | ||||
|     def __gt__( | ||||
|         self, other: np_ndarray[ShapeT, np.datetime64] | ||||
|     ) -> np_ndarray[ShapeT, np.bool]: ... | ||||
|     @overload | ||||
|     def __gt__(self, other: TimestampSeries) -> Series[bool]: ... | ||||
|     # error: Signature of "__add__" incompatible with supertype "date"/"datetime" | ||||
|     @overload  # type: ignore[override] | ||||
|     def __add__( | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.datetime64]: ... | ||||
|     @overload | ||||
|     def __add__(self, other: timedelta | np.timedelta64 | Tick) -> Self: ... | ||||
|     @overload | ||||
|     def __add__(self, other: TimedeltaSeries) -> TimestampSeries: ... | ||||
|     @overload | ||||
|     def __add__(self, other: TimedeltaIndex) -> DatetimeIndex: ... | ||||
|     @overload | ||||
|     def __radd__(self, other: timedelta) -> Self: ... | ||||
|     @overload | ||||
|     def __radd__(self, other: TimedeltaIndex) -> DatetimeIndex: ... | ||||
|     @overload | ||||
|     def __radd__( | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.datetime64]: ... | ||||
|     # TODO: test dt64 | ||||
|     @overload  # type: ignore[override] | ||||
|     def __sub__(self, other: Timestamp | datetime | np.datetime64) -> Timedelta: ... | ||||
|     @overload | ||||
|     def __sub__(self, other: timedelta | np.timedelta64 | Tick) -> Self: ... | ||||
|     @overload | ||||
|     def __sub__(self, other: TimedeltaIndex) -> DatetimeIndex: ... | ||||
|     @overload | ||||
|     def __sub__(self, other: TimedeltaSeries) -> TimestampSeries: ... | ||||
|     @overload | ||||
|     def __sub__(self, other: TimestampSeries) -> TimedeltaSeries: ... | ||||
|     @overload | ||||
|     def __sub__( | ||||
|         self, other: np_ndarray[ShapeT, np.timedelta64] | ||||
|     ) -> np_ndarray[ShapeT, np.datetime64]: ... | ||||
|     @overload | ||||
|     def __eq__(self, other: Timestamp | datetime | np.datetime64) -> bool: ...  # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] | ||||
|     @overload | ||||
|     def __eq__(self, other: TimestampSeries) -> Series[bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __eq__(self, other: Index) -> np_1darray[np.bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __eq__(self, other: np_ndarray[ShapeT, np.datetime64]) -> np_ndarray[ShapeT, np.bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __eq__(self, other: object) -> Literal[False]: ... | ||||
|     @overload | ||||
|     def __ne__(self, other: Timestamp | datetime | np.datetime64) -> bool: ...  # type: ignore[overload-overlap] # pyright: ignore[reportOverlappingOverload] | ||||
|     @overload | ||||
|     def __ne__(self, other: TimestampSeries) -> Series[bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __ne__(self, other: Index) -> np_1darray[np.bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __ne__(self, other: np_ndarray[ShapeT, np.datetime64]) -> np_ndarray[ShapeT, np.bool]: ...  # type: ignore[overload-overlap] | ||||
|     @overload | ||||
|     def __ne__(self, other: object) -> Literal[True]: ... | ||||
|     def __hash__(self) -> int: ... | ||||
|     def weekday(self) -> int: ... | ||||
|     def isoweekday(self) -> int: ... | ||||
|     def isocalendar(self) -> _IsoCalendarDate: ... | ||||
|     @property | ||||
|     def is_leap_year(self) -> bool: ... | ||||
|     @property | ||||
|     def is_month_start(self) -> bool: ... | ||||
|     @property | ||||
|     def is_quarter_start(self) -> bool: ... | ||||
|     @property | ||||
|     def is_year_start(self) -> bool: ... | ||||
|     @property | ||||
|     def is_month_end(self) -> bool: ... | ||||
|     @property | ||||
|     def is_quarter_end(self) -> bool: ... | ||||
|     @property | ||||
|     def is_year_end(self) -> bool: ... | ||||
|     def to_pydatetime(self, warn: bool = ...) -> datetime: ... | ||||
|     def to_datetime64(self) -> np.datetime64: ... | ||||
|     def to_period(self, freq: BaseOffset | str | None = ...) -> Period: ... | ||||
|     def to_julian_date(self) -> np.float64: ... | ||||
|     @property | ||||
|     def asm8(self) -> np.datetime64: ... | ||||
|     def tz_convert(self, tz: TimeZones) -> Self: ... | ||||
|     # TODO: could return NaT? | ||||
|     def tz_localize( | ||||
|         self, | ||||
|         tz: TimeZones, | ||||
|         ambiguous: _Ambiguous = "raise", | ||||
|         nonexistent: TimestampNonexistent = "raise", | ||||
|     ) -> Self: ... | ||||
|     def normalize(self) -> Self: ... | ||||
|     # TODO: round/floor/ceil could return NaT? | ||||
|     def round( | ||||
|         self, | ||||
|         freq: str, | ||||
|         ambiguous: _Ambiguous = "raise", | ||||
|         nonexistent: TimestampNonexistent = "raise", | ||||
|     ) -> Self: ... | ||||
|     def floor( | ||||
|         self, | ||||
|         freq: str, | ||||
|         ambiguous: _Ambiguous = "raise", | ||||
|         nonexistent: TimestampNonexistent = "raise", | ||||
|     ) -> Self: ... | ||||
|     def ceil( | ||||
|         self, | ||||
|         freq: str, | ||||
|         ambiguous: _Ambiguous = "raise", | ||||
|         nonexistent: TimestampNonexistent = "raise", | ||||
|     ) -> Self: ... | ||||
|     def day_name(self, locale: str | None = None) -> str: ... | ||||
|     def month_name(self, locale: str | None = None) -> str: ... | ||||
|     @property | ||||
|     def day_of_week(self) -> int: ... | ||||
|     @property | ||||
|     def dayofweek(self) -> int: ... | ||||
|     @property | ||||
|     def day_of_year(self) -> int: ... | ||||
|     @property | ||||
|     def dayofyear(self) -> int: ... | ||||
|     @property | ||||
|     def weekofyear(self) -> int: ... | ||||
|     @property | ||||
|     def quarter(self) -> int: ... | ||||
|     @property | ||||
|     def week(self) -> int: ... | ||||
|     def to_numpy(self) -> np.datetime64: ... | ||||
|     @property | ||||
|     def days_in_month(self) -> int: ... | ||||
|     @property | ||||
|     def daysinmonth(self) -> int: ... | ||||
|     @property | ||||
|     def unit(self) -> TimeUnit: ... | ||||
|     def as_unit(self, unit: TimeUnit, round_ok: bool = True) -> Self: ... | ||||
|     # To support slicing | ||||
|     def __index__(self) -> int: ... | ||||
		Reference in New Issue
	
	Block a user