Commit Graph

57 Commits

Author SHA1 Message Date
Brian Schubert 622df68c1c Add @type_check_only to stub-only private classes in stdlib (#14512) 2025-08-03 10:13:16 +02:00
Max Muoto 0f3ff0874c Update functools for 3.14 (#14002) 2025-05-10 21:09:02 -07:00
Sebastian Rittau 30b16c168d Drop Python 3.8 branches (#13776) 2025-04-03 10:35:36 +02:00
Philipp A. 714c99bbdb Fix singledispatch register signature (#13578) 2025-03-04 14:52:07 +01:00
Victor Westerhuis bef43fc46e Relax functools.update_wrapper's parameter types (#13491) 2025-02-26 12:59:39 +01:00
Shantanu d9cf43c4c3 Mark pos-only __class_getitem__ args (#11970) 2024-05-18 23:27:51 +02:00
Shantanu 470a13ab09 Use PEP 570 syntax in stdlib (#11250) 2024-03-09 14:50:16 -08:00
Nikita Sobolev 863d22a239 Make return type of functools.cache_property covariant (#10053)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2024-02-17 15:38:46 -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
Rayan Sóstenes 9fbf2e1c0c Fix: functools.reduce does not accept keyword arguments (#11090) 2023-11-30 13:44:52 +00:00
Rebecca Chen f0a79939ae Fix typo in functools.pyi: _RWapper -> _RWrapper. (#10705) 2023-09-12 19:55:01 +01:00
Nikita Sobolev e347af1d59 Update functools.pyi for Python3.12 (#10269) 2023-06-06 22:48:36 +01:00
Nikita Sobolev 1d9f35369d functools: Add cache_parameters method to _lru_cache_wrapper (#10076)
The docs says that `cache_parameters()` function was added in 3.9: https://docs.python.org/3/library/functools.html#functools.lru_cache
Source: https://github.com/python/cpython/blob/af530469954e8ad49f1e071ef31c844b9bfda414/Lib/functools.py#L512
But, `typeshed` does not have it.
2023-04-24 07:29:54 -07:00
Nikita Sobolev 972958a406 functools.cached_property.__get__ returns Self (#9992)
Source code: https://github.com/python/cpython/blob/21e9de3bf0ecf32cd61296009518bfb9fdfcd04f/Lib/functools.py#L979-L980
2023-03-30 17:37:15 +01:00
Alex Waygood dd2818a41d Stdlib: add container default values (#9909) 2023-03-21 09:12:34 +01:00
Thomas M Kehrenberg d76259a062 Add __name__ to _Wrapped in functools (#9835) 2023-03-03 15:02:51 +00:00
Eric Traut 9c4bfd5d11 Updated functools.wraps and functools.update_wrapper (#6670)
Updated functools.wraps and functools.update_wrapper to use ParamSpec to preserve signatures of wrapped and wrapper functions.
2023-02-26 12:41:08 +01:00
Thomas M Kehrenberg 40d853cbe2 Add __set__ to functools.cached_property (#9762) 2023-02-20 12:36:45 +00:00
Andrew Svetlov 39fcd396ce lru_cache.cache_info().maxsize can be None for infinite cache size (#9763) 2023-02-19 16:50:19 +00:00
Alex Waygood 9ed39d8796 Use typing_extensions.Self in the stdlib (#9694) 2023-02-09 09:12:13 +00:00
Alex Waygood 53747b264e Stdlib: add 'obvious' default values (#9688) 2023-02-07 13:00:40 +01:00
Alex Waygood 8e7b78a8e8 Bump black to 23.1.0 (#9647) 2023-02-01 06:06:04 -08: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 e2ce7c6344 stdlib: audit more callback annotations (#8209) 2022-07-19 07:07:25 -07:00
Alex Waygood 1be5918baa Use _typeshed.IdentityFunction more consistently (#8063) 2022-06-12 16:56:14 -07:00
Alex Waygood e88a182573 Simplify __all__ definitions in modules beginning with 'a' to 'l' (#8026) 2022-06-07 15:40:48 +02:00
Alex Waygood b093c90a94 Use TypeAlias for type aliases where possible, part II (#7667) 2022-04-20 20:02:47 +01:00
Alex Waygood 97a74bc1aa Import from collections.abc wherever possible (#7635) 2022-04-18 12:50:37 +02:00
Alex Waygood 740193a8fc Use TypeAlias where possible for type aliases (#7630) 2022-04-15 18:01:00 -07:00
Alex Waygood bc72b25a2a Make more miscellaneous fields read-only, annotate _json.make_encoder (#7439) 2022-03-06 15:41:49 -08:00
Alex Waygood 2fe519c3a7 Add __all__ for modules beginning with 'e', 'f' and 'g' (#7325) 2022-02-20 15:08:14 -08:00
Alex Waygood 1091521f60 stdlib: Add several missing __(deep)copy__ methods (#7242) 2022-02-16 18:57:41 -08:00
Alex Waygood 96b06adf2c Add missing descriptor methods in dataclasses and functools (#7203) 2022-02-15 06:45:49 -08:00
Alex Waygood dea12b2c47 Add missing __isabstractmethods__ attributes in abc and `functools1 (#7205) 2022-02-14 11:20:07 -08:00
Shantanu b88a6f19cd Upgrade black version (#7089) 2022-01-30 16:27:06 -08:00
Nikita Sobolev f5db1ccbbd Use tuple of Literal types in functools.pyi (#6915) 2022-01-21 20:51:52 -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
Neil Girdhar 1b3d629bc5 Make self positional-only in functools.partial and partialmethod (#6822) 2022-01-07 19:19:13 +02:00
Neil Girdhar 9116b2928d functools: Add partial.__new__; remove partial.__init__ (#6813) 2022-01-04 23:48:34 +02:00
Alex Waygood 8d5d2520ac Use PEP 585 syntax wherever possible (#6717) 2021-12-28 11:31:43 +01:00
Alex Waygood 5670ca2f75 Add SupportsRichComparison type to _typeshed (#6583)
Use it to improve types of `max()` and other functions.

Also make some other tweaks to types related to comparison dunders.

Fixes #6575
2021-12-14 14:12:23 +00:00
Jukka Lehtosalo a7798f6060 Revert "lru_cache preserves signature of wrapped function (#6221)" (#6356)
This reverts commit 8bda66a737.

The change causes issues with ParamSpec implementations in type
checkers, at least pyright and my work-in-progress support for
ParamSpec in mypy. It's not yet clear how to fix the issues, so I
think that it's best to revert this, at least temporarily until we've
found a good solution. See #6347 for context.
2021-11-22 12:52:27 +01:00
Alex Waygood 5c8e68f0eb Use lowercase set, frozenset and deque where possible (#6346) 2021-11-19 15:05:45 -08:00
Alex Waygood 10c9d8cfce Add @final to many unsubclassable stdlib classes (#6299) 2021-11-15 14:45:24 +01:00
Tomaz-Vieira 8bda66a737 lru_cache preserves signature of wrapped function (#6221)
Update pytype for a fix to ParamSpec as argument to Generic
2021-11-03 10:08:52 +01:00
Bas van Beek b9e1d7d522 Replace Mapping with types.MappingProxyType (#6013)
Mark `Signature.parameters` and `.return_annotation` as read-only properties
2021-09-09 09:58:53 +02:00
Akuli ce11072dbe Big diff: use lower-case list and dict (#5888) 2021-08-08 09:26:35 -07:00