fix date.isocalendar() to return namedtuple on py39+ (#5302)

This commit is contained in:
Arie Bovenberg
2021-05-02 15:39:11 +02:00
committed by GitHub
parent 3c49b1def4
commit 96ad09c559

View File

@@ -1,6 +1,6 @@
import sys
from time import struct_time
from typing import AnyStr, ClassVar, Optional, SupportsAbs, Tuple, Type, TypeVar, Union, overload
from typing import AnyStr, ClassVar, NamedTuple, Optional, SupportsAbs, Tuple, Type, TypeVar, Union, overload
_S = TypeVar("_S")
@@ -26,6 +26,12 @@ if sys.version_info >= (3, 2):
def __init__(self, offset: timedelta, name: str = ...) -> None: ...
def __hash__(self) -> int: ...
if sys.version_info >= (3, 9):
class _IsoCalendarDate(NamedTuple):
year: int
week: int
weekday: int
_tzinfo = tzinfo
class date:
@@ -78,7 +84,10 @@ class date:
def __hash__(self) -> int: ...
def weekday(self) -> int: ...
def isoweekday(self) -> int: ...
def isocalendar(self) -> Tuple[int, int, int]: ...
if sys.version_info >= (3, 9):
def isocalendar(self) -> _IsoCalendarDate: ...
else:
def isocalendar(self) -> Tuple[int, int, int]: ...
class time:
min: ClassVar[time]
@@ -370,4 +379,7 @@ class datetime(date):
def __hash__(self) -> int: ...
def weekday(self) -> int: ...
def isoweekday(self) -> int: ...
def isocalendar(self) -> Tuple[int, int, int]: ...
if sys.version_info >= (3, 9):
def isocalendar(self) -> _IsoCalendarDate: ...
else:
def isocalendar(self) -> Tuple[int, int, int]: ...