Skip to content

Commit 5b9fc3d

Browse files
committed
Guard datetime 3.15 parameter names
1 parent a631519 commit 5b9fc3d

1 file changed

Lines changed: 36 additions & 12 deletions

File tree

stdlib/datetime.pyi

Lines changed: 36 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -63,8 +63,13 @@ class date:
6363
def today(cls) -> Self: ...
6464
@classmethod
6565
def fromordinal(cls, n: int, /) -> Self: ...
66-
@classmethod
67-
def fromisoformat(cls, string: str, /) -> Self: ...
66+
if sys.version_info >= (3, 15):
67+
@classmethod
68+
def fromisoformat(cls, string: str, /) -> Self: ...
69+
else:
70+
@classmethod
71+
def fromisoformat(cls, date_string: str, /) -> Self: ...
72+
6873
@classmethod
6974
def fromisocalendar(cls, year: int, week: int, day: int) -> Self: ...
7075
@property
@@ -76,8 +81,12 @@ class date:
7681
def ctime(self) -> str: ...
7782

7883
if sys.version_info >= (3, 14):
79-
@classmethod
80-
def strptime(cls, string: str, format: str, /) -> Self: ...
84+
if sys.version_info >= (3, 15):
85+
@classmethod
86+
def strptime(cls, string: str, format: str, /) -> Self: ...
87+
else:
88+
@classmethod
89+
def strptime(cls, date_string: str, format: str, /) -> Self: ...
8190

8291
# On <3.12, the name of the parameter in the pure-Python implementation
8392
# didn't match the name in the C implementation,
@@ -147,12 +156,20 @@ class time:
147156
def __eq__(self, value: object, /) -> bool: ...
148157
def __hash__(self) -> int: ...
149158
def isoformat(self, timespec: str = "auto") -> str: ...
150-
@classmethod
151-
def fromisoformat(cls, string: str, /) -> Self: ...
159+
if sys.version_info >= (3, 15):
160+
@classmethod
161+
def fromisoformat(cls, string: str, /) -> Self: ...
162+
else:
163+
@classmethod
164+
def fromisoformat(cls, time_string: str, /) -> Self: ...
152165

153166
if sys.version_info >= (3, 14):
154-
@classmethod
155-
def strptime(cls, string: str, format: str, /) -> Self: ...
167+
if sys.version_info >= (3, 15):
168+
@classmethod
169+
def strptime(cls, string: str, format: str, /) -> Self: ...
170+
else:
171+
@classmethod
172+
def strptime(cls, date_string: str, format: str, /) -> Self: ...
156173

157174
# On <3.12, the name of the parameter in the pure-Python implementation
158175
# didn't match the name in the C implementation,
@@ -291,8 +308,10 @@ class datetime(date):
291308
def utcnow(cls) -> Self: ...
292309
@classmethod
293310
def combine(cls, date: _Date, time: _Time, tzinfo: _TzInfo | None = ...) -> Self: ...
294-
@classmethod
295-
def fromisoformat(cls, string: str, /) -> Self: ...
311+
if sys.version_info >= (3, 15):
312+
@classmethod
313+
def fromisoformat(cls, string: str, /) -> Self: ...
314+
296315
def timestamp(self) -> float: ...
297316
def utctimetuple(self) -> struct_time: ...
298317
def date(self) -> _Date: ...
@@ -329,8 +348,13 @@ class datetime(date):
329348
) -> Self: ...
330349
def astimezone(self, tz: _TzInfo | None = None) -> Self: ...
331350
def isoformat(self, sep: str = "T", timespec: str = "auto") -> str: ...
332-
@classmethod
333-
def strptime(cls, string: str, format: str, /) -> Self: ...
351+
if sys.version_info >= (3, 15):
352+
@classmethod
353+
def strptime(cls, string: str, format: str, /) -> Self: ...
354+
else:
355+
@classmethod
356+
def strptime(cls, date_string: str, format: str, /) -> Self: ...
357+
334358
def utcoffset(self) -> timedelta | None: ...
335359
def tzname(self) -> str | None: ...
336360
def dst(self) -> timedelta | None: ...

0 commit comments

Comments
 (0)