Commit Graph

251 Commits

Author SHA1 Message Date
Simon Lanzmich fe48f37bf7 stdlib: Annotate type.__prepare__ to return a mutable object (#11093)
During class creation, the namespace returned by `__prepare__` is
populated when the class body is executed. Therefore, it must be
mutable.
2023-12-03 22:46:33 +00:00
Alex Waygood 10febc4fe0 stdlib: remove unused type: ignore comments (#11061) 2023-11-23 14:00:07 +01:00
Jelle Zijlstra c2c8d7cf5d stdlib: Apply some simple deprecations (#11044) 2023-11-23 09:03:01 +01:00
Xuehai Pan aa15fafc33 stdlib: builtins.type.__base__ can be None (#11040) 2023-11-18 14:03:56 +00:00
Jelle Zijlstra 4deef7550f stdlib: Fix more signatures with unrepresentable defaults (#11007) 2023-11-09 18:20:09 -08:00
Jelle Zijlstra d9311f946e stdlib: fix signatures for some functions with unrepresentable defaults (#11000)
Found with python/mypy#16433

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-11-09 08:14:36 -08:00
Sebastian Rittau a5c1a4cd3f Introduce _typeshed.SupportsFlush (#10983) 2023-11-06 15:31:02 +01:00
Alex Waygood a08d4c8d2e Remove many redundant inheritances from Generic[] (#10933) 2023-10-26 20:07:20 +02:00
Nikita Sobolev 5c775a3502 Improve int.__pow__ and float.__pow__ comments (#10925)
It used to be `__x`. Now, it is not clear what `x` is in this context.
2023-10-25 10:15:34 +01:00
plokmijnuhby cec86eb22e Replace __init__ with __new__ in builtins and types (#10761) 2023-09-25 14:12:23 +02:00
plokmijnuhby 41bfc12065 Add a case where zip() can be called with no arguments (#10648) 2023-09-22 20:00:08 -07:00
Ali Hamdan 2b323bed50 Add typeshed aliases to the types accepted by int and float constructors (#10707)
Ref https://github.com/python/typeshed/pull/10630#discussion_r1321646168
2023-09-22 19:50:43 -07:00
Randolf Scholz 6bf23949b5 types.EllipsisType was added in Python 3.10 (#10719) 2023-09-17 00:50:33 +02:00
Alex Waygood 6eec191739 Improve the accuracy of (default)dict.__(r)or__ (#10679) 2023-09-08 11:22:17 +01:00
Eugene Toder e86c61da86 More precise overloads for get/pop methods (#10501)
Fixes #10293

Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2023-07-26 16:37:32 +01:00
Alex Waygood 1088ab3d93 Improve stubs for classmethod and staticmethod (#10421) 2023-07-19 13:32:04 +02:00
Alex Waygood 03b4bb9cce Stdlib: add many missing __hash__ and __eq__ methods (#10464) 2023-07-17 14:21:02 +02:00
Eugene Toder cfc5425cb3 Add defaultdict.__(r)or__; improve ChainMap.__(r)or__ and UserDict.__(r)or__ (#10427)
Add __or__ to defaultdict

Also, add overloads with Self type to other __[r]or__ methods.
2023-07-11 19:39:12 +01: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
Alex Waygood 1b2e4091db Bump mypy to 1.4.1 (#10351) 2023-06-25 16:45:09 -07:00
Shantanu 7df870f452 Run stubtest for Python 3.12 (#10253) 2023-06-04 05:53:03 -07:00
Shantanu be85cc7121 builtins: updates for py312 (#10211)
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2023-06-04 01:05:40 +01:00
Shantanu d6a85e2c48 Attempt to clarify the ByteString situation (#9783)
See https://github.com/python/cpython/issues/102092

This makes the behaviour of typing.ByteString better match its
documentation.
2023-05-27 21:37:38 -07:00
Jelle Zijlstra c0a0c34020 Use PEP 688 (#10225)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2023-05-27 19:55:30 -07:00
Christian Bundy b4ad214754 Add object.__getstate__() in Python 3.11+ (#10091) 2023-04-27 05:05:54 -07:00
Akuli 03b8c60a02 Support dict(foo.split() for foo in bar) with bytes (#10072) 2023-04-22 18:28:34 +03:00
Alex Waygood dd2818a41d Stdlib: add container default values (#9909) 2023-03-21 09:12:34 +01:00
Alex Waygood 28dd6c1a2e Use ParamSpec for classmethod and staticmethod (#9771) 2023-03-14 09:59:17 +00:00
Alex Waygood 257e287fec Stdlib: correct many parameter names (#9815) 2023-03-04 09:53:12 +00:00
Alex Waygood 6ba28ae547 Remove unused type: ignore comments (#9801) 2023-02-23 12:59:50 -08:00
Neil Girdhar 06755e10ba Add object.__subclasshook__ (#9755) 2023-02-22 23:08:25 +00:00
Alex Waygood 4273a83bb7 unittest: Use a recursive type alias for assertIsInstance (#9770) 2023-02-20 15:35:50 +00:00
Alex Waygood c5b5dd4bf4 Various stdlib dunders: correct parameter names; improve types; add defaults (#9761)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2023-02-19 22:44:20 +00:00
Shantanu 5c54e52e23 Fix default value of input, remove now unused allowlist entry for epoll (#9742) 2023-02-17 01:55:31 +02: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 1e3d762a12 stdlib: use bool for annotations where the default is False (#9672) 2023-02-04 11:58:18 +00:00
Alex Waygood 100cd62373 stdlib: Add bytes defaults (#9660) 2023-02-02 16:01:54 -08:00
Alex Waygood 1d7dda7fa1 stdlib: Add defaults for positional-only parameters (#9655) 2023-02-01 21:44:08 +00:00
Alex Waygood 8000fbd386 Bump various test dependencies (#9646) 2023-02-01 06:23:40 -08:00
Alex Waygood a6919227be Add several version-dependent default values to parameters in the stdlib (#9631) 2023-01-31 01:21:39 +00:00
Alex Waygood 9099403d58 builtins.pow: Add default values to <py38 branches; remove incorrect = ...s for the 13th overload (#9610) 2023-01-30 18:12:50 +01:00
Alex Waygood dd3aedd133 Correct str.maketrans and collections.UserString.maketrans (#9611) 2023-01-29 11:45:08 -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 af2ce282d5 builtins: do the TODO on compile() (#9567) 2023-01-18 11:48:48 -08:00
Jelle Zijlstra ddfaca3200 stdlib: add argument default values (#9501) 2023-01-18 09:37:34 +01:00
Avasam c70d303985 Audit stdlib object annotations (#9519) 2023-01-17 15:40:00 +00:00
Alex Waygood 597e1a0078 Bump various test dependencies (#9549) 2023-01-16 11:04:45 -08:00
Avasam aad1a14890 Use the FileDescriptorOrPath alias consistently in the stdlib (#9513) 2023-01-12 18:14:48 +00:00
Nikita Sobolev 6f6dad117d compile can only work with ast.Module | ast.Expression | ast.Interactive (#9424) 2022-12-29 11:25:07 +01:00