Commit Graph

19 Commits

Author SHA1 Message Date
Paul Ganssle
3dfc606670 Correct return type of time.dst (#3964)
`time.dst` either returns None or the result of tzinfo.dst(None), which
returns datetime.timedelta
2020-05-03 23:13:22 +02:00
Rebecca Chen
37051ec699 Have datetime.{date,datetime} define __new__ instead of __init__. (#3829)
This is more faithful to the implementation:
https://github.com/python/cpython/blob/3.5/Lib/datetime.py.

When these classes define __init__, pytype has trouble type-checking
classes that inherit from datetime.datetime (done in, e.g., the third party
datetime_tz library) because it gets confused about what arguments the
constructor expects.
2020-03-07 12:52:04 +01:00
Shantanu
83833116bd datetime: mark positional-only args (#3791) 2020-02-29 14:18:34 +01:00
Ophir LOJKINE
fda384fe0a Add date.__radd__ and datetime.__radd__ (#3539)
Fixes #3538
2019-12-12 18:38:51 +01:00
bianca rosa
4b8c6bbea1 add timespec arg to datetime.time.isoformat (#3432)
Close #3431
2019-11-01 11:25:15 +01:00
Sebastian Rittau
62bbdf856c Add several Python 3.8 annotations (#3347) 2019-10-12 19:36:56 +02:00
Sebastian Rittau
8a7d61741d Python3.8 additions and changes (#3337)
* Add as_integer_ratio() to a few types

* Add dirs_exist_ok to copytree()

* int, float, complex accept __index__ args

Also fix complex.__init__ argument names

* Add __reversed__ to dict et al.

* Python 3.8 date(time) arithmetic fixes

* Add CodeType.replace()
2019-10-10 20:51:27 -07:00
Eric Traut
c65b5cc61c Changed combine method in datetime to use aliased _date and _time types (like all other methods in this class) to avoid namespace collision with date and time methods. (#3251) 2019-09-23 18:23:46 +02:00
Joel Rosdahl
41d6a2791a Fix return type of datetime.datetime.dst (#2634)
Fixes #2633.
2018-11-26 14:35:23 +01:00
Sebastian Rittau
517d2b6012 Remove unneeded ignores (#2624) 2018-11-23 09:51:44 -08:00
Manuel Vázquez Acosta
1297caa27b Make 'datetime' a subclass of 'date'. (#2488)
Fixes #2487.
2018-10-01 20:19:02 -07:00
kitsuyui
5cda4224fe Add type hint for fold arguments to datetime.datetime and datetime.time when Python >= 3.6 (#2449)
`datetime.datetime()` and `datetime.time()` have started to support fold arguments from 3.6.

- https://www.python.org/dev/peps/pep-0495/
- https://docs.python.org/3.5/library/datetime.html#datetime.datetime
- https://docs.python.org/3.6/library/datetime.html#datetime.datetime
- https://docs.python.org/3.5/library/datetime.html#datetime.time
- https://docs.python.org/3.6/library/datetime.html#datetime.time
2018-09-11 18:30:29 -07:00
Emil Hessman
50b5650a11 Add stub for datetime.time.fromisoformat introduced in 3.7 (#2426) 2018-09-04 16:35:56 +02:00
Sebastian Rittau
b209a649a0 Add date.fromisoformat() (#2393) 2018-08-17 08:50:10 -07:00
Dominik Gabi
14fb9df49c Fix annotation shadowed by forward reference of preoprty in datetime constructor. (#2337) 2018-07-20 17:21:32 -07:00
Jelle Zijlstra
bbbffb5f4b implement some minor 3.7 features (#1966)
References:
- https://docs.python.org/dev/library/datetime.html#datetime.datetime.fromisoformat
- https://docs.python.org/dev/library/crypt.html#crypt.mksalt
- https://docs.python.org/dev/library/contextlib.html#contextlib.AbstractAsyncContextManager
- https://docs.python.org/dev/library/calendar.html#calendar.HTMLCalendar.cssclasses
- https://docs.python.org/dev/library/binascii.html#binascii.b2a_uu

Part of #1965.
2018-03-22 08:01:09 -07:00
Kenny Do
156927d2a2 tzinfo.tzname is optional (#1934) 2018-02-28 19:14:12 -08:00
James M. Allen
33039f913e Adding py36 additions to datetime module (#1848) 2018-01-31 16:22:25 -08:00
Sebastian Rittau
7073bc0a49 Cleanup and merge datetime.pyi (#1805) 2018-01-09 22:06:31 +00:00