Commit Graph

220 Commits

Author SHA1 Message Date
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
Avasam
23ac9bff19 Check for unused pyright: ignore and differentiate from mypy ignores (#9397) 2022-12-28 10:44:29 +00:00
Nikita Sobolev
ae58142e6e Fix typings of ExceptionGroup and BaseExceptionGroup (#9230)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: AlexWaygood <alex.waygood@gmail.com>
2022-11-22 20:46:03 -08:00
Nikita Sobolev
70c4af4b73 Refactor round and add tests (#9151)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-11-11 18:19:51 +00:00
Alex Waygood
068b0b488a Improve builtins.vars() (#9146) 2022-11-10 12:14:05 +01:00
Alex Waygood
739460291b Use recursive type aliases in builtins and _typeshed (#9134) 2022-11-08 17:04:09 +00:00
Jelle Zijlstra
c347c29417 builtins: improve bytes handling (#9027) 2022-10-30 17:32:07 -07:00
LeeeeT
cf9bdc2d98 Make the first argument of float.__new__ positional-only (#8991)
Closes #8990
2022-10-26 15:42:17 -07:00
Nikita Sobolev
5bbba5d008 Collection is Sized (#8977) 2022-10-25 06:08:28 -07:00
Jelle Zijlstra
1b04ef2673 bytes, bytearray constructors: support buffers (#8924) 2022-10-18 19:20:20 +01:00
Alex Waygood
78ca9c7390 Bump mypy to 0.982 (#8831) 2022-10-03 10:34:44 -07:00
Akuli
11a14f58a3 Delete builtins._StandardError (#8806) 2022-09-29 09:32:11 +01:00
Klas Eskilson
26ea6b8b4d Add __init__ definition for AttributeError (#8801)
Since Python 3.10, AttributeError supports keyword arguments for name
and obj.
2022-09-28 13:22:10 +01:00
Alex Waygood
48e76e8a56 Bump mypy to 0.981 (#8796) 2022-09-26 17:14:33 -07:00
Nikita Sobolev
6e985ef3de stdlib mapping classes: Use better names for various pos-only parameters (#8637) 2022-08-28 23:29:00 +01:00
GrozniyToaster
b6b8894964 Accept anything with __getitem__ in str.translate (#8629)
translate table protocol
2022-08-26 20:24:21 +03:00
Kevin Kirsche
b26c31a23c Update sys.exit and SystemExit.code to have the same types (#8554) 2022-08-20 10:59:38 +01:00
Alex Waygood
8a326dc9ec Remove NoReturn overloads from pow() (#8568) 2022-08-19 11:15:07 -07:00
Alex Waygood
a92da58328 Add @type_check_only to two fictional classes in builtins.pyi (#8531) 2022-08-11 11:55:07 +01:00
Nikita Sobolev
510feeb3fc Improve constructor for builtins.dict (#8517)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-08-10 19:04:07 +01:00
Nikita Sobolev
4e3e9ba2c6 Remove outdated TODO comment (#8508) 2022-08-09 09:55:45 +02:00
Nikita Sobolev
64bc0590a6 Remove un-needed __hash__ methods from stdlib (#8465) 2022-08-06 14:55:27 +01:00
Scott Lerman
93ebd58055 Fix complex constructor (#8473) 2022-08-03 00:41:18 +03:00
Akuli
3c90c97b9a List[Foo] + List[Bar] now returns List[Foo | Bar] (#8293)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
2022-07-15 20:20:50 +03:00
Alex Waygood
9645dae925 int.denominator, int.imag: More precise return types (#8266) 2022-07-14 11:25:05 +01:00
Jelle Zijlstra
2a7439e106 Revert "add overload to tuple.__new__ to better express an empty tuple" (#8278)
This reverts commit 64554bdd5d.

Also add a test case.
2022-07-12 12:29:37 -07:00
Sebastian Rittau
faae950ade Use error codes for type ignores (#8280)
Disable reportSelfClsParameterName for pytype as this is out of typeshed's
control

Closes: #7497
2022-07-12 20:15:49 +02:00
Alex Waygood
edc0ecd857 Remove Python 3.6 branches from typeshed (#8269) 2022-07-11 10:55:17 +02:00
David Brownman
64554bdd5d add overload to tuple.__new__ to better express an empty tuple (#7454)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-07-05 17:28:08 -07:00
Alex Waygood
e19073e871 Add a tiny bit more special-casing for sum (#8231) 2022-07-02 20:05:56 +01:00
Alex Waygood
1828ba2045 builtins.sum: Items in the iterable must support addition with int if no start value is given (#8000) 2022-06-13 11:25:38 +01:00
Jim Bosch
a2ba0c8a00 use __new__ instead of __init__ for frozenset (#8019) 2022-06-04 08:31:13 -07:00