Commit Graph

195 Commits

Author SHA1 Message Date
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
Graham Bleaney
8c434e05d6 Add PEP 675 LiteralString overloads to str class (#7725)
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-05-31 21:09:34 -07:00
pranavrajpal
8f33ff9e9d Add __setstate__ for BaseException (#7987) 2022-05-30 11:33:55 +02:00
Alex Waygood
d4eba8b5ce builtins.sum: Add overload for bool special case (#7975)
Closes #7974
2022-05-28 11:14:10 -07:00
Alex Waygood
ceccc655db Introduce _typeshed.GenericPath and _typeshed.AnyStr_co (#7970) 2022-05-27 19:02:00 +01:00
Alex Waygood
d511312e21 multiprocessing.managers: fix TypeVar usage (#7938)
#7928

`dict()` and `list()` just return empty dictionaries and lists (respectively) if no arguments are supplied:

```python
>>> from multiprocessing.managers import SyncManager
>>> with SyncManager() as s:
...     print(s.dict())
...
{}
```
2022-05-26 07:18:43 -07:00
Jelle Zijlstra
d5bc48d29b builtins, collections: Fix unconstrained overloads for container constructors (#7944)
See https://github.com/microsoft/pyright/issues/3501#issuecomment-1135979479

Related to #7928
2022-05-25 10:07:23 +01:00
Jelle Zijlstra
bd394d2486 builtins: add BaseException.add_note in py311 (#7860) 2022-05-17 20:32:28 -07:00
Shantanu
a27f15ef0e builtins: reorder overloads (#7828)
This is slightly more friendly for --no-strict-optional (gross)
2022-05-11 01:00:52 -07:00
Shantanu
032787d867 builtins: accept old-style iterables to iter (#7817) 2022-05-10 09:06:31 +02:00
Jelle Zijlstra
c93f262427 Add closure argument to exec() (#7793)
python/cpython#92204
2022-05-06 22:46:01 -07:00
Alex Waygood
c3ebc7e307 More improvements to pow stubs (#7737) 2022-04-28 10:49:29 -06:00
Sebastian Rittau
5df8de7693 Move a few protocol from builtins to _typeshed (#7736) 2022-04-28 17:36:47 +02:00
Alex Waygood
7cbb579a44 Make __wrapped__ read-only on classmethods and staticmethods (#7694) 2022-04-25 22:27:06 -06:00
Alex Waygood
617d2aaf57 Fix crash when running mypy master against typeshed master (#7660) 2022-04-18 17:20:49 +01:00
Alex Waygood
54af68c789 Add a few # noqas to unblock PyCQA/flake8-pyi#213 (#7658) 2022-04-18 17:57:48 +02:00
Alex Waygood
97a74bc1aa Import from collections.abc wherever possible (#7635) 2022-04-18 12:50:37 +02:00
Alex Waygood
7ce4607dee Upgrade flake8-pyi to 22.4.0, enable Y026 in .flake8 config (#7650) 2022-04-17 01:23:35 +01:00
Shantanu
520f807b5f builtins: default values for int.(to|from)_bytes in py311 (#7647)
See https://github.com/python/cpython/issues/89318
2022-04-17 00:57:13 +01:00
Shantanu
c93f92d92e builtins: add BaseExceptionGroup.__class_getitem__ (#7648) 2022-04-17 00:48:46 +01:00
Jelle Zijlstra
ee09d9eb19 builtins: Audit bytes arguments (#7631)
Most use the C buffer protocol, so _typeshed.ReadableBuffer is the right type. A few
check specifically for bytes and bytearray.
2022-04-16 14:16:11 +02:00
Alex Waygood
740193a8fc Use TypeAlias where possible for type aliases (#7630) 2022-04-15 18:01:00 -07:00
Jelle Zijlstra
e0654bdbc0 ExceptionGroup: make it generic (#7626) 2022-04-15 16:24:17 +02:00
Joe Young
d45c9084a4 Catch more potential type errors in builtins.sum (#7578)
Use a ` TypeVar` bound to a `Protocol` defining `__add__`
2022-04-01 23:19:05 +01:00
Alex Waygood
a3245db63c Remove unneeded # noqa comments, fix broken # noqa comments (#7561) 2022-03-28 23:17:44 +02:00
Alex Waygood
b63c963077 Use conditional overloads to simplify several stdlib functions (#7540) 2022-03-25 08:47:03 +01:00