mirror of
https://github.com/davidhalter/typeshed.git
synced 2025-12-07 12:44:28 +08:00
datetime: various parameters can now safely be passed as keyword arguments on 3.12+ (#9415)
This commit is contained in:
@@ -70,7 +70,14 @@ class date:
|
||||
@property
|
||||
def day(self) -> int: ...
|
||||
def ctime(self) -> str: ...
|
||||
def strftime(self, __format: str) -> str: ...
|
||||
# On <3.12, the name of the parameter in the pure-Python implementation
|
||||
# didn't match the name in the C implementation,
|
||||
# meaning it is only *safe* to pass it as a keyword argument on 3.12+
|
||||
if sys.version_info >= (3, 12):
|
||||
def strftime(self, format: str) -> str: ...
|
||||
else:
|
||||
def strftime(self, __format: str) -> str: ...
|
||||
|
||||
def __format__(self, __fmt: str) -> str: ...
|
||||
def isoformat(self) -> str: ...
|
||||
def timetuple(self) -> struct_time: ...
|
||||
@@ -140,7 +147,14 @@ class time:
|
||||
def isoformat(self, timespec: str = ...) -> str: ...
|
||||
@classmethod
|
||||
def fromisoformat(cls: type[Self], __time_string: str) -> Self: ...
|
||||
def strftime(self, __format: str) -> str: ...
|
||||
# On <3.12, the name of the parameter in the pure-Python implementation
|
||||
# didn't match the name in the C implementation,
|
||||
# meaning it is only *safe* to pass it as a keyword argument on 3.12+
|
||||
if sys.version_info >= (3, 12):
|
||||
def strftime(self, format: str) -> str: ...
|
||||
else:
|
||||
def strftime(self, __format: str) -> str: ...
|
||||
|
||||
def __format__(self, __fmt: str) -> str: ...
|
||||
def utcoffset(self) -> timedelta | None: ...
|
||||
def tzname(self) -> str | None: ...
|
||||
@@ -233,11 +247,16 @@ class datetime(date):
|
||||
def tzinfo(self) -> _TzInfo | None: ...
|
||||
@property
|
||||
def fold(self) -> int: ...
|
||||
# The first parameter in `fromtimestamp` is actually positional-or-keyword,
|
||||
# but it is named "timestamp" in the C implementation and "t" in the Python implementation,
|
||||
# so it is only truly *safe* to pass it as a positional argument.
|
||||
@classmethod
|
||||
def fromtimestamp(cls: type[Self], __timestamp: float, tz: _TzInfo | None = ...) -> Self: ...
|
||||
# On <3.12, the name of the first parameter in the pure-Python implementation
|
||||
# didn't match the name in the C implementation,
|
||||
# meaning it is only *safe* to pass it as a keyword argument on 3.12+
|
||||
if sys.version_info >= (3, 12):
|
||||
@classmethod
|
||||
def fromtimestamp(cls: type[Self], timestamp: float, tz: _TzInfo | None = ...) -> Self: ...
|
||||
else:
|
||||
@classmethod
|
||||
def fromtimestamp(cls: type[Self], __timestamp: float, tz: _TzInfo | None = ...) -> Self: ...
|
||||
|
||||
@classmethod
|
||||
def utcfromtimestamp(cls: type[Self], __t: float) -> Self: ...
|
||||
if sys.version_info >= (3, 8):
|
||||
|
||||
Reference in New Issue
Block a user