Commit Graph

55 Commits

Author SHA1 Message Date
Jelle Zijlstra e8ba06f710 Add @disjoint_base decorator in the stdlib (#14599)
And fix some other new stubtest finds.
2025-08-24 07:27:14 -07:00
Semyon Moroz 14474afb85 [datetime] Add missing default values (#14452) 2025-07-26 05:40:35 +02:00
Max Muoto f90424014b Add strptime for datetime.time and datetime.date (3.14) (#13991) 2025-05-10 21:02:43 +02:00
Sebastian Rittau 30b16c168d Drop Python 3.8 branches (#13776) 2025-04-03 10:35:36 +02:00
Stephen Morton 17408ee538 fix the __init__ of several C-classes (#13211) 2024-12-23 10:55:51 -08:00
Stephen Morton 9614cc2d88 Fix some CAPI annotations (#13081) 2024-11-24 00:00:49 +00:00
Stephen Morton 2419d7520b Improve datetime._IsoCalendarDate (#13029) 2024-11-17 18:02:29 +00:00
Max Davidson 311f740889 more precise timezone-aware deprecation message (#12528) 2024-08-15 16:32:45 +02:00
Max Muoto 0df6028dc8 Use Final for Constant Literals in the stdlib (#12332)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-07-15 18:07:34 +01:00
funkyrailroad 76a42727ab Add datetime __replace__ methods on 3.13+ (#12014) 2024-05-23 11:56:09 -04:00
Shantanu 470a13ab09 Use PEP 570 syntax in stdlib (#11250) 2024-03-09 14:50:16 -08:00
Randolf Scholz 601587e71d changed overload order for date.__sub__ and datetime.__sub__ (#10999) 2024-02-19 13:11:29 +01:00
Jelle Zijlstra bba8cbd6f8 stdlib: more deprecations (#11009)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2024-02-18 06:50:29 -08:00
Sebastian Rittau 53a8193d64 Update typing_extensions imports in stdlib (#11244)
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2024-01-05 08:15:19 -08:00
Sebastian Rittau 23604858a6 Remove Python 3.7 branches (#11238) 2024-01-05 11:39:39 +01:00
Alex Waygood 03b4bb9cce Stdlib: add many missing __hash__ and __eq__ methods (#10464) 2023-07-17 14:21:02 +02:00
Alex Waygood 81b8211d0e Revert "Remove un-needed __hash__ methods from stdlib (#8465)" (#10426)
Reverts https://github.com/python/typeshed/pull/8465
Fixes https://github.com/python/typeshed/issues/10424
Closes https://github.com/python/typeshed/pull/10425

https://github.com/python/typeshed/pull/8465 caused regressions: see https://github.com/python/typeshed/issues/10424 and https://github.com/python/mypy/issues/13800. Since it didn't fix any known problems (just some stylistic nits that we had), let's just revert the PR.
2023-07-09 08:43:32 -07:00
Nikita Sobolev 130ba2ea60 Support SupportsIndex in constructors for all datetime objects (#9915)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2023-03-21 19:56:31 +03:00
Alex Waygood 257e287fec Stdlib: correct many parameter names (#9815) 2023-03-04 09:53:12 +00:00
PythonCoderAS 52cf716831 Make datetime classmethods return correct type (#9706) 2023-02-10 15:53:17 +00:00
Alex Waygood 9ed39d8796 Use typing_extensions.Self in the stdlib (#9694) 2023-02-09 09:12:13 +00:00
Alex Waygood 33a62ae42d Add more defaults to the stdlib (#9606)
Continuing work towards #8988.

The first five commits were created using stubdefaulter on various Python versions; the following commits were all created manually by me to fix various problems. The main things this adds that weren't present in #9501 are:

- Defaults in Windows-only modules and Windows-only branches (because I'm running a Windows machine)
- Defaults in non-py311 branches
- Defaults for float parameters
- Defaults for overloads
2023-01-29 01:51:23 +00:00
Jelle Zijlstra ddfaca3200 stdlib: add argument default values (#9501) 2023-01-18 09:37:34 +01:00
Alex Waygood 116229d0ac datetime: various parameters can now safely be passed as keyword arguments on 3.12+ (#9415) 2022-12-27 14:35:29 +00:00
Alex Waygood 8b9b96c9f8 datetime.timedelta: Remove explicit inheritance from SupportsAbs (#8972)
Fixes #8971
2022-10-23 15:28:44 -07:00
Nikita Sobolev e6682a5fa7 Remove ABCMeta from tzinfo (#8910) 2022-10-17 09:12:52 +01:00
Nikita Sobolev 9c5a588078 datetime.tzinfo is abstract (#8908) 2022-10-16 16:20:31 -07:00
Nikita Sobolev 0259068ad6 Remove duplicate definitions in sub-classes (#8594) 2022-08-26 17:10:55 +02:00
Nikita Sobolev 64bc0590a6 Remove un-needed __hash__ methods from stdlib (#8465) 2022-08-06 14:55:27 +01:00
Alex Waygood edc0ecd857 Remove Python 3.6 branches from typeshed (#8269) 2022-07-11 10:55:17 +02:00
Alex Waygood fbddd2c4e2 stdlib: enforce CamelCase for type alias names (#8255) 2022-07-07 17:45:23 +02:00
Sam Ezeh caaf0f1bf2 datetime: add UTC alias (#7779) 2022-05-04 00:00:08 -07:00
Alex Waygood b093c90a94 Use TypeAlias for type aliases where possible, part II (#7667) 2022-04-20 20:02:47 +01:00
Sebastian Rittau ef819f3910 Remove pre-Python 3.6 branches from datetime.pyi (#7602) 2022-04-07 11:33:45 +02:00
Marko Zagožen 8ae678129e Use Self return type for the 'replace()' methods in datetime classes (#7595) 2022-04-05 22:20:31 +02:00
Alex Waygood e9db3bd50a Add __all__ for modules beginning with 'c' and 'd' (#7303) 2022-02-19 17:51:27 -08:00
Shantanu b88a6f19cd Upgrade black version (#7089) 2022-01-30 16:27:06 -08:00
Nikita Sobolev d108c19675 Use Literal type in datetime (#6899) 2022-01-12 08:12:23 -08:00
Alex Waygood 96c9abb058 Always use _typeshed.Self, where applicable (#6880)
* Always use `_typeshed.Self`, where applicable

* Revert changes to `google-cloud-ndb` (ambiguous)

* Remove empty line added by script

* Revert changes to `stubs/python-dateutil/dateutil/relativedelta.pyi`

* Manually add a few more that the script missed

* Improve `filelock` annotation

Source code here: https://github.com/tox-dev/py-filelock/blob/79ec7b2826e33b982fe83b057f359448b9d966ba/src/filelock/_api.py#L207

* Improve `opentracing/scope` annotation

Source code here: https://github.com/opentracing/opentracing-python/blob/3e1d357a348269ef54d67f761302fab93dbfc0f7/opentracing/scope.py#L71

* Improve `redis/client` stub

Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/client.py#L1217

* Improve `redis/lock` annotation

Source code here: https://github.com/redis/redis-py/blob/15f315a496c3267c8cbcc6d6d9c6005ea4d4a4d5/redis/lock.py#L155

* Improve `requests/models` annotation

Source code here: https://github.com/psf/requests/blob/d718e753834b84018014a23d663369ac27d1ab9c/requests/models.py#L653
2022-01-09 19:16:19 -08:00
Alex Waygood a40d79a4e6 Use lowercase type everywhere (#6853) 2022-01-08 16:09:29 +01:00
László Károlyi 7e22a9e34a Fix datetime.strftime (#6317)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2021-11-30 23:19:30 -08:00
Akuli a5bc1e037f Add mypy error codes to '# type: ignore' comments (#6379) 2021-11-26 07:07:56 +01:00
Alex Waygood 916ca06885 Correct positional-only parameters in datetime.pyi (#6343)
These are all positional-or-keyword parameters in the pure-Python implementation, but positional-only parameters in the C implementation. Thus, passing them as keyword arguments is unreliable, and will result in errors being raised in some situations.
2021-11-19 07:10:18 -08:00
Alex Waygood f6702e3871 Improve __sub__ and __add__ for datetime and date (#6323) 2021-11-17 21:37:41 -08:00
Alex Waygood 7598396a6d Simplify stub for datetime.datetime (#6320) 2021-11-16 19:03:46 +01:00
Alex Waygood 10c9d8cfce Add @final to many unsubclassable stdlib classes (#6299) 2021-11-15 14:45:24 +01:00
Akuli 994b69ef8f Use lowercase tuple where possible (#6170) 2021-10-14 17:18:19 -07:00
Akuli ee487304d7 Big diff: Use new "|" union syntax (#5872) 2021-08-08 11:05:21 +02:00
Ilya Konstantinov 2255a6fdc8 datetime: add timedelta.__bool__ (#5555) 2021-05-30 00:43:33 -07:00
scaramallion af33b09bf6 Use __new__ for datetime.timedelta (#5532) 2021-05-26 11:05:26 +02:00