Skip to content

Commit ef819f3

Browse files
authored
Remove pre-Python 3.6 branches from datetime.pyi (#7602)
1 parent 536f783 commit ef819f3

File tree

1 file changed

+24
-58
lines changed

1 file changed

+24
-58
lines changed

stdlib/datetime.pyi

Lines changed: 24 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,7 @@ class date:
6565
def isoformat(self) -> str: ...
6666
def timetuple(self) -> struct_time: ...
6767
def toordinal(self) -> int: ...
68-
if sys.version_info >= (3, 6):
69-
def replace(self: Self, year: int = ..., month: int = ..., day: int = ...) -> Self: ...
70-
else:
71-
# Prior to Python 3.6, the `replace` method always returned `date`, even in subclasses
72-
def replace(self, year: int = ..., month: int = ..., day: int = ...) -> date: ...
73-
68+
def replace(self: Self, year: int = ..., month: int = ..., day: int = ...) -> Self: ...
7469
def __le__(self, __other: date) -> bool: ...
7570
def __lt__(self, __other: date) -> bool: ...
7671
def __ge__(self, __other: date) -> bool: ...
@@ -144,29 +139,16 @@ class time:
144139
def utcoffset(self) -> timedelta | None: ...
145140
def tzname(self) -> str | None: ...
146141
def dst(self) -> timedelta | None: ...
147-
if sys.version_info >= (3, 6):
148-
def replace(
149-
self: Self,
150-
hour: int = ...,
151-
minute: int = ...,
152-
second: int = ...,
153-
microsecond: int = ...,
154-
tzinfo: _tzinfo | None = ...,
155-
*,
156-
fold: int = ...,
157-
) -> Self: ...
158-
else:
159-
# Prior to Python 3.6, the `replace` method always returned `time`, even in subclasses
160-
def replace(
161-
self,
162-
hour: int = ...,
163-
minute: int = ...,
164-
second: int = ...,
165-
microsecond: int = ...,
166-
tzinfo: _tzinfo | None = ...,
167-
*,
168-
fold: int = ...,
169-
) -> time: ...
142+
def replace(
143+
self: Self,
144+
hour: int = ...,
145+
minute: int = ...,
146+
second: int = ...,
147+
microsecond: int = ...,
148+
tzinfo: _tzinfo | None = ...,
149+
*,
150+
fold: int = ...,
151+
) -> Self: ...
170152

171153
_date = date
172154
_time = time
@@ -278,35 +260,19 @@ class datetime(date):
278260
def date(self) -> _date: ...
279261
def time(self) -> _time: ...
280262
def timetz(self) -> _time: ...
281-
if sys.version_info >= (3, 6):
282-
def replace(
283-
self: Self,
284-
year: int = ...,
285-
month: int = ...,
286-
day: int = ...,
287-
hour: int = ...,
288-
minute: int = ...,
289-
second: int = ...,
290-
microsecond: int = ...,
291-
tzinfo: _tzinfo | None = ...,
292-
*,
293-
fold: int = ...,
294-
) -> Self: ...
295-
else:
296-
# Prior to Python 3.6, the `replace` method always returned `datetime`, even in subclasses
297-
def replace(
298-
self,
299-
year: int = ...,
300-
month: int = ...,
301-
day: int = ...,
302-
hour: int = ...,
303-
minute: int = ...,
304-
second: int = ...,
305-
microsecond: int = ...,
306-
tzinfo: _tzinfo | None = ...,
307-
*,
308-
fold: int = ...,
309-
) -> datetime: ...
263+
def replace(
264+
self: Self,
265+
year: int = ...,
266+
month: int = ...,
267+
day: int = ...,
268+
hour: int = ...,
269+
minute: int = ...,
270+
second: int = ...,
271+
microsecond: int = ...,
272+
tzinfo: _tzinfo | None = ...,
273+
*,
274+
fold: int = ...,
275+
) -> Self: ...
310276
if sys.version_info >= (3, 8):
311277
def astimezone(self: Self, tz: _tzinfo | None = ...) -> Self: ...
312278
else:

0 commit comments

Comments
 (0)