-
-
Notifications
You must be signed in to change notification settings - Fork 18.6k
TYP: misc typing in _libs #44349
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
TYP: misc typing in _libs #44349
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,30 +59,30 @@ class Period: | |
def __new__( # type: ignore[misc] | ||
cls, | ||
value=..., | ||
freq=..., | ||
ordinal=..., | ||
year=..., | ||
month=..., | ||
quarter=..., | ||
day=..., | ||
hour=..., | ||
minute=..., | ||
second=..., | ||
freq: int | str | 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 = ..., | ||
) -> Period | NaTType: ... | ||
@classmethod | ||
def _maybe_convert_freq(cls, freq) -> BaseOffset: ... | ||
@classmethod | ||
def _from_ordinal(cls, ordinal: int, freq) -> Period: ... | ||
@classmethod | ||
def now(cls, freq=...) -> Period: ... | ||
def now(cls, freq: BaseOffset = ...) -> Period: ... | ||
def strftime(self, fmt: str) -> str: ... | ||
def to_timestamp( | ||
self, | ||
freq: str | BaseOffset | None = ..., | ||
how: str = ..., | ||
tz: Timezone | None = ..., | ||
) -> Timestamp: ... | ||
def asfreq(self, freq, how=...) -> Period: ... | ||
def asfreq(self, freq: str, how: str = ...) -> Period: ... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
If the documentation is out of date, I'll only comment on these cases for now. |
||
@property | ||
def freqstr(self) -> str: ... | ||
@property | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,7 +14,7 @@ from pandas._libs.tslibs import ( | |
) | ||
from pandas._typing import npt | ||
|
||
_S = TypeVar("_S") | ||
_S = TypeVar("_S", bound=timedelta) | ||
|
||
def ints_to_pytimedelta( | ||
arr: npt.NDArray[np.int64], # const int64_t[:] | ||
|
@@ -36,7 +36,10 @@ class Timedelta(timedelta): | |
|
||
# error: "__new__" must return a class instance (got "Union[Timedelta, NaTType]") | ||
def __new__( # type: ignore[misc] | ||
cls: Type[_S], value=..., unit=..., **kwargs | ||
cls: Type[_S], | ||
value=..., | ||
unit: str = ..., | ||
**kwargs: int | float | np.integer | np.floating, | ||
) -> _S | NaTType: ... | ||
@property | ||
def days(self) -> int: ... | ||
|
@@ -50,9 +53,9 @@ class Timedelta(timedelta): | |
@property | ||
def asm8(self) -> np.timedelta64: ... | ||
# TODO: round/floor/ceil could return NaT? | ||
def round(self: _S, freq) -> _S: ... | ||
def floor(self: _S, freq) -> _S: ... | ||
def ceil(self: _S, freq) -> _S: ... | ||
def round(self: _S, freq: str) -> _S: ... | ||
def floor(self: _S, freq: str) -> _S: ... | ||
def ceil(self: _S, freq: str) -> _S: ... | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could also be BaseOffset? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added most annotations based on the documentation (when available): it mentions only strings. |
||
@property | ||
def resolution_string(self) -> str: ... | ||
def __add__(self, other: timedelta) -> timedelta: ... | ||
|
Uh oh!
There was an error while loading. Please reload this page.