Commit Graph

50 Commits

Author SHA1 Message Date
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
Alex Waygood
cec4a85147 Improve stub for collections.deque (#6293) 2021-11-15 14:05:07 +01:00
Jelle Zijlstra
7c3c9d1a10 Remove workaround for _dict_values (#6250)
The mypy issue was fixed
2021-11-07 15:13:05 -08:00
Akuli
994b69ef8f Use lowercase tuple where possible (#6170) 2021-10-14 17:18:19 -07:00
Luciano Ramalho
b99ddc1f2f change chained maps to MutableMapping (#6044)
Fixes #6042
2021-09-28 21:18:50 -07:00
KotlinIsland
1b5c4e1d57 Add support for dict.{keys,values,items}.mapping (#6039)
Co-authored-by: KotlinIsland <kotlinisland@users.noreply.github.com>
2021-09-19 22:30:14 -07:00
Ruben Opdebeeck
e567af01e5 Fix collections.UserString __reversed__ and __iter__ (#5958) 2021-08-25 15:27:20 +03:00
jack1142
e415a7fad8 Make ChainMap's new_child() and parents return subclass (#5922) 2021-08-13 19:30:48 +02:00
Akuli
ce11072dbe Big diff: use lower-case list and dict (#5888) 2021-08-08 09:26:35 -07:00
Akuli
ee487304d7 Big diff: Use new "|" union syntax (#5872) 2021-08-08 11:05:21 +02:00
Fabian Raab
1a131a489e [UserList]: Return type for slice is set to whatever self is (#5722) 2021-07-02 21:20:17 +02:00
hatal175
d151d1b8bb Stubtest fixes (#5249) 2021-04-25 21:56:54 -07:00
Shantanu
fa9d5a5e9f future first: switch the order of some if statements (#5206)
Since we're adding this to our contribution guidelines in
https://github.com/python/typeshed/pull/5205
2021-04-11 06:44:18 -07:00
Eric Traut
82cb8c27df Fix conditional imports within collections (#5040)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-02-26 20:33:33 -08:00
Ivan Levkivskyi
16ae4c6120 Re-organize directory structure (#4971)
See discussion in #2491

Co-authored-by: Ivan Levkivskyi <ilevkivskyi@dropbox.com>
2021-01-27 12:00:39 +00:00