mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-24 12:51:27 +08:00
Add TimeTuple in python3's time.pyi and datetime.pyi. (#597)
Add `TimeTuple = Tuple[int, int, int, int, int, int, int, int, int]` to stdlib/3/time.pyi and stdlib/3/datetime.pyi. Use `TimeTuple` instead of `tuple` (where relevant) in time.pyi for stronger type checking. Use `TimeTuple` instead of `Tuple[int, int, int, int, int, int, int, int, int]` in datetime.pyi to increase readability.
This commit is contained in:
committed by
Matthias Kramm
parent
b0eae4bf46
commit
b92991bc2a
@@ -7,6 +7,8 @@ from typing import Optional, SupportsAbs, Tuple, overload
|
||||
MINYEAR = 0
|
||||
MAXYEAR = 0
|
||||
|
||||
TimeTuple = Tuple[int, int, int, int, int, int, int, int, int]
|
||||
|
||||
class tzinfo:
|
||||
def tzname(self, dt: Optional[datetime]) -> str: ...
|
||||
def utcoffset(self, dt: Optional[datetime]) -> Optional[timedelta]: ...
|
||||
@@ -189,9 +191,9 @@ class datetime:
|
||||
def strftime(self, fmt: str) -> str: ...
|
||||
def __format__(self, fmt: str) -> str: ...
|
||||
def toordinal(self) -> int: ...
|
||||
def timetuple(self) -> tuple: ... # TODO return type
|
||||
def timetuple(self) -> TimeTuple: ... # TODO return type
|
||||
def timestamp(self) -> float: ...
|
||||
def utctimetuple(self) -> tuple: ... # TODO return type
|
||||
def utctimetuple(self) -> TimeTuple: ... # TODO return type
|
||||
def date(self) -> _date: ...
|
||||
def time(self) -> _time: ...
|
||||
def timetz(self) -> _time: ...
|
||||
|
||||
Reference in New Issue
Block a user