Skip to content

Commit 33039f9

Browse files
jmaroederJelleZijlstra
authored andcommitted
Adding py36 additions to datetime module (#1848)
1 parent 1c3ec74 commit 33039f9

File tree

1 file changed

+35
-10
lines changed

1 file changed

+35
-10
lines changed

stdlib/2and3/datetime.pyi

Lines changed: 35 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,9 @@ class time:
9393
def microsecond(self) -> int: ...
9494
@property
9595
def tzinfo(self) -> Optional[_tzinfo]: ...
96+
if sys.version_info >= (3, 6):
97+
@property
98+
def fold(self) -> int: ...
9699

97100
def __le__(self, other: time) -> bool: ...
98101
def __lt__(self, other: time) -> bool: ...
@@ -108,8 +111,13 @@ class time:
108111
def utcoffset(self) -> Optional[timedelta]: ...
109112
def tzname(self) -> Optional[str]: ...
110113
def dst(self) -> Optional[int]: ...
111-
def replace(self, hour: int = ..., minute: int = ..., second: int = ...,
112-
microsecond: int = ..., tzinfo: Optional[_tzinfo] = ...) -> time: ...
114+
if sys.version_info >= (3, 6):
115+
def replace(self, hour: int = ..., minute: int = ..., second: int = ...,
116+
microsecond: int = ..., tzinfo: Optional[_tzinfo] = ...,
117+
*, fold: int = ...) -> time: ...
118+
else:
119+
def replace(self, hour: int = ..., minute: int = ..., second: int = ...,
120+
microsecond: int = ..., tzinfo: Optional[_tzinfo] = ...) -> time: ...
113121

114122
_date = date
115123
_time = time
@@ -168,9 +176,14 @@ class datetime:
168176
max: ClassVar[datetime]
169177
resolution: ClassVar[timedelta]
170178

171-
def __init__(self, year: int, month: int, day: int, hour: int = ...,
172-
minute: int = ..., second: int = ..., microsecond: int = ...,
173-
tzinfo: Optional[tzinfo] = ...) -> None: ...
179+
if sys.version_info >= (3, 6):
180+
def __init__(self, year: int, month: int, day: int, hour: int = ...,
181+
minute: int = ..., second: int = ..., microsecond: int = ...,
182+
tzinfo: Optional[tzinfo] = ..., *, fold: int = ...) -> None: ...
183+
else:
184+
def __init__(self, year: int, month: int, day: int, hour: int = ...,
185+
minute: int = ..., second: int = ..., microsecond: int = ...,
186+
tzinfo: Optional[tzinfo] = ...) -> None: ...
174187

175188
@property
176189
def year(self) -> int: ...
@@ -188,6 +201,9 @@ class datetime:
188201
def microsecond(self) -> int: ...
189202
@property
190203
def tzinfo(self) -> Optional[_tzinfo]: ...
204+
if sys.version_info >= (3, 6):
205+
@property
206+
def fold(self) -> int: ...
191207

192208
@classmethod
193209
def fromtimestamp(cls, t: float, tz: Optional[_tzinfo] = ...) -> datetime: ...
@@ -201,8 +217,12 @@ class datetime:
201217
def now(cls, tz: Optional[_tzinfo] = ...) -> datetime: ...
202218
@classmethod
203219
def utcnow(cls) -> datetime: ...
204-
@classmethod
205-
def combine(cls, date: date, time: time) -> datetime: ...
220+
if sys.version_info >= (3, 6):
221+
@classmethod
222+
def combine(cls, date: date, time: time, tzinfo: Optional[_tzinfo] = ...) -> datetime: ...
223+
else:
224+
@classmethod
225+
def combine(cls, date: date, time: time) -> datetime: ...
206226
def strftime(self, fmt: _Text) -> str: ...
207227
if sys.version_info >= (3,):
208228
def __format__(self, fmt: str) -> str: ...
@@ -216,9 +236,14 @@ class datetime:
216236
def date(self) -> _date: ...
217237
def time(self) -> _time: ...
218238
def timetz(self) -> _time: ...
219-
def replace(self, year: int = ..., month: int = ..., day: int = ..., hour: int = ...,
220-
minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo:
221-
Optional[_tzinfo] = ...) -> datetime: ...
239+
if sys.version_info >= (3, 6):
240+
def replace(self, year: int = ..., month: int = ..., day: int = ..., hour: int = ...,
241+
minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo:
242+
Optional[_tzinfo] = ..., *, fold: int = ...) -> datetime: ...
243+
else:
244+
def replace(self, year: int = ..., month: int = ..., day: int = ..., hour: int = ...,
245+
minute: int = ..., second: int = ..., microsecond: int = ..., tzinfo:
246+
Optional[_tzinfo] = ...) -> datetime: ...
222247
if sys.version_info >= (3, 3):
223248
def astimezone(self, tz: Optional[_tzinfo] = ...) -> datetime: ...
224249
else:

0 commit comments

Comments
 (0)