Commit Graph

4487 Commits

Author SHA1 Message Date
Jelle Zijlstra
e47eff31f7 bump various dependencies (#5551) 2021-05-29 20:05:09 +03:00
Sebastian Rittau
f562713939 Use protocols instead of IO for bz2 (#5499) 2021-05-29 09:01:43 -07:00
Shantanu
04fb7ceb3c builtins: add a getattr overload for bool (#5518)
As brought up in https://github.com/python/typeshed/pull/5516

Alternatives include:
- Use another type var that has a value restriction
- Doing something fancy with Protocols that have a __bool__ that returns
  a Literal (which may not work)
- Doing nothing
2021-05-29 07:09:38 -07:00
Pavel Karateev
af376f4d1f Add contextlib.AsyncContextDecorator (#5550) 2021-05-29 06:44:10 -07:00
Pavel Karateev
33ea648988 Add curses.has_extended_color_support() for Python 3.10 (#5549) 2021-05-28 18:50:36 +02:00
Sebastian Rittau
9795bae6f7 Remove mypy_test_suite (#5543)
Closes: #5540
2021-05-28 05:00:48 -07:00
Michael Lazar
dae5817f16 Fix BaseServer request and client_address types (#4992) 2021-05-28 13:26:39 +02:00
Maxime Arthaud
99a97195c4 mark fb303.fb303.FacebookService.Client as a context manager (#5542) 2021-05-28 12:08:34 +02:00
Sebastian Rittau
ca256b85b9 asyncio.Server.socket fixes (#5538)
* Move socket from AbstractServer to Server.
* Fix Server.socket type on Python 3.7+.
* Use Iterable instead of list for socket argument.

Closes: #5535
2021-05-27 16:14:36 +02:00
Pavel Karateev
038556cb7e Add codecs.unregister() for Python 3.10 (#5539) 2021-05-27 12:33:02 +02:00
Thomas Grainger
0a73982318 add asyncio.Task.get_coro return type (#5536) 2021-05-27 11:04:20 +02:00
Jelle Zijlstra
c4da3757d7 Improve tuple.__add__ type (#5522)
Noticed this while browsing the stub. This feels safe but we'll see what mypy-primer has to say.
2021-05-26 22:17:30 +02:00
Shantanu
74a8900166 mock: fix overloads (#5534)
* mock: fix overloads

Fixes #5533. This changes the order and in some cases removes default
values from new.

* ignore incompatible overlaps

Co-authored-by: hauntsaninja <>
2021-05-26 22:16:51 +02:00
scaramallion
af33b09bf6 Use __new__ for datetime.timedelta (#5532) 2021-05-26 11:05:26 +02:00
scaramallion
a32d24cae0 Use __new__ for datetime.time (#5530) 2021-05-26 11:00:37 +03:00
github-actions[bot]
9b2f158fdb Remove unused stubtest whitelist entries (#5531) 2021-05-25 21:43:12 -07:00
Akuli
55a2a180c6 tempfile._TemporaryFileWrapper enhancements (#5519) 2021-05-25 15:30:08 +02:00
Shantanu
4bfdba71cb dataclasses: update for py310 (#5525) 2021-05-25 14:43:06 +02:00
Shantanu
05f91f73b3 Re-enable mypy test suite (#5526)
Fixes #5505, in combination with https://github.com/python/mypy/pull/10527

Co-authored-by: hauntsaninja <>
2021-05-25 09:42:18 +01:00
Pavel Karateev
781b76769e Add sys.orig_argv for Python 3.10 (#5524) 2021-05-24 13:09:15 +02:00
Pavel Karateev
e7880085a2 Add sys.stdlib_module_names for Python 3.10 (#5523) 2021-05-23 15:25:32 +03:00
Akuli
fb5387e6e4 use comment-hider v0.3.0 (#5521) 2021-05-23 00:42:27 +02:00
Neil Vyas
8d56328a24 change getattr stubs to better type the default argument and return type (#5516)
Co-authored-by: Shantanu <12621235+hauntsaninja@users.noreply.github.com>
Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-05-21 16:44:11 -07:00
Andrey
dbaaa3a103 PEP 604: Add ror operator and modify isinstance and subclass (#5509)
Add operators or and ror for types.Union and ror to the type class.
Also, add modified isinstance and issubclass signatures to support old-style and new-style unions inside.
2021-05-21 16:30:27 -07:00
Jelle Zijlstra
c4e3fd92cc Adjust types for asyncio.coroutines functions (#5517)
Noticed this in mypy-primer output in #5516 on this code: https://github.com/encode/starlette/blob/master/starlette/testclient.py#L74

It calls `iscoroutinefunction()` on an object that may be None, which got flagged as an error but is actually fine; it just returns False.

We could also potentially use TypeGuard here, especially for `iscoroutine` which is just an `isinstance` call.
2021-05-21 23:07:06 +02:00
Jake Bailey
6d0b7889d3 Bump to pyright 1.1.142 (#5515) 2021-05-21 10:32:22 -07:00
Sebastian Rittau
acca3181ed Improve dict.fromkeys() with None value (#5514)
Closes: #5512
2021-05-21 20:30:33 +03:00
Jelle Zijlstra
19d6129624 Add __contains__ to gdbm.gnu (#5511)
Fixes #5510
2021-05-21 15:46:01 +02:00
Akuli
2628e77272 add _Pickler.dispatch and _Unpickler.dispatch (#5508) 2021-05-19 23:28:18 +03: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
2c7bae6901 Use only literal overloads for ZipFile.__init__() (#5504) 2021-05-19 20:54:03 +02:00
David Reiss
1547035a95 Add _Pickler and _Unpickler to stdlib/pickle (#5506)
These are the pure-Python pickle implementation, and are sometimes used
by code that wants to extend or override parts of the
pickling/unpickling process.
2021-05-19 20:57:07 +03:00
Sebastian Rittau
8d6314b8f3 mypy test suite is broken, disable temporarily (#5505) 2021-05-19 19:33:57 +03:00
Jukka Lehtosalo
e5459900c0 Make html, ipaddress, reprlib and winreg only available on Python 3 (#5502)
None of these are available in Python 2.7.
2021-05-19 12:16:10 +01:00
Jukka Lehtosalo
b08a2e6dea Fix Python 2 genericpath.commonprefix (#5500)
The more specific overload item should come first. Also
fix the return type.
2021-05-19 12:56:18 +02:00
Thomas Grainger
f1dd6cad52 name can be any object (#5494) 2021-05-19 11:03:07 +02:00
Sebastian Rittau
54a0bd80ee Add a comment about _typeshed to VERSIONS (#5447) 2021-05-19 11:01:33 +02:00
Sebastian Rittau
1ea3d0f003 tarfile improvements (#5492)
* Remove explicit Iterable super class
* Use Literals for mode parameters
* Import from collections.abc
* Use protocols for TarFile(fileobj=) and Tarfile.gzopen()
* Use object instead of Any as protocol return types
2021-05-19 10:13:35 +02:00
Jelle Zijlstra
620cf38152 pyaudio: don't use ClassVar[Final] (#5498) 2021-05-18 19:25:14 -07:00
Sebastian Rittau
de0c62ffeb zipfile: Replace an instance of IO with a protocol (#5471) 2021-05-18 18:42:59 -07:00
Jelle Zijlstra
bce19fc206 make GeneratorType inherit from Generator (#5474)
Fixes #5496
2021-05-18 13:31:14 -07:00
Akuli
90e8629ed8 Add comment hider back (#5495) 2021-05-18 21:51:24 +02:00
Rich Li
901dd52ec5 Add more redis stubs for sets (#5490) 2021-05-18 08:39:03 +02:00
Mahmoud Harmouch
7d4ecf7f0a Append some missing gdbm flags (#5489) 2021-05-17 19:33:29 -07: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
51b7248154 Try to fix mypy_primer comment permissions (#5478)
Split the workflows again so the comment workflow has write
access to the repository.

Based on https://securitylab.github.com/research/github-actions-preventing-pwn-requests/

Co-authored-by: Akuli <akuviljanen17@gmail.com>
2021-05-17 20:32:14 +02:00
Joseph Bylund
00fcc50d13 cachetools.Cache sizes are numerics (#5440)
replace int with float for cachesize
2021-05-17 19:14:26 +03:00
Jade
56ebf92463 Make _TemporaryFileWrapper generic on AnyStr, use it (#5456)
* Make _TemporaryFileWrapper generic on AnyStr, use it

Previously it was not used on NamedTemoraryFile and thus the file
field was missing from the types for the return value of
NamedTemoraryFile.
2021-05-17 19:04:40 +03:00
Frédéric Perrin
a0abacdeaf Fix decorator in retry module (#5482) 2021-05-17 12:31: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