Commit Graph
3718 Commits
Author SHA1 Message Date
Andre DelfinoandGitHub 1e0e40f61c Use Mapping for requests _Data (#4327) 2020-07-13 14:00:52 +02:00
ShantanuGitHubhauntsaninja <>
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
Sebastian RittauandGitHub 9ad8ed3b75 Introduce Mapping-like protocols (#4325)
typing.Mapping is not a protocol, which has caused problems in the past.
(E.g. python/typeshed#3569, see also python/typeshed#3576.) This
introduces a few narrow protocols to _typeshed.pyi that can be used in
place of Mapping.

Not all uses of Mapping can be replaced. For example, cgi.FieldStorage
explictly checks whether the supplied headers argument is a Mapping
instance.
2020-07-11 17:11:08 -07:00
028f0d5293 Fix: TarFile.tarinfo is a Type instead of instance. (#4322)
Co-authored-by: Jonathan Slenders <jslender@cisco.com>
2020-07-10 12:22:04 +02:00
Alex GrönholmandGitHub ad89dee03b Fixed return type of getaddrinfo() everywhere (#4304) 2020-07-10 10:46:28 +02:00
Joshua OremanandGitHub e6736cde8d ctypes: allow cast() 1st argument to be int and 2nd argument to be Type[py_object] (#4311) 2020-07-10 10:44:23 +02:00
Sebastian RittauandGitHub 209b6bb127 Remove tornado stubs (#4321)
Current tornado releases feature inline annotations and ship with
a py.typed file.
2020-07-09 07:20:11 -07:00
8e69672587 Fix for cryptography Extensions.get_extension_for_class. (#4320)
Co-authored-by: Jonathan Slenders <jslender@cisco.com>
2020-07-09 11:25:02 +02:00
Matan GoverandGitHub c64ecf5808 Flask.root_path cannot be None (#4319)
Extension of #2792 (see #2791). See [implementation](https://github.com/pallets/flask/blob/4e854ee49687ceac90985526928d901570d3585d/src/flask/helpers.py#L959).
2020-07-08 17:41:11 -07:00
Sebastian RittauandGitHub 03d8795403 Update unused stubtest whitelist action trigger (#4315)
Now runs weekly instead of daily, but also add the ability to trigger
manually.
2020-07-07 10:12:52 -07:00
Alex GrönholmandGitHub f9d469ac2b Fixed parameter and return types of getnameinfo() everywhere (#4305) 2020-07-03 15:46:02 +02:00
c0e9c4f4c5 add overloads for combinations r 2-5 (#4309)
This doesn't cover everything but it means it a lot of common usages the type will be slightly more useful

Co-authored-by: steve brazier <steve.brazier@trioptima.com>
2020-07-03 15:23:43 +02:00
Jürgen GmachandGitHub 92f91ddfe8 Add typing for werkzeug.utils.secure_filename (#4308) 2020-07-03 15:08:03 +02:00
Jürgen GmachandGitHub ee44a5c323 Update test setup description (#4307)
The description, as it was, did not work with an older version of pip,
as the installation errored. An updated version of pip fixes the installation problem.
2020-07-03 14:31:22 +02:00
Julian MehnleandGitHub 6d1c59d238 pymysql.err.Warning multiple-inherits from builtins.Warning and MySQLError. (#4303)
Previously we declared it as single-inheriting from only `MySQLError`.
2020-07-02 19:53:38 -07:00
John SnowandGitHub f26a82436c requests: add type hint for Session.send() (#4302)
This takes a PreparedRequest and returns a Response.

See https://github.com/psf/requests/blob/master/requests/sessions.py#L614
2020-07-01 15:31:37 -07:00
Federico BondandGitHub 4225ab2496 Export requests.utils module (#4301) 2020-07-01 10:55:55 -07:00
Ivan LevkivskyiandGitHub 5c7cf9f75c Script for modular typeshed migration (#4259)
This reshuffles directory structure according to the specification in https://github.com/python/typeshed/issues/2491#issuecomment-611607557
2020-07-01 12:36:23 +01:00
wouter bolsterleeandGitHub 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 RittauandGitHub b8f6d5fc54 Replace a few instances of IO with protocols (#4296) 2020-06-30 18:05:30 -07:00
wouter bolsterleeandGitHub 83e955b52f Use correct return type annotation for BaseException.with_traceback (#4298)
The return type of the BaseException.with_traceback() method [1] is not
specific enough. The return type is guaranteed to be of the same type as
‘self’, which is usually a subclass of BaseException.

In fact, .with_traceback() returns ‘self’:

    try:
        raise ValueError
    except Exception as exc:
        assert exc.with_traceback(None) is exc

Fix the annotation to reflect this using the self-type annotation
technique described in PEP484 [2], which is supported by (at least)
mypy [3].

[1] https://docs.python.org/3/library/exceptions.html#BaseException.with_traceback
[2] https://www.python.org/dev/peps/pep-0484/#annotating-instance-and-class-methods
[3] https://github.com/python/mypy/issues/1212
2020-06-30 11:40:25 -07:00
ChristineandGitHub 8cf3cd398e [redis] Update hset signature to include mapping kwarg (#4293) 2020-06-30 09:41:01 +02:00
f0269cd438 fix shutil.chown type annotations (#4294)
According to the official docs, "user can be a system user name or a uid;
the same applies to group".

Co-authored-by: Artem Simonov <artem.simonov@dejero.com>
2020-06-30 09:39:38 +02:00
Nipunn KoorapatiandGitHub ad8fd9dba7 Add typing for google protobuf mapping containers (#4265) 2020-06-30 09:37:50 +02:00
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
Jelle ZijlstraandGitHub 0142a87da8 adjust isort config (#4290)
Fixes #4288.

- Default imports to THIRD_PARTY, so in effect we merge the FIRST_PARTY and THIRD_PARTY stubs. This means import order is no longer affected by whether typing_extensions is installed locally.
- Treat typing_extensions, _typeshed and some others as standard library modules.

Note that isort master is very different from the latest release; we'll have to do something
different if and when the next isort release comes out.
2020-06-29 00:00:21 -07:00
Vishal KuoandGitHub cc8344b8c6 [multiprocessing] fixes more incorrect types (#4289) 2020-06-28 16:08:14 -07:00
4586ed9adc Require black and isort for contributions (#3329)
* Add explanation to CONTRIBUTNG.md
* Add sample pre-commit script
* Check for correctly formatted files in CI

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
2020-06-28 15:28:28 -07:00
Jelle ZijlstraandGitHub 5d553c9584 apply black and isort (#4287)
* apply black and isort

* move some type ignores
2020-06-28 13:31:00 -07:00
ShantanuandGitHub 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
Denis LaxaldeandGitHub 0dd3258ed2 Add __aiter__ and __anext__ methods for asyncio.StreamReader (#4286)
The following code produces an error in mypy:

    import asyncio
    from asyncio.subprocess import PIPE

    async def main() -> None:
        proc = await asyncio.create_subprocess_shell("ls -l", stdout=PIPE)
        assert proc.stdout is not None
        async for line in proc.stdout:
            print(line.decode())
        await proc.wait()

    asyncio.run(main())

$ mypy --strict file.py
file.py:8: error: "StreamReader" has no attribute "__aiter__" (not async iterable)

This commits fixes this by adding __aiter__/__anext__ methods that are
needed for async iterator protocol.
2020-06-28 11:57:49 -07:00
Peter LawandGitHub ed04d33def Make redirect_std{out,err} yield new stream as context var (#4285)
This matches the implementation, even though this behaviour isn't
actually documented yet. https://bugs.python.org/issue41147 aims
to fix the documentation issue though.

Fixes https://github.com/python/typeshed/issues/4283.
2020-06-28 07:36:09 -07:00
Sebastian RittauandGitHub 0704214701 Add pytest_mock stubs (#4275) 2020-06-27 19:46:47 -07:00
Vishal KuoandGitHub 986eff04c3 [redis] replaces _Str with _Value as variable info (#4281) 2020-06-27 13:04:20 -07:00
Vishal KuoandGitHub e467fd50ab multiprocessing: add sharedctypes, fix some stubtest cases (#4282) 2020-06-26 23:38:34 -07:00
Sebastian RittauandGitHub 564a8220f4 Add float.__ceil__ and __floor__ (#4274)
Closes: #3195
2020-06-26 22:26:39 -07:00
Vishal KuoandGitHub d4a2cf3da4 [redis] adds additional sorted set type information (#4278) 2020-06-27 00:14:42 +02:00
Sebastian RittauandGitHub ad7c1cd7eb Update pytype (#4280) 2020-06-27 00:13:12 +02:00
ShantanuandGitHub 64327e02e9 keyword: update for py39 (#4272) 2020-06-26 20:50:16 +02:00
ShantanuGitHubhauntsaninja <>
afcb46655a graphlib: add in py39 (#4268)
Co-authored-by: hauntsaninja <>
2020-06-26 20:49:50 +02:00
Sebastian RittauandGitHub b05adddf5a pytype tests: Specify files or dirs to check (#4279)
This adds the ability to check single files or directories with
tests/pytype_test.py by specifying the paths to check on the
command line.
2020-06-26 20:45:38 +02:00
Mark MendozaandGitHub 1d16e6c49e Replacing Callable[[T], T] with callback protocol in click (#4045) 2020-06-26 16:48:40 +02:00
ShantanuGitHubhauntsaninja <>
9a16b02187 argparse: fix for latest py39 (#4267)
https://github.com/python/typeshed/pull/4144 and
https://github.com/python/cpython/pull/11478#pullrequestreview-423968410
resulted in the issue being fixed upstream.


Co-authored-by: hauntsaninja <>
2020-06-26 12:55:23 +02:00
ShantanuGitHubhauntsaninja <>
cc150f1d76 compileall: update for py39 again (#4269)
Co-authored-by: hauntsaninja <>
2020-06-26 12:46:18 +02:00
ShantanuGitHubhauntsaninja <>
fc8b0ed94e builtins: remove __class_getitem__ from type (#4270)
Co-authored-by: hauntsaninja <>
2020-06-26 12:45:22 +02:00
ShantanuandGitHub 2ba6939788 imaplib: update for py39 (#4271) 2020-06-26 12:40:27 +02:00
ShantanuGitHubhauntsaninja <>
1c3f526fbf pickle: improve positional-arg accuracy in py39 and others (#4273)
Although technically data in loads is not positional-only in py38, but
we decided that that doesn't matter

Co-authored-by: hauntsaninja <>
2020-06-26 12:29:47 +02:00
Jia ChenandGitHub 92fa4e799c Using dunder parameter name in builtins._SupportsLessThan (#4264) 2020-06-25 21:02:00 +02:00
ShantanuGitHubhauntsaninja <>
70459abb44 Revert "zip: add some overloads for heterogeneous tuples (#3830)" (#4254)
This reverts commit e857ad6ba9.

Co-authored-by: hauntsaninja <>
2020-06-25 08:46:02 -07:00
helafumpekandGitHub 534ebd5051 Change argument type in random.shuffle (python/typeshed#4255) (#4260)
Fixes #4255
2020-06-24 08:17:13 +02:00