-
-
Notifications
You must be signed in to change notification settings - Fork 18.5k
TYPING: add skeleton stub for Timestamp #28195
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
Closed
Closed
Changes from 1 commit
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,109 @@ | ||
# flake8: noqa | ||
|
||
from typing import Any | ||
|
||
class RoundTo: | ||
@property | ||
def MINUS_INFTY(self) -> int: ... | ||
@property | ||
def PLUS_INFTY(self) -> int: ... | ||
@property | ||
def NEAREST_HALF_EVEN(self) -> int: ... | ||
@property | ||
def NEAREST_HALF_PLUS_INFTY(self) -> int: ... | ||
@property | ||
def NEAREST_HALF_MINUS_INFTY(self) -> int: ... | ||
|
||
def round_nsint64(values, mode, freq): ... | ||
|
||
class Timestamp: | ||
value: Any = ... | ||
freq: Any = ... | ||
tzinfo: Any = ... | ||
min: Any = ... | ||
max: Any = ... | ||
weekofyear: Any = ... | ||
daysinmonth: Any = ... | ||
astimezone: Any = ... | ||
def fromordinal(cls, ordinal, freq=..., tz=...): ... | ||
def now(cls, tz=...): ... | ||
def today(cls, tz=...): ... | ||
def utcnow(cls): ... | ||
def utcfromtimestamp(cls, ts): ... | ||
def fromtimestamp(cls, ts): ... | ||
def strptime(cls, date_string, format): ... | ||
def combine(cls, date, time): ... | ||
def __new__( | ||
cls, | ||
ts_input=..., | ||
freq=..., | ||
tz=..., | ||
unit=..., | ||
year=..., | ||
month=..., | ||
day=..., | ||
hour=..., | ||
minute=..., | ||
second=..., | ||
microsecond=..., | ||
nanosecond=..., | ||
tzinfo=..., | ||
): ... | ||
def round(self, freq, ambiguous=..., nonexistent=...): ... | ||
def floor(self, freq, ambiguous=..., nonexistent=...): ... | ||
def ceil(self, freq, ambiguous=..., nonexistent=...): ... | ||
@property | ||
def tz(self): ... | ||
@tz.setter | ||
def tz(self, value): ... | ||
def to_period(self, freq=...): ... | ||
@property | ||
def dayofweek(self): ... | ||
def day_name(self, locale=...): ... | ||
def month_name(self, locale=...): ... | ||
@property | ||
def weekday_name(self): ... | ||
@property | ||
def dayofyear(self): ... | ||
@property | ||
def week(self): ... | ||
@property | ||
def quarter(self): ... | ||
@property | ||
def days_in_month(self): ... | ||
@property | ||
def freqstr(self): ... | ||
@property | ||
def is_month_start(self): ... | ||
@property | ||
def is_month_end(self): ... | ||
@property | ||
def is_quarter_start(self): ... | ||
@property | ||
def is_quarter_end(self): ... | ||
@property | ||
def is_year_start(self): ... | ||
@property | ||
def is_year_end(self): ... | ||
@property | ||
def is_leap_year(self): ... | ||
@property | ||
def resolution(self): ... | ||
def tz_localize(self, tz, ambiguous=..., nonexistent=..., errors=...): ... | ||
def tz_convert(self, tz): ... | ||
def replace( | ||
self, | ||
year=..., | ||
month=..., | ||
day=..., | ||
hour=..., | ||
minute=..., | ||
second=..., | ||
microsecond=..., | ||
nanosecond=..., | ||
tzinfo=..., | ||
fold=..., | ||
): ... | ||
def isoformat(self, sep=...): ... | ||
def to_julian_date(self): ... | ||
def normalize(self): ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the plan here just to get this in first then refine types later? Seems like some of these could easily be inferred more strictly than any
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see #28195 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
value is int64_t in cython-space but when i look it up in python-space its just int. will typing it as
int
here conflict with typing it as int64_t in cython?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not sure i follow. value is Any.
I want to avoid discussions about types in skeleton stubs in order to avoid hampering progress towards the resolution of #28133.
we are using
ignore_missing_imports=True
in our global config. mypy states "We recommend using this approach only as a last resort: it’s equivalent to adding a # type: ignore to all unresolved imports in your codebase."so will discuss types in a follow up, but I don''t see an issue with int for return types, maybe we will need to type the arguments differently for complete type safety.