Commit Graph

61 Commits

Author SHA1 Message Date
Alex Waygood
0ef9c3f8e8 Enable flake8-pyi's Y037 (#9686) 2023-02-06 19:01:02 -08:00
Marc Mueller
88a761ed4e Export DataclassInstance protocol from _typeshed (#9676) 2023-02-04 15:58:11 +00:00
Avasam
41de5317b5 Add FileDescriptorOrPath and Unused type aliases (#9475) 2023-01-08 10:05:51 +00:00
Avasam
be1da49957 Suggestion: SliceableBuffer type alias (#9115)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2022-11-24 20:14:09 -08:00
Samuel T
796bdc2eb0 Improve accuracy of six byte index methods (#9117) 2022-11-09 19:22:33 -08:00
Alex Waygood
739460291b Use recursive type aliases in builtins and _typeshed (#9134) 2022-11-08 17:04:09 +00:00
Nikita Sobolev
a96cb58160 binhex: improve bytes handling (#9035) 2022-10-30 06:36:30 -07:00
Shantanu
2969922b68 Fix intransitive subtyping issue with SupportsGetItem (#8785)
See https://github.com/python/mypy/issues/13713 for details
2022-09-23 13:25:15 -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
Shantanu
1a8a49e671 wsgiref.types: use Iterator, not Iterable (#8358)
https://github.com/python/typeshed/issues/8356
2022-07-21 13:26:44 -07:00
Graham Bleaney
9519e3652b Add LiteralString support to string module (#8268)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-07-18 19:34:27 -07:00
Alex Waygood
208d8e1ec2 Fix assertAlmostEqual regression on mixed numeric types (#8137) 2022-06-27 08:57:36 +02:00
Alex Waygood
8b3b6bf7cd stdlib: Audit Callable[<parameters>, None] annotations (#8187) 2022-06-27 08:08:28 +02:00
Alex Waygood
538621e91b unittest.case: tighter annotations for various assertions (#8077) 2022-06-20 18:49:57 +02:00
Alex Waygood
5add91d6bb unittest: Improve self.assert(Not)AlmostEqual(s) (#8066) 2022-06-14 18:24:51 +03: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
Alex Waygood
ceccc655db Introduce _typeshed.GenericPath and _typeshed.AnyStr_co (#7970) 2022-05-27 19:02:00 +01:00
Graham Bleaney
cb5b31cf15 Add LiteralString overloads to path module (#7727)
Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
2022-05-25 08:52:52 -07:00
Sebastian Rittau
5df8de7693 Move a few protocol from builtins to _typeshed (#7736) 2022-04-28 17:36:47 +02:00
Jelle Zijlstra
2668cae090 Add PickleBuffer to _typeshed.WriteableBuffer (#7683)
Fixes #4362
2022-04-26 09:14:37 +02:00
Alex Waygood
97a74bc1aa Import from collections.abc wherever possible (#7635) 2022-04-18 12:50:37 +02:00
Sebastian Rittau
321359ca31 Add _typeshed.(Opt)ExcInfo (#7645) 2022-04-18 00:28:43 +01:00
Sebastian Rittau
499e74cf2a Add wsgiref.types (Python 3.11+) (#7644)
_typeshed.wsgi: Import from wsgiref.types in Python 3.11+

Make types match wsgiref.types
2022-04-16 21:36:31 +02:00
Alex Waygood
740193a8fc Use TypeAlias where possible for type aliases (#7630) 2022-04-15 18:01:00 -07:00
Sebastian Rittau
9687d53b65 Use explicit type aliases in _typeshed (#7534) 2022-03-30 11:06:07 +02:00
Alex Waygood
a3245db63c Remove unneeded # noqa comments, fix broken # noqa comments (#7561) 2022-03-28 23:17:44 +02:00
Sebastian Rittau
9a76b13127 Add _typeshed.Incomplete (#7535)
Closes: #5613
2022-03-25 10:18:09 +01:00
Alex Waygood
5c44ae4f8c Improve various signatures that shouldn't be async def, but currently are (#7491)
Co-authored-by: Thomas Grainger <tagrain@gmail.com>
2022-03-18 20:54:39 -07:00
Alex Waygood
3ab250eec8 Use PEP 604 syntax wherever possible (#7493) 2022-03-16 16:01:33 +01:00
Alex Waygood
584336a41e Fix several methods that should be async def, but aren't (#7107) 2022-02-02 15:18:14 +01:00
Alex Waygood
023e21dedf Delete SupportsAnyComparison type in _typeshed (#7098) 2022-02-01 14:32:20 +01:00
Sebastian Rittau
54fde0c2a1 Improve protocol return types (#7093)
* Dunder comparisons must return bool.
* write() return type should be ignored.
* Use custom comparison protocols in _operator.pyi
2022-02-01 08:59:07 +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
a40d79a4e6 Use lowercase type everywhere (#6853) 2022-01-08 16:09:29 +01:00
Alex Waygood
3112f0e525 _typeshed.structseq: Use Final instead of ClassVar (#6825) 2022-01-05 14:16:57 +02:00
Alex Waygood
8d5d2520ac Use PEP 585 syntax wherever possible (#6717) 2021-12-28 11:31:43 +01:00
Sebastian Rittau
0095536e6c Add some DB API 2.0 protocols and types (#6643)
Closes: #1037
2021-12-21 21:14:21 -08:00
Alex Waygood
0b75d71303 Add a structseq class to _typeshed (#6560)
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-12-17 13:42:09 -08:00
Stephen Rosen
df0a724c0f Always import Protocol from typing in stubs (#6617) 2021-12-17 13:12:22 +01: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
Sebastian Rittau
a6e369906d max() uses SupportsGreaterThanT (#6342)
Add SupportsGreaterThan and SupportsGreaterThanT

Closes: #6336

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2021-11-21 13:28:46 +01:00
Akuli
994b69ef8f Use lowercase tuple where possible (#6170) 2021-10-14 17:18:19 -07:00
Vincent Pelletier
4c0dccac0f Fold remaining custom stdlib *Buffer types into _typeshed. (#6082)
Add ctypes base type to WriteableBuffer.
Add a ReadOnlyBuffer type from fcntl.
Base ReadableBuffer on WriteableBuffer and ReadOnlyBuffer.
Use these types in fcntl and ctypes stubs.
2021-09-28 09:15:26 +02:00
Sebastian Rittau
b562d233ae (a)next only requires __(a)next__, not Iterator (#6036) 2021-09-14 11:43:21 +03:00
Bas van Beek
d599a535b2 Allow math.trunc to only accept __trunc__-supporting objects (#6003)
Add SupportsTrunc protocol
2021-09-04 18:16:53 +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
Bas van Beek
7c37d6117d Allow reversed to take any object implementing __len__ and __getitem__ (#5820)
`reversed` is currently annotated as accepting either a `Sequence` or objects implementing the `__reversed__` protocol.
This however is too strict as, per its [docs](https://docs.python.org/3/library/functions.html#reversed), it can take any object that implements `__len__` and `__getitem__`.
2021-07-29 07:48:14 -07:00
Sebastian Rittau
816a92b8e8 Add Self type var to _typeshed (#5677)
Cf. #5676
2021-06-22 22:15:27 +02:00
Sebastian Rittau
87e805bce6 Remove AnyPath (#5592)
Part of #5470
2021-06-09 00:25:01 +02:00