Make 'datetime' a subclass of 'date'. (#2488)

Fixes #2487.
This commit is contained in:
Manuel Vázquez Acosta
2018-10-01 23:19:02 -04:00
committed by Jelle Zijlstra
parent b2a9f2e383
commit 1297caa27b

View File

@@ -185,8 +185,7 @@ class timedelta(SupportsAbs[timedelta]):
def __gt__(self, other: timedelta) -> bool: ...
def __hash__(self) -> int: ...
class datetime:
# TODO: Is a subclass of date, but this would make some types incompatible.
class datetime(date):
min: ClassVar[datetime]
max: ClassVar[datetime]
resolution: ClassVar[timedelta]
@@ -276,15 +275,15 @@ class datetime:
def utcoffset(self) -> Optional[timedelta]: ...
def tzname(self) -> Optional[str]: ...
def dst(self) -> Optional[int]: ...
def __le__(self, other: datetime) -> bool: ...
def __lt__(self, other: datetime) -> bool: ...
def __ge__(self, other: datetime) -> bool: ...
def __gt__(self, other: datetime) -> bool: ...
def __le__(self, other: datetime) -> bool: ... # type: ignore
def __lt__(self, other: datetime) -> bool: ... # type: ignore
def __ge__(self, other: datetime) -> bool: ... # type: ignore
def __gt__(self, other: datetime) -> bool: ... # type: ignore
def __add__(self, other: timedelta) -> datetime: ...
@overload
def __sub__(self, other: datetime) -> timedelta: ...
@overload
def __sub__(self, other: timedelta) -> datetime: ...
@overload # type: ignore
def __sub__(self, other: datetime) -> timedelta: ... # type: ignore
@overload # type: ignore
def __sub__(self, other: timedelta) -> datetime: ... # type: ignore
def __hash__(self) -> int: ...
def weekday(self) -> int: ...
def isoweekday(self) -> int: ...