Commit Graph

543 Commits

Author SHA1 Message Date
Sebastian Rittau 07c8675ba5 Remove unused # type: ignore comments (#3325) 2019-10-09 10:27:18 -07:00
Utkarsh Gupta bd7222c396 models.pyi: Add missing requests.Respons.next() (#3328)
Closes: #3207
2019-10-09 19:01:30 +02:00
Jukka Lehtosalo 3a2fdfd45d Make it explicit that the cryptography stubs are incomplete (#3331) 2019-10-09 16:20:36 +01:00
Jukka Lehtosalo 0914d50b49 Fix the signature of decorator.contextmanager (#3330) 2019-10-09 16:58:37 +02:00
Benjamin Peterson 50961d45a1 protobuf: Add Message.FromString static method. (#3327) 2019-10-09 07:59:07 +02:00
Utkarsh Gupta 4027add6b3 __init__.pyi: Add missing methods on pkg_resources.VersionConflict (#3318) 2019-10-08 20:36:38 +02:00
Sebastian Rittau 256b3ce8ab Remove a bunch of unused imports (#3323) 2019-10-08 07:59:32 -07:00
Lukáš Lalinský a6f146e651 Fix return type of werkzeug's ProxyFix (#3320) 2019-10-08 10:30:00 +02:00
Rafi Blecher 6e4708ebf3 Add type stub for decorator lib (#3038) 2019-10-07 22:21:31 +02:00
Glyph 83589844c9 rrule.weekday(...) returns rrule.weekdays, not _common.weekdays. (#3274) 2019-10-05 01:49:49 +02:00
Sebastian Rittau 0a426d8a8e Move cryptography from 2 to 2and3 (#3304)
The cryptography stubs are very rudimentary at the moment, but there
is nothing that limits them to just Python 2.

Closes: #3303
2019-10-04 14:11:42 -07:00
Vasily Zakharov e62857f851 Updated maxminddb stubs to v1.5.0 (#3300) 2019-10-04 12:55:46 +02:00
Benjamin Peterson 9a1d205f34 cryptography: Return RSAPrivateKeyWithSerialization from generate_private_key. (#3296)
The only extant implementation of generate_private_key returns this more specialized interface.
2019-10-03 01:09:25 +02:00
Michael J. Sullivan ad881f94d7 Add the mypyc_attr function to mypy_extensions (#3290) 2019-10-01 17:45:47 -07:00
Sebastian Rittau c32e1e2280 Enable --disallow-any-generics for stubs (#3288) 2019-10-01 05:31:34 -07:00
Benjamin Peterson 23b353303b Allow passing bytes and byte string to yaml load APIs. (#3287) 2019-09-30 22:30:28 +02:00
Sebastian Rittau ed4b1de0ad Fix third_party errors with --disallow-any-generics (#3278)
Part of #3267. Together with #3276 this should fix all such problems.
2019-09-30 13:14:01 +02:00
Alex Jurkiewicz efdbefee86 Add return types for pymysql.connection.close/cursor (#3268) 2019-09-27 07:04:23 +02:00
Colin Gilgenbach c33239b011 click: Support tuples of _ParamTypes, CliRunner fixes (#3259) 2019-09-24 14:11:25 +02:00
Augusto Hack 829c646d69 Added constructor types for click.FloatRange (#3257) 2019-09-23 20:40:54 +02:00
Augusto Hack c1ec292344 Added missing top-level export to click (#3256) 2019-09-23 18:48:13 +02:00
Vasily Zakharov 4d662f0f49 Stubs for maxminddb added (#3245) 2019-09-19 17:49:38 +02:00
Philippe F ce0dc8a23d Add proper support for __rtruediv__ on libpath.Path (#3236) 2019-09-17 23:24:42 +02:00
Brad babc0c1912 Accept bytes to several Redis client commands (#3238) 2019-09-17 11:30:00 +02:00
Alex Garbutt 895ae0fd9b requests.Session.request data arg accepts an iterable of tuples (#3237) 2019-09-16 22:16:52 +02:00
Ivan Levkivskyi d0f3eb2d6b Use Text for text arguments to click.[un]style (#3233) 2019-09-16 15:36:28 +02:00
Sebastian Rittau efb4af0108 Mark some types as non-hashable (#3219)
Based on @JelleZijlstra's PR #2221.

Fixes #2148
2019-09-04 17:38:09 +02:00
Pascal Corpet b94fa842eb Type response of Flask test client methods: get, post, etc. (#2904) 2019-09-03 11:12:11 +02:00
Shannon Zhu f9300ed1ed Update pyre_extensions stub (#3214) 2019-08-30 16:15:24 -07:00
Colin Gilgenbach 99e8ed42a4 Mark ParamType.fail() as NoReturn (#3213)
This function just raises a click.BadParameter exception with the supplied arguments.
2019-08-29 17:57:43 +02:00
Sebastian Rittau ae881faaf1 Remove custom _Text type (#3211)
* Remove custom _Text type

Since the custom type was only used in argument types, it was
effectively only an alias for typing.Text.

* Run requests/api.pyi through black
2019-08-29 08:51:59 -07:00
Benjamin Peterson f53f52de57 requests: Allow bytes for url parameters. (#3209)
typeshed already partially reflected https://github.com/psf/requests/pull/2238 but not completely.
2019-08-28 21:53:19 -07:00
Benjamin Peterson a48abb4546 Add unquote_to_bytes to Python 3 six.moves.urllib.parse. (#3208) 2019-08-28 18:01:38 -07:00
Shannon Zhu 72010bc5dc Update how mock classes alias to Any (#3182)
* Update how mock classes alias to Any

> First, the z: Any situation looks like a bug or accidental feature to me.
This is definitely meant (and works) as a variable declaration; that it
also allows using z as a type seems wrong. I can't find any evidence in
PEP 484 that this was intended; in mypy it's likely the accidental result
of other design choices meant to shut up errors about Any.

Ideally these classes could be declared as empty class stubs, but since the comments suggest this isn't possible yet, let's update these to be type aliases to Any rather than global variables of type Any. This would avoid invalid type errors when the implementation of type checkers respect the intention that `z: Any` does not make `z` a valid type.

* Update mock.pyi
2019-08-19 17:10:27 -07:00
Bouteillebleu d5a918de7b Add stubs for CGIHTTPServer (#3196)
This commit adds:
* Stubs for CGIHTTPServer in the Python 2 standard library, as requested in #1147.
* Stubs for six.moves.CGIHTTPServer in Python 2, as requested in #22.
2019-08-19 15:34:29 +02:00
Rebecca Chen fab2ee0d7c Remove unnecessary quotes around forward references. (#3191) 2019-08-16 20:29:32 -07:00
Michael Lee b294782183 Make most contextmanager __exit__ signatures return Optional[bool] (#3179)
This pull request is a follow-up to https://github.com/python/mypy/issues/7214.

In short, within that mypy issue, we found it would be helpful to
determine between contextmanagers that can "swallow" exceptions vs ones
that can't. This helps prevent some false positive when using flags that
analyze control flow such as `--warn-unreachable`. To do this,
Jelle proposed assuming that only contextmanagers where the `__exit__`
returns `bool` are assumed to swallow exceptions.

This unfortunately required the following typeshed changes:

1. The typing.IO, threading.Lock, and concurrent.futures.Executor
   were all modified so `__exit__` returns `Optional[None]` instead
   of None -- along with all of their subclasses.

   I believe these three types are meant to be subclassed, so I felt
   picking the more general type was correct.

2. There were also a few concrete types (e.g. see socketserver,
   subprocess, ftplib...) that I modified to return `None` -- I checked
   the source code, and these all seem to return None (and don't appear
   to be meant to be subclassable).

3. contextlib.suppress was changed to return bool. I also double-checked
   the unittest modules and modified a subset of those contextmanagers,
   leaving ones like `_AssertRaisesContext` alone.
2019-08-16 16:13:33 -07:00
Patrick Valsecchi 26f575130c Add some redis types (#3092) 2019-08-10 13:22:40 -07:00
Benjamin Peterson 0dc3bf941a Improve type of tornado.testing.gen_test. (#3174)
gen_test can accept a timeout parameter. See https://www.tornadoweb.org/en/branch5.1/testing.html#tornado.testing.gen_test.
2019-08-10 13:08:59 -07:00
Sebastian Rittau 628eee29f7 Use Literal in a few more places (#3176) 2019-08-10 13:08:18 -07:00
Sebastian Rittau c579f91077 Improve werkzeug exceptions slightly (#3178)
* Use Text for HTTPException.description
* Add Unauthorized.www_authenticate
* Remove wrong get_headers() overrides
2019-08-09 20:05:56 +02:00
g.denis 50f1988650 concurrent: add private classes and exceptions (#3169) 2019-08-07 10:39:15 +02:00
Ilya Konstantinov 4c8d577d68 flask: allow view func body to be dict (#3149) 2019-07-31 02:04:36 +02:00
Allison Kaptur 15aa18d0a2 dateutil.rrule can take dates (#3154) 2019-07-27 11:39:23 +02:00
Sebastian Rittau 9ccf9356bf Remove Python 3.4 support (#3147)
Closes #3123
2019-07-27 10:58:21 +02:00
Sebastian Rittau 0177dedc42 Add werkzeug.middleware (#3103)
HTTPConnection.timeout can be a float
2019-07-24 08:51:55 -07:00
Nipunn Koorapati 67d091db15 Update google RepeatedCompositeFieldContainer (#3136) 2019-07-22 09:00:22 +02:00
Ivan Levkivskyi 508f992730 Add __eq__ to protobuf containers (#3126)
See https://github.com/protocolbuffers/protobuf/blob/master/python/google/protobuf/internal/containers.py.

Without these `mypy --strict-equality` causes false positives with protobufs.
2019-07-17 23:25:22 +01:00
Sebastian Rittau 1436cfdef9 Add types to FileStorage (#3067) 2019-07-04 12:58:51 -07:00
Savo Kovačević 84e6492d7e Improving Flask stubs (#3003)
* Fix flask render_template and render_template_string stubs

* Add types for flask view function

* Import TracebackType from the right location

* Switch to bound typevar in route decorator stub

* Change render_template and render_template_string parameters to Text
2019-07-04 12:57:06 -07:00