Skip to content

remove several internal-only methods from offsets.pyi #1163

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 2 additions & 21 deletions pandas-stubs/_libs/tslibs/offsets.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ from pandas.tseries.holiday import AbstractHolidayCalendar
_DatetimeT = TypeVar("_DatetimeT", bound=datetime)
_TimedeltaT = TypeVar("_TimedeltaT", bound=timedelta)

prefix_mapping: dict[str, type]
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private


class ApplyTypeError(TypeError): ...

class BaseOffset:
Expand Down Expand Up @@ -96,9 +94,6 @@ class BaseOffset:
def __getstate__(self): ...
@property
def nanos(self) -> int: ...
def onOffset(self, dt: datetime) -> bool: ...
def isAnchored(self) -> bool: ...
Comment on lines -99 to -100
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove quite a while ago

def is_anchored(self) -> bool: ...
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

deprecated


class SingleConstructorOffset(BaseOffset):
def __reduce__(self): ...
Expand All @@ -110,8 +105,6 @@ class Tick(SingleConstructorOffset):
@property
def nanos(self) -> int: ...

def delta_to_tick(delta: timedelta) -> Tick: ...

class Day(Tick): ...
class Hour(Tick): ...
class Minute(Tick): ...
Expand All @@ -123,19 +116,14 @@ class Nano(Tick): ...
class RelativeDeltaOffset(BaseOffset):
def __init__(self, n: int = ..., normalize: bool = ..., **kwds: Any) -> None: ...

class BusinessMixin(SingleConstructorOffset):
def __init__(
self, n: int = ..., normalize: bool = ..., offset: timedelta = ...
) -> None: ...
Comment on lines -126 to -129
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this was only subclassed by BusinessHour and _CustomBusinessMonth, but they both override its only method (__init__). Given that it's not even public, OK to just remove it?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes


# 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(BusinessMixin):
class BusinessHour(SingleConstructorOffset):
def __init__(
self,
n: int = ...,
Expand Down Expand Up @@ -209,7 +197,7 @@ class FY5253(FY5253Mixin): ...
class FY5253Quarter(FY5253Mixin): ...
class Easter(SingleConstructorOffset): ...

class _CustomBusinessMonth(BusinessMixin):
class _CustomBusinessMonth(SingleConstructorOffset):
def __init__(
self,
n: int = ...,
Expand Down Expand Up @@ -274,10 +262,3 @@ BMonthBegin = BusinessMonthBegin
CBMonthEnd = CustomBusinessMonthEnd
CBMonthBegin = CustomBusinessMonthBegin
CDay = CustomBusinessDay

def roll_qtrday(
other: datetime, n: int, month: int, day_opt: str, modby: int
) -> int: ...
def shift_months(
dtindex: npt.NDArray[np.int64], months: int, day_opt: str | None = ...
) -> npt.NDArray[np.int64]: ...
Comment on lines -278 to -283
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private