Commit Graph

4509 Commits

Author SHA1 Message Date
jack1142
0209b6f95f random.choices: weights can be Fractions (#5587) 2021-06-06 21:39:31 -07:00
Akuli
4b66a9cd4e add types to tkinter invoke methods (#5582) 2021-06-06 20:32:30 +02:00
Akuli
68dbab81f4 More types for tkinter.Treeview (#5584) 2021-06-06 19:19:23 +02:00
Akuli
6159136006 finish types of tkinter.Menu (#5583) 2021-06-06 19:15:37 +02:00
Sebastian Rittau
746db19c3f Mark attrs stubs as obsolete (#5580) 2021-06-06 18:17:29 +03:00
Akuli
ecafd6fe47 add types to tkinter.filedialog.ask* (#5579) 2021-06-06 13:05:57 +02:00
bkurtz
18cbd23b01 Click parameter declarations work with any iterable (#5576) 2021-06-04 22:04:52 +02:00
谭九鼎
10889422df argparse#add_argument: make choices optional (#5574) 2021-06-04 10:20:22 +02:00
Rebecca Chen
a4075472d3 Add some submodule versions to stdlib/VERSIONS. (#5573)
Adds some version ranges for submodules that are available in different
versions that their parent modules.

I noticed these while updating pytype's pinned typeshed commit. pytype
can't actually use this submodule version information yet, but from what
I understand, all type checkers at least handle this information
gracefully (by ignoring it), so it doesn't hurt to add it.

* collections.abc is available in Python 3.3 and later. _collections_abc
  is imported by the collections.abc stub, so its version range is also
  changed from 3.6- to 3.3-.
* _typeshed.tkinter needs to be 3.0-, since it imports tkinter, which is
  marked as 3.0-.
* importlib.metadata is available in 3.8 and later.
2021-06-03 18:15:47 -07:00
MapleCCC
5804543c1c Add __all__ to __future__.pyi (#5570)
Closes #5569
2021-06-03 10:50:38 -07:00
Sebastian Rittau
7e1b8384a0 Return concrete server from abstract event loop (#5566)
https://docs.python.org/3/library/asyncio-eventloop.html?highlight=abstracteventloop#creating-network-servers
documents the methods as returning a concrete server object.
2021-06-03 07:03:45 -07:00
Pavel Karateev
f4c5ae01c4 Add importlib.metadata.packages_distributions() (#5565) 2021-06-01 20:07:18 +02:00
Aymeric Augustin
dd229f80be Support wrapping LoggerAdapter in LoggerAdapter (#5562)
Fixes #5561
2021-06-01 10:06:34 +02:00
github-actions[bot]
af068d6d3c Remove unused stubtest whitelist entries (#5563) 2021-05-31 22:30:19 -07:00
n0ob404
2a9f081abb Add annotations for some redis client methods (#5559)
Add annotation for move(), persist(), pexpire(), and expireat().
2021-05-31 22:01:11 +02:00
Pavel Karateev
ef15088d65 Add encoding & errors parameters to fileinput (#5558) 2021-05-31 19:24:53 +02:00
Sebastian Rittau
6ee67483a3 Rework socket (#5545)
* Extract _socket.pyi from socket.pyi.
* Extract _socket.socket from socket.socket.
* Fix socket.family annotation.
* Annotate SocketIO properly.
* SocketType is an alias of _socket.socket.
* Sort items in socket.pyi in the same order as in socket.py.
* Remove socket.EINTR.
* Use _typeshed.WriteableBuffer instead of custom alias.
* Add errorTab (Windows only).
* Add _socket.dup().
* Mark positional-only argments.
* Remove constructors from socket exceptions.
* socket.timeout is an alias for TimeoutError, starting with Python 3.10.
* Use PEP 604 in changed lines.
* Add alias for fileno arguments.
* getaddrinfo() port can be bytes.
* Explicitly override some SSLSocket methods.
* Allow ReadableBuffer in _CMSG arguments.
2021-05-30 20:17:33 +02:00
Pavel Karateev
ee4d9fb106 Expose curses.BUTTON5_* in Python 3.10 (#5556)
* Expose curses.BUTTON5_* in Python 3.10

* curses.BUTTON5_* aren't available on macOS
2021-05-30 16:58:31 +03:00
Ilya Konstantinov
2255a6fdc8 datetime: add timedelta.__bool__ (#5555) 2021-05-30 00:43:33 -07:00
Jelle Zijlstra
bfc83c365a Use PEP 604 in types.pyi (#5553) 2021-05-29 11:09:50 -07:00
Akshat
bb79dc9b51 markdown: Add missing attribute to Markdown stub. (#5544)
* markdown: Add missing attribute to Markdown stub.

* markdown: Add * to mark rest of arguments as keyword-only.

* markdown: Add **options
2021-05-29 20:40:07 +03:00
Jelle Zijlstra
b2e3c4f1d7 improve inspect.pyi (#5473)
- Use TypeGuard for various is* functions (refer to #5406)
- Use collections.abc and builtin containers
2021-05-29 19:32:39 +02:00
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