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

@@ -3,7 +3,7 @@
# NOTE: These are incomplete!
from time import struct_time
from typing import Optional, SupportsAbs, Tuple, Union, overload
from typing import AnyStr, Optional, SupportsAbs, Tuple, Union, overload
MINYEAR = 0
MAXYEAR = 0
@@ -39,7 +39,7 @@ class date(object):
def ctime(self) -> str: ...
def strftime(self, fmt: Union[str, unicode]) -> str: ...
def __format__(self, fmt: Union[str, unicode]) -> str: ...
def __format__(self, fmt: AnyStr) -> AnyStr: ...
def isoformat(self) -> str: ...
def timetuple(self) -> struct_time: ...
def toordinal(self) -> int: ...
@@ -84,7 +84,7 @@ class time:
def __hash__(self) -> int: ...
def isoformat(self) -> str: ...
def strftime(self, fmt: Union[str, unicode]) -> str: ...
def __format__(self, fmt: str) -> str: ...
def __format__(self, fmt: AnyStr) -> AnyStr: ...
def utcoffset(self) -> Optional[timedelta]: ...
def tzname(self) -> Optional[str]: ...
def dst(self) -> Optional[int]: ...
@@ -114,7 +114,7 @@ class timedelta(SupportsAbs[timedelta]):
def __add__(self, other: timedelta) -> timedelta: ...
def __radd__(self, other: timedelta) -> timedelta: ...
def __sub__(self, other: timedelta) -> timedelta: ...
def __rsub(self, other: timedelta) -> timedelta: ...
def __rsub__(self, other: timedelta) -> timedelta: ...
def __neg__(self) -> timedelta: ...
def __pos__(self) -> timedelta: ...
def __abs__(self) -> timedelta: ...
@@ -135,7 +135,7 @@ class timedelta(SupportsAbs[timedelta]):
def __hash__(self) -> int: ...
class datetime(object):
# TODO: is actually subclass of date, but __le__, __lt__, __ge__, __gt__ don't work with date.
# TODO: is actually subclass of date, but __le__, __lt__, __ge__, __gt__, __sub__ don't work with date.
min = ... # type: datetime
max = ... # type: datetime
resolution = ... # type: timedelta
@@ -176,7 +176,7 @@ class datetime(object):
@classmethod
def combine(cls, date: date, time: time) -> datetime: ...
def strftime(self, fmt: Union[str, unicode]) -> str: ...
def __format__(self, fmt: str) -> str: ...
def __format__(self, fmt: AnyStr) -> AnyStr: ...
def toordinal(self) -> int: ...
def timetuple(self) -> struct_time: ...
def utctimetuple(self) -> struct_time: ...