Fixes for datetime and relativedelta (#1191)

Fixes #1163.
This commit is contained in:
Jelle Zijlstra
2017-04-22 15:52:55 -07:00
committed by Guido van Rossum
parent 8dc082dce5
commit 1350d7e4d2
2 changed files with 31 additions and 26 deletions

View File

@@ -1,8 +1,11 @@
from typing import Any, List, Optional, Union
from typing import overload, Any, List, Optional, SupportsFloat, TypeVar, Union
from datetime import date, datetime, timedelta
__all__ = ... # type: List[str]
_SelfT = TypeVar('_SelfT', bound=relativedelta)
_DateT = TypeVar('_DateT', date, datetime)
class weekday(object):
def __init__(self, weekday: int, n: Optional[int]=...) -> None: ...
@@ -49,38 +52,40 @@ class relativedelta(object):
@weeks.setter
def weeks(self, value: int) -> None: ...
def normalized(self) -> 'relativedelta': ...
def normalized(self: _SelfT) -> _SelfT: ...
def __add__(
self,
other: Union['relativedelta', timedelta, date, datetime]) -> 'relativedelta': ...
@overload
def __add__(self: _SelfT, other: relativedelta) -> _SelfT: ...
@overload
def __add__(self: _SelfT, other: timedelta) -> _SelfT: ...
@overload
def __add__(self, other: _DateT) -> _DateT: ...
@overload
def __radd__(self: _SelfT, other: timedelta) -> _SelfT: ...
@overload
def __radd__(self, other: _DateT) -> _DateT: ...
@overload
def __rsub__(self: _SelfT, other: timedelta) -> _SelfT: ...
@overload
def __rsub__(self, other: _DateT) -> _DateT: ...
def __sub__(self: _SelfT, other: relativedelta) -> _SelfT: ...
def __radd__(
self,
other: Any) -> 'relativedelta': ...
def __rsub__(
self,
other: Any) -> 'relativedelta': ...
def __sub__(self, other: 'relativedelta') -> 'relativedelta': ...
def __neg__(self) -> 'relativedelta': ...
def __neg__(self: _SelfT) -> _SelfT: ...
def __bool__(self) -> bool: ...
def __nonzero__(self) -> bool: ...
def __mul__(self, other: float) -> 'relativedelta': ...
def __mul__(self: _SelfT, other: SupportsFloat) -> _SelfT: ...
def __rmul__(self, other: float) -> 'relativedelta': ...
def __rmul__(self: _SelfT, other: SupportsFloat) -> _SelfT: ...
def __eq__(self, other) -> bool: ...
def __ne__(self, other: object) -> bool: ...
def __div__(self, other: float) -> 'relativedelta': ...
def __div__(self: _SelfT, other: SupportsFloat) -> _SelfT: ...
def __truediv__(self, other: float) -> 'relativedelta': ...
def __truediv__(self: _SelfT, other: SupportsFloat) -> _SelfT: ...
def __repr__(self) -> str: ...