Run the mypy test suite using Ubuntu 18.04. Ubuntu 20.04 doesn't have a package for virtualenv on Python 2.
Also, curses.color_pair() now has a named argument.
Eliminated the use of "bare" TypeVars (i.e. a TypeVar that appears only once) within generic methods. While not considered an error in PEP 484, these are a common source of bugs in code, and some type checkers (including pytype and pyright) flag them as errors.
Co-authored-by: Eric Traut <erictr@microsoft.com>
* Split cgi.pyi into Py2 and 3 versions
* Restore correct Python 2 version of cgi.pyi
* Remove unnecessary version checks in cgi.pyi
* Use collections.abc
* Use List in Python 2 stub
A security fix added a "separator" argument to several URL parsing
functions and method in point releases:
* 3.6.13
* 3.7.10
* 3.8.8
* 3.9.2
Until all these versions are available on the GitHub Actions runners,
we need to whitelist the functions in the stubtests.
* Remove conventions enforced by black
Remove old note about optional default arguments (now part of
PEP 484 and enforced by CI)
* Recommend to use PEP 585
Cf. #4820
* Try out using collections.abc
* Reference mypy bug
This is enough to get stubtest working (note that it's a little annoying
to install mypy currently since typed-ast seems to have broken again on
Python 3.10)
Co-authored-by: hauntsaninja <>
The TypeVar `_T` was being used as a type argument for `PathLike`, but `PathLike` requires that its type argument be constrained to `str` or `bytes`, and `_T` didn't provide any such constraint. The easy workaround is to use the TypeVar `AnyStr` instead.
Co-authored-by: Eric Traut <erictr@microsoft.com>
The documentation says, "The parse() function can take either a filename
or an open file object."
(https://docs.python.org/3.8/library/xml.dom.minidom.html). The function
was annotated as only accepting a str, so I added IO[Any].
Python 3.9 added the usedforsecurity kwarg as discussed in:
https://bugs.python.org/issue9216
The stubs for the other constructors were updated to reflect this change, but
the stub for new() was missed.
* Add _collections_abc module
* Rearrange collections.abc and collections to re-export from _collections_abc
Co-authored-by: Sebastian Rittau <srittau@rittau.biz>