-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
Adding datetimerange stubs #3845
Changes from 6 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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
from typing import Any, Optional, Union, Iterable | ||
import datetime | ||
from dateutil.relativedelta import relativedelta | ||
|
||
class DateTimeRange: | ||
NOT_A_TIME_STR: str = ... | ||
start_time_format: str = ... | ||
end_time_format: str = ... | ||
is_output_elapse: bool = ... | ||
separator: str = ... | ||
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. Nit: |
||
def __init__(self, start_datetime: Optional[str], end_datetime: Optional[str], start_time_format: str = ..., end_time_format: str = ...) -> None: ... | ||
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.
|
||
def __eq__(self, other) -> bool: ... | ||
def __ne__(self, other) -> bool: ... | ||
def __add__(self, other) -> DateTimeRange: ... | ||
def __iadd__(self, other) -> DateTimeRange: ... | ||
def __sub__(self, other) -> DateTimeRange: ... | ||
def __isub__(self, other) -> DateTimeRange: ... | ||
def __contains__(self, x) -> bool: ... | ||
@property | ||
def start_datetime(self) -> datetime.datetime: ... | ||
@property | ||
def end_datetime(self) -> datetime.datetime: ... | ||
@property | ||
def timedelta(self) -> datetime.timedelta: ... | ||
def is_set(self) -> bool: ... | ||
def validate_time_inversion(self) -> None: ... | ||
def is_valid_timerange(self) -> bool: ... | ||
def is_intersection(self, x) -> bool: ... | ||
def get_start_time_str(self) -> str: ... | ||
def get_end_time_str(self) -> str: ... | ||
def get_timedelta_second(self) -> float: ... | ||
def set_start_datetime(self, value: Union[datetime.datetime, str], timezone: str = ...) -> None: ... | ||
def set_end_datetime(self, value: Union[datetime.datetime, str], timezone: str = ...) -> None: ... | ||
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. Since the |
||
def set_time_range(self, start: Union[datetime.datetime, str], end: Union[datetime.datetime, str]) -> None: ... | ||
def range(self, step: Union[datetime.timedelta, relativedelta]) -> Iterable[datetime.datetime]: ... | ||
def intersection(self, x: DateTimeRange) -> DateTimeRange: ... | ||
def encompass(self, x: DateTimeRange) -> DateTimeRange: ... | ||
def truncate(self, percentage: float) -> None: ... |
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.
Since this stub is for Python 2 as well, this should use
object
as base class to mark this as a new-style class: