Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 26 additions & 7 deletions stdlib/datetime.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down Expand Up @@ -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: ...
Expand Down Expand Up @@ -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):
Expand Down