Commit Graph

64 Commits

Author SHA1 Message Date
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
Alex Waygood
b316dd947e Bump flake8-pyi to 23.1.1 (#9599) 2023-01-28 07:39:30 -08:00
Alex Waygood
d98d1674e7 Fix a few issues with parameter defaults (#9572) 2023-01-20 09:47:59 -08:00
Jelle Zijlstra
ddfaca3200 stdlib: add argument default values (#9501) 2023-01-18 09:37:34 +01:00
Avasam
23ac9bff19 Check for unused pyright: ignore and differentiate from mypy ignores (#9397) 2022-12-28 10:44:29 +00:00
Alex Waygood
9f05e9ff58 Improve classes returned from OrderedDict.{keys(), items(), values()} (#8552) 2022-08-20 22:21:39 +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
Alex Waygood
edc0ecd857 Remove Python 3.6 branches from typeshed (#8269) 2022-07-11 10:55:17 +02:00
Alex Waygood
e7a5b7a762 Fix various __all__-related errors and omissions (#8031) 2022-06-07 23:29:55 +01: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
Alex Waygood
073f9f416d Use PEP 585 syntax in collections (#7657) 2022-04-18 15:33:50 +01:00
Alex Waygood
4e87b9058f Improve collections.Counter stub (#7464) 2022-03-09 12:22:28 +02:00
Alex Waygood
f4ae363b56 stdlib: correct many pos-or-kw arg names in dunder methods (#7451) 2022-03-07 16:40:03 +01:00
Alex Waygood
46da0b87ea Add collections.ChainMap.__bool__ (#7391) 2022-02-27 16:02:01 -08:00
Shantanu
2279c87257 collections: fix some Counter nits (#7313) 2022-02-20 12:13:49 +02:00
Alex Waygood
cc1dd6d6ec Add collections.__all__ (#7296) 2022-02-19 12:26:23 -08:00
Alex Waygood
1091521f60 stdlib: Add several missing __(deep)copy__ methods (#7242) 2022-02-16 18:57:41 -08:00
Alex Waygood
fbc279e3f5 stdlib: Add many missing dunder overrides (#7231) 2022-02-16 06:25:47 -08:00
Alex Waygood
5e8a2a9364 Fix various pos-only stubtest complaints previously allowlisted (#7228) 2022-02-15 17:51:34 +01:00
Alex Waygood
11efe034bb collections: Add missing reflected BinOp methods (#7207)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-02-14 13:03:40 -08:00
Alex Waygood
66a229b709 stdlib: Add several missing comparison methods (#7202) 2022-02-14 11:09:52 -08:00
Alex Waygood
7f472e94e5 Improve collections.UserString (#7189) 2022-02-13 17:09:06 -08:00
Nikita Sobolev
6882e513c2 Improve Self type usage accross stdlib (#7183) 2022-02-13 12:21:01 +01:00
Alex Waygood
a62fd92fb0 Improve some in-place BinOp methods (#7149) 2022-02-06 15:36:57 -08:00
Shantanu
b88a6f19cd Upgrade black version (#7089) 2022-01-30 16:27:06 -08:00
Sebastian Rittau
6746e83f52 Counter/defaultdict: Key type 'str' if initialized with keywords (#7048) 2022-01-28 12:41:58 +02:00
Alex Waygood
2170693e11 Add various __*or__ methods, and improve dict.__ior__ (#6961) 2022-01-19 12:24:16 +01: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: 79ec7b2826/src/filelock/_api.py (L207)

* Improve `opentracing/scope` annotation

Source code here: 3e1d357a34/opentracing/scope.py (L71)

* Improve `redis/client` stub

Source code here: 15f315a496/redis/client.py (L1217)

* Improve `redis/lock` annotation

Source code here: 15f315a496/redis/lock.py (L155)

* Improve `requests/models` annotation

Source code here: d718e75383/requests/models.py (L653)
2022-01-09 19:16:19 -08:00
Alex Waygood
4e046163b5 Delete many redundant method redefinitions (#6877) 2022-01-09 11:21:03 -08:00
Alex Waygood
a40d79a4e6 Use lowercase type everywhere (#6853) 2022-01-08 16:09:29 +01:00
Akuli
a7886bfa55 Fix several typos in comments (#6830) 2022-01-05 18:44:34 +01:00
Alex Waygood
8d5d2520ac Use PEP 585 syntax wherever possible (#6717) 2021-12-28 11:31:43 +01:00
Alex Waygood
e6911530d4 collections: remove redundant method redefinitions (#6630) 2021-12-19 23:38:42 +01:00
Alex Waygood
12b79f64d7 Remove incorrect deque method overloads (#6628)
As the current comment in the source code states, these methods don't really take slices. It's surely better just to add `# type: ignore` comments, rather than have an incorrect stub.
2021-12-18 12:00:03 -08:00
Alex Waygood
4f7f30a8c4 Use SupportsKeysAndGetItem in most Mapping constructors (#6626) 2021-12-18 11:33:00 -08: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
Alex Waygood
f105c79219 Harmonise UserDict.__init__ with dict.__init__ (#6490)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-12-04 19:50:47 +02:00
Alex Waygood
9e0ee447c6 Harmonise UserDict.fromkeys with dict.fromkeys (#6488) 2021-12-04 13:56:30 +01:00
Alex Waygood
a293f1e73f Add OrderedDict.fromkeys (#6485) 2021-12-03 22:06:51 +02:00
Alex Waygood
a2e4a62fac Annotate UserList.sort() .index() arguments (#6472) 2021-12-02 17:44:21 +01:00
Alex Waygood
7b24e9d89a Improve UserList comparison methods (#6471)
These functions will fail at runtime if `other` is not either a `list` or a `UserList`. The elements within `other` must also be of the same type as the elements within `self`, or the comparison will fail.
2021-12-02 16:19:50 +01:00
Alex Waygood
98af7d667f Improve stubs for sequence types (#6386) 2021-11-26 19:09:38 -08:00
Alex Waygood
2dade8105a Add missing methods to collections classes (#6388)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-11-26 21:53:16 +02:00
Akuli
a5bc1e037f Add mypy error codes to '# type: ignore' comments (#6379) 2021-11-26 07:07:56 +01:00
Jelle Zijlstra
0d7064c357 Make Mapping/MutableMapping params positional-only (#5772)
These are positional-only on dict, so it makes sense to mark them as positional-only in these base classes too.

Fixes #5771
2021-11-18 07:54:58 +01:00
Alex Waygood
fbb89f9fd5 Fix isort w.r.t. _ast/_collections_abc/_tracemalloc/_warnings (#6329) 2021-11-17 08:29:44 -08:00
Alex Waygood
fd48026e64 Bring _collections_abc closer to runtime definition (#6312) 2021-11-16 09:41:22 -08:00
Alex Waygood
10c9d8cfce Add @final to many unsubclassable stdlib classes (#6299) 2021-11-15 14:45:24 +01:00
Alex Waygood
5b94c6a94d Improve stubs for collections.defaultdict (#6294) 2021-11-15 14:07:16 +01:00