mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-08 13:04:46 +08:00
fix date.isocalendar() to return namedtuple on py39+ (#5302)
This commit is contained in:
@@ -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]: ...
|
||||
|
||||
Reference in New Issue
Block a user