Commit Graph

44 Commits

Author SHA1 Message Date
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
Akuli
200260e685 move DndSource to tkinter/dnd.pyi (#5588) 2021-06-07 07:07:57 -07:00
Sebastian Rittau
21e647a184 Document _typeshed (#5501)
* Document _typeshed

Closes: #5486

* Allow README.md files
2021-05-19 22:15:21 +03:00
Sebastian Rittau
f0bf6eebbd AnyStr cleanup (#5487)
* Replace all uses of StrPath, BytesPath, and AnyPath in Python 2 stubs.
* Add StrOrBytesPath as preferred alias for AnyPath.
* Replace all remaining AnyPath instances with StrOrBytesPath.
* Mark AnyPath as obsolete.

Part of #5470
2021-05-17 20:45:48 +02:00
Sebastian Rittau
7a9a107a63 Move IdentityFunction to _typeshed (#5483)
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2021-05-17 12:04:35 +02:00
Sebastian Rittau
6a9c89e928 Replace 'Text' with 'str' in py3 stdlib (#5466) 2021-05-16 07:10:48 -07:00
Akuli
17dcea4a68 Akuli and srittau: Remove Python 2 branches from Python 3 stubs (#5461)
* run script and do some manual changes (Akuli)

* do the whole thing manually (srittau)

* merge changes (Akuli)

Co-authored-by: Sebastian Rittau <srittau@rittau.biz>
2021-05-15 15:33:39 +03:00
Sebastian Rittau
4ac3ccad45 black: enable skip_magic_trailing_comma (#5252)
* black: enable skip_magic_trailing_comma

* Remove spurious commas
2021-04-27 08:32:32 -07:00
Sebastian Rittau
4d734e38dd Add docutils definitions and (incomplete) modules (#5192) 2021-04-16 11:50:23 -07:00
Eric Traut
0ec182227c Added a few missing type arguments for generic types used in stdlib stubs
I just found and fixed a bug in pyright's "missing type arguments" check. When type arguments were omitted for a generic type within a subscript expression, the error was being suppressed. With this bug fixed, I found several new cases where type arguments were missing in stdlib stubs. (#5130)

Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-03-22 18:28:04 -07:00
Eric Traut
29c3d67626 Improved definition of divmod function in builtins (#5114)
Co-authored-by: Eric Traut <erictr@microsoft.com>
2021-03-15 11:10:09 +01: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