Commit Graph

280 Commits

Author SHA1 Message Date
Philipp Hahn
2b3aa94fb5 paramiko - A Python implementation of SSHv2 (#4770)
* paramiko - A Python implementation of SSHv2

Code: <https://github.com/paramiko/paramiko>
Doc: <http://docs.paramiko.org/en/stable/index.html>
2020-11-30 11:15:21 +01:00
Nipunn Koorapati
9af49c0b69 Protobuf stubs update using mypy-protobuf (#4785)
* Add script to generate protoc stubs using mypy-protobuf generated stubs

* Use generate_proto_stubs to generate stubs for protobuf 3.14.0

* Skip _pb2.pyi from flake8,black,isort,pytype
2020-11-25 10:48:26 -08:00
Philipp Hahn
d4bd95fd86 Fix hard-coded pytype version (#4771)
[tests/pytype_test.py](./tests/pytype_test.py#L176) is still using
Python `3.6`:
> python_version="2.7" if version == 2 else "3.6",

The test fails to run if `python3.6` is unavailable (for example on
Debian 10 Buster, which has 3.7).

According to (https://devguide.python.org/#status-of-python-branches
`3.6` is still maintained until end of 2021.

`pytype` itself [claims](https://github.com/google/pytype#requirements)
to run on `2.7`, `3.5`-`3.8`.

Change the script to use the version of Python from the invoking
interpreter.
2020-11-16 11:08:42 -08:00
Ran Benita
27a45df479 threading: fix ExceptHookArgs being a function instead of a type (#4768)
The previous typing meant `threading.ExceptHookArgs` could not be used
to type a value.

The new typing follows what cpython does in the happy path (`_thread`
exists rather than the pure-python fallback being used).

Fixes #4767.
2020-11-14 14:50:34 +01:00
github-actions[bot]
ee945af14d Remove unused stubtest whitelist entries (#4748)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-11-06 22:05:08 -08:00
Sebastian Rittau
d2a7889fe0 Drop support for Python 3.5 (#4675)
Python 3.5 EOL was on 2020-09-30.
2020-11-02 16:18:20 +01:00
Shantanu
65603f829f xxlimited: add stubs (#4736) 2020-11-01 12:54:17 -08:00
Shantanu
620989bac5 typeshed: update stubtest version (#4739)
* typeshed: update stubtest version

Includes changes from https://github.com/python/mypy/pull/9680
I've already fixed all the true positives on typeshed.

* attempt to fix windows' _WarnFunction

Co-authored-by: hauntsaninja <>
2020-11-01 12:35:21 +01:00
Jason Fried
f5a536b505 ContextVar.get() default has wrong type, it should mirror Mapping.get (#4726) 2020-10-29 13:40:55 -07:00
Shantanu
96d7d77a04 mypy_test_suite: run a subset of tests (#4723)
Only a subset of mypy's test suite should be relevant to typeshed:
https://github.com/python/mypy/pull/9638
This should make things faster.
(Also the -n12 argument to pytest is weird; note mypy's pytest.ini
automatically specificies -nauto which is what we should want)

Resolves https://github.com/python/typeshed/issues/4333

Co-authored-by: hauntsaninja <>
2020-10-28 08:44:19 +01:00
Shantanu
8d4a4f9e74 mypy_selftest: rename to mypy_self_check (#4712)
This better disambiguates it from mypy_test_suite and is more inline
with how mypy refers to it internally.

Co-authored-by: hauntsaninja <>
2020-10-25 21:31:43 +01:00
Shantanu
48970d31de tests / scripts: blacken and isort (#4704)
I often run black and isort in typeshed root and then have to undo these
changes.

Co-authored-by: hauntsaninja <>
2020-10-25 11:21:03 +01:00
Shantanu
2f1367332b stubtest unused: match stubtest version, add fix (#4705)
In #4696 I bumped stubtest to a commit that hasn't been released. We
should have these stubtest versions match. In
https://github.com/python/mypy/pull/9426 I changed the output of
stubtest here; it's good to get this change in before I forget and this
action silently stops working.

Co-authored-by: hauntsaninja <>
2020-10-25 11:19:15 +01:00
Sebastian Rittau
0583738a41 Add a mypy self test (#4337)
Co-authored-by: Shantanu <hauntsaninja@users.noreply.github.com>
Co-authored-by: hauntsaninja <>
2020-10-24 17:58:04 -07:00
github-actions[bot]
3df3f6a1bc Remove unused stubtest whitelist entries (#4701)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-10-23 23:00:48 -07:00
Sebastian Rittau
5927e5ca30 Remove most consistency checks and split builtins.pyi into py2/3 files (#4686)
Split builtins.pyi in Python 2 and 3 versions

Partly addresses #4674
2020-10-22 13:39:06 -07:00
Shantanu
74bb849789 update stubtest (#4696)
Co-authored-by: hauntsaninja <>
2020-10-22 11:09:39 -07:00
github-actions[bot]
8a8ed3531e Remove unused stubtest whitelist entries (#4643)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-10-09 21:25:20 -07:00
Shantanu
723a23abfc contextlib: get rid of a TODO (#4610)
This dates back three years to https://github.com/python/typeshed/pull/1249

It seems pretty unused in practice, so I think this is fine:
https://grep.app/search?q=from%20contextlib%20import%20ContextManager&case=true
https://grep.app/search?q=contextlib.ContextManager&case=true

Co-authored-by: hauntsaninja <>
2020-10-04 23:49:49 +02:00
Shantanu
e0a3644850 py39.txt: remove no longer needed comment (#4603)
See #4598

Co-authored-by: hauntsaninja <>
2020-10-03 13:56:56 -07:00
Shantanu
76cd654987 stubtest whitelist: fix (#4599)
This should take care of #4598

Co-authored-by: hauntsaninja <>
2020-10-02 21:38:59 -07:00
github-actions[bot]
86b2aaf6ee Remove unused stubtest whitelist entries (#4598)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-10-02 21:27:08 -07:00
Sebastian Rittau
27dfbf68aa Use __new__ instead of __init__ for some builtin classes (#4555)
Closes #4514 #2630 #2686
2020-09-30 00:00:06 -07:00
Shantanu
b33896bcbc asyncio.run: fix type of debug (#4567) 2020-09-22 10:43:35 +02:00
github-actions[bot]
4876b55382 Remove unused stubtest whitelist entries (#4560)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-09-19 11:32:32 +02:00
Rebecca Chen
9dbe7f348f Update pytype to a version that can parse six. (#4546) 2020-09-17 05:46:27 +02:00
github-actions[bot]
0f69275ce4 Remove unused stubtest whitelist entries (#4534)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-09-11 21:48:34 -07:00
Shantanu
2330083732 stubtest: fix whitelists (#4513)
Downstream of the reintroduction of py39 to CI / running the unused whitelist entry flow in #4512

Co-authored-by: hauntsaninja <>
2020-09-05 01:10:52 -07:00
github-actions[bot]
6f475bfc35 Remove unused stubtest whitelist entries (#4512)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-09-05 00:49:31 -07:00
Shantanu
ccfc1850e9 platform: update for py39 (#4506)
platform.DEVNULL seemed undocumented, but is eg, still mentioned in the
header comment of platform.py. So feels surprising this was removed
without much warning.

Co-authored-by: hauntsaninja <>
2020-08-31 15:28:37 -07:00
Shantanu
5884ee2977 inspect: minor improvements (#4499)
Co-authored-by: hauntsaninja <>
2020-08-31 14:23:01 -07:00
Shantanu
c8c62b32ac socket: fix platform availability (#4507)
also fix another CI merge race issue

Co-authored-by: hauntsaninja <>
2020-08-31 14:20:46 -07:00
Shantanu
e9becf1da6 py39: enable in CI (#4494)
Github Actions now supports prerelease builds
https://github.com/actions/setup-python/issues/20

Co-authored-by: hauntsaninja <>
2020-08-31 22:05:57 +02:00
Shantanu
fdd01b0036 os._AddedDllDirectory: add __init__ (#4498) 2020-08-31 11:52:28 +02:00
github-actions[bot]
4795ab21ca Remove unused stubtest whitelist entries (#4497) 2020-08-30 12:51:30 -07:00
Rebecca Chen
2587c93ff8 Stop passing python_exe to pytype_test. (#4488)
pytype hasn't needed the python_exe argument for a while, and getting
rid of it allows some code to be deleted.
2020-08-27 19:19:49 -07:00
Rebecca Chen
61537be530 Upgrade the pytype version to one that can parse the tkinter stubs. (#4456)
The latest pytype release fixes two pyi parser bugs that allow files
affected by them to be taken off the pytype exclude list. I removed two
`total=False` declarations in tkinter/__init__ that pytype does not like
(because it checks that `total` is present only when TypedDict is a
class's immediate parent) and which shouldn't be needed because
_InMiscNonTotal already specifies totality. I double-checked that mypy
reports no errors in 3.7 on a .py file containing:

  from typing_extensions import TypedDict
  Foo = TypedDict('Foo', {'x': int}, total=False)
  class Bar(Foo): pass
  x: Foo = {}

showing that it doesn't require `total` to be repeated.
2020-08-17 19:49:58 -07:00
Shantanu
f23ce60668 stubtest: fix on windows (#4455)
Co-authored-by: Akuli
2020-08-17 14:55:58 -07:00
Akuli
e9ecea0033 Add options to tkinter widgets (#4363)
In tkinter, `widget['foo'] = bar` and `widget.config(foo=bar)` do the same thing, but they will now type-check differently: the `widget['foo'] = bar` syntax allows 'foo' to be any string (e.g. a variable, not necessarily a Literal) and bar to be any object, while `widget.config(foo=bar)` checks the existence of the option and the type of bar. Similarly, cget takes a Literal argument but __getitem__ takes a string. 

Testing script can still be found at c42a72c53e
2020-08-17 13:59:51 -07:00
github-actions[bot]
17db12866b Remove unused stubtest whitelist entries (#4420)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-08-07 22:54:07 -07:00
Eric Traut
de4ea8681d Removed imported symbols that are not accessed or re-exported (third_party part 4 of 4) (#4391)
* Removed imported symbols that are not accessed or re-exported from within third_party stubs (part 4). These were all identified as unused symbols by the pyright type checker and language server.

Co-authored-by: Eric Traut <erictr@microsoft.com>
2020-08-06 22:11:22 +02:00
Ran Benita
cd132ff161 stdlib/3/inspect: fix _ParameterKind being an empty enum (#4383)
This makes mypy think that conditions like

    parameter.kind is Parameter.POSITIONAL_OR_KEYWORD

are always false, which triggers `unreachable` warnings, among other
problems.
2020-08-04 11:02:36 +02:00
Akuli
8bf7efe94e add types for tkinter geometry manager (aka pack,grid,place) methods (#4379) 2020-07-31 14:34:47 +02:00
Sebastian Rittau
7ed8c5f1da Add select.epoll.register to stubtest whitelist (#4376)
Python 3.8.5 changed the docstring slightly, possibly
a problem in stubtest.
2020-07-30 19:29:34 +02:00
Rebecca Chen
537b730558 Update to pytype 2020.07.20 and remove nmap from the exclude list. (#4348) 2020-07-20 23:01:21 -07:00
github-actions[bot]
334f77a2d7 Remove unused stubtest whitelist entries (#4340)
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
2020-07-18 17:27:28 +02:00
Shantanu
5ecdc08bb1 tarfile: fix arg name (#4326)
And update whitelist since #4322 fixed a thing

Co-authored-by: hauntsaninja <>
2020-07-12 20:27:43 +02:00
wouter bolsterlee
3efb675dba Use ‘exclude list’ instead of ‘blacklist’ (#4297)
This replaces all uses of ‘blacklist’ with ‘exclude list’. Benefits:

- It is racially neutral terminology; see e.g. [1]

- It makes the meaning more clear. In fact, with the popular Python
  autoformatter called ‘black’, also used by this project, files can be
  ‘blackened’ which is something completely different from them being on
  a blacklist.

[1] https://chromium.googlesource.com/chromium/src/+/master/styleguide/inclusive_code.md#racially-neutral
2020-07-01 09:10:37 +02:00
Sebastian Rittau
6bffc6534b Add nmap type information (#4292)
Author: Philipp Hahn <hahn@univention.de>

Co-authored-by: Philipp Hahn <hahn@univention.de>
2020-06-29 18:52:41 +02:00
Shantanu
fe58699ca5 collections/typing: fix various arg names (#4258)
This feels nervous, but if it passes unit tests it's unlikely to break
anything
2020-06-28 12:27:21 -07:00