Commit Graph

2758 Commits

Author SHA1 Message Date
Jelle Zijlstra
b5897d5643 fix undefined name in flask stub (#2811) 2019-02-23 10:28:03 +01:00
Jelle Zijlstra
2aee28cb6f fix missing space in imghdr (#2812) 2019-02-23 10:26:51 +01:00
Nipunn Koorapati
07ea6614c8 Genericize types for stringly typed methods on google.protobuf.Message (#2807) 2019-02-22 22:23:32 -08:00
Mark Mendoza
3f83195558 Fixing signature for Mapping.get's default parameter (#2810) 2019-02-22 21:20:02 -08:00
Matt Robinson
68a9b0ac12 Add Restart to pdb.pyi (#2805)
Add `Restart` class to `pdb.pyi`, which has no internal implementation.
2019-02-21 15:30:14 +01:00
Jukka Lehtosalo
306b4694ae Remove redundant definition of ast.PyCF_ONLY_AST (#2803)
This gets imported from `_ast`, so the definition was
redundant. This causes problems with the new mypy semantic
analyzer, as it will flag the redefinition as an error.
2019-02-20 17:12:11 +00:00
Philipp Hahn
25c96400f6 Add some urllib2 annotations (#2688) 2019-02-18 12:04:50 +01:00
Philipp Hahn
b022f76516 socket: timeout may be None (#2801)
timeout=None puts the socket into blocking mode.

Read <https://bugs.python.org/issue18417> and the referenced other
issues for more gory details.
2019-02-18 11:32:25 +01:00
秋葉
570fd6aff1 Add some missing annotations in cyaml (#2769)
* update annotation of cyaml

* fix wrong type
2019-02-17 13:28:05 -08:00
Ivan Levkivskyi
0b8e32269a Fix named tuple name in posix.pyi (#2800) 2019-02-15 17:39:27 -08:00
Rebecca Chen
3f8c08402d Remove an unnecessary entry from the pytype blacklist. (#2799) 2019-02-15 17:33:29 -08:00
Bertrand Bonnefoy-Claudet
2bd16c42f6 Fix Flask stubs for dispatch_request (#2796)
`dispatch_request` can accept arbitrary arguments and can return
different values.  To keep this simple and in line with the rest of the
stubs (e.g. with `view_func: Callable[..., Any]`), `Any` is used for the
return value although it is too broad.

Closes #2795.
2019-02-15 00:08:25 +01:00
Rebecca Chen
d275e73e1f Remove pytype workaround in os/__init__.pyi. (#2797)
Pytype release 2019.02.13 fixed the bug that
necessitated this workaround.
2019-02-14 12:29:19 -08:00
Sebastian Rittau
0989d9507e Fix groupby with key=None (#2794)
Cf #2790
2019-02-13 08:45:24 -08:00
Antoine Fourmy
b3aac58db0 root_path cannot be None (#2792)
Fixes #2791
2019-02-12 14:00:56 +01:00
Alun Champion
9b545a01ab Added Optional[] around the itertools.groupby() key attribute to allow None to pass the type (#2790)
Fixes #2788
2019-02-12 11:59:37 +01:00
Ivan Levkivskyi
ca62cecd14 Fix Flask.config annotation (#2787) 2019-02-11 14:19:42 +01:00
Michael Brandt
1442cc02bf Add stubs for HTTP Handler classes in py2/urllib2 & py3/urllib.request (#2710)
* HTTP Handler class annotations for py2/urllib2 & py3/urllib.request

Add full annotations for the following classes:

* Python 2:

    * `urllib2.AbstractHTTPHandler`
    * `urllib2.HTTPHandler`
    * `urllib2.HTTPsHandler`

* Python 3:

    * `urllib.request.AbstractHTTPHandler`
    * `urllib.request.HTTPHandler`
    * `urllib.request.HTTPsHandler`

This information is largely undocumented, and was obtained by directly examining
the Python source code:

* Python 2 (v2.7.15) - https://github.com/python/cpython/blob/v2.7.15/Lib/urllib2.py#L1115-L1243
* Python 3 (v3.7.1) - https://github.com/python/cpython/blob/v3.7.1/Lib/urllib/request.py#L1224-L1364

`urllib2.AbstractHTTPHandler.do_open` takes as a parameter either
`HTTPConnection` or `HTTPSConnection`--one of the classes, not an instance of
either--and constructs an object using only a few of the parameters that either
constructor could use. `HTTPConnectionProtocol` in `stdlib/2/httplib.pyi`
follows a similar patten to `HTTPConnectionProtocol` added to
`stdlib/3/http/client.pyi` in pull request #2582 to describe the type of the
`http_class` that is passed to `do_open`.
2019-02-11 11:25:02 +01:00
Joshua Oreman
f8612a77bb Make AsyncGenerator.aclose() properly return Awaitable[None] (#2786)
Fixes #2785. The rationale is discussed there.
2019-02-10 22:35:17 -08:00
ijl
9bbe60978e Add type hints for orjson (#2747) 2019-02-11 01:56:57 +01:00
lincolnq
b00bb54dc5 Some small tweaks to Werkzeug stubs: (#2784)
* default_exceptions is a dict of classes, not instances
* Correctly overload 'redirect' to get the proper return type
* Request.get_data() is an Any (not bytes), just like Response.get_data
2019-02-09 20:30:28 +01:00
Łukasz Hanuszczak
c8c6271365 Make NamedTuple accept Text names (#2762)
Closes #2761
2019-02-09 19:06:07 +01:00
Utkarsh Gupta
e1a02a6f0a decorators.pyi: Add overload to option() (#2671)
Fixes #1692
2019-02-09 19:05:07 +01:00
Utkarsh Gupta
1a37368cc0 __init__.pyi: Add __getitem__() to stat_result() (#2753)
Fixes #2751
2019-02-09 16:07:10 +01:00
Aymeric Augustin
f0c5ac04b0 Support *contiguous attributes of memoryview. (#2755) 2019-02-09 16:05:00 +01:00
秋葉
e0e83a2dcc Use a more accurate type for jwt.decode (#2765)
Closes #2764
2019-02-09 15:59:58 +01:00
Aymeric Augustin
503cbb97a3 Fix signature of asyncio.create_server. (#2763)
* host may be None to bind to all interfaces.
* If sock is given, host and port shouldn't be specified.
2019-02-09 15:45:09 +01:00
Josh Morton
b0eb6c2eae Improve the stubs in charset.pyi under python3. (#2768)
The python3 charset stubs didn't include certain necessary module level
constansts (like `QP`) and wrongly defined the arguments to some of
the functions in the module. This is no longer the case.

Fixes #2767
2019-02-09 15:29:49 +01:00
Ingmar Steen
c5713205ff requests.auth.AuthBase.__call__ deals with PreparedRequest. (#2759)
Both the argument and the return type are expected to be instances
of requests.models.PreparedRequest, not requests.models.Request.
2019-02-09 15:19:54 +01:00
Aymeric Augustin
0b6d134795 Support the errors arg in codecs factory functions. (#2752) 2019-02-09 15:06:46 +01:00
Benjamin Peterson
6850b9d699 gflags: Add DEFINE_multi_enum. (#2783)
4f06c3d0d6/gflags/__init__.py (L800)
2019-02-08 15:14:52 -08:00
Paul Dagnelie
5ef6cb7f46 Add types to some cross-platform functions in the platform library (#2781) 2019-02-08 20:28:53 +01:00
Michael J. Sullivan
d8faf503ec Make SyntaxError.offset be optional (again) (#2782)
This was originally done in #2557, but got lost in #2533.
2019-02-08 11:09:18 -08:00
Paul Dagnelie
ed4323df30 Update models.pyi (#2780)
Currently, iter_lines() doesn't have any type annotations despite the types being very similar to iter_content and the types can be pretty readily derived from the source.
2019-02-07 07:21:57 -08:00
Ivan Levkivskyi
9ffa1d8237 Update stubgen link and add a bit more info (#2779) 2019-02-03 14:47:34 +00:00
Andrew Svetlov
c45c0635c1 Add hidden and deprecated click.Command options (#2778) 2019-02-03 11:05:53 +01:00
Joel Rosdahl
3eb66ba633 Add type annotation for collections.deque.__iadd__ (#2774)
* Add type annotation for collections.deque.__iadd__

Fixes #2771.
2019-02-01 19:39:09 +01:00
Joachim Jablon
caefaa6af9 pkg_resources: fix stub for get_metadata_lines (#2776) 2019-02-01 07:58:49 -08:00
Joachim Jablon
90d3a6e2e2 pkg_resources Add PKG_INFO str attribute for Distribution class (#2775)
To avoid
```
error: "Distribution" has no attribute "PKG_INFO"
```
This is the corresponding implementation:
8f82e5077e/pkg_resources/__init__.py (L2531)
2019-02-01 07:58:13 -08:00
Pascal Corpet
75581cf7da Create stubs for Flask (#2740)
See permission in pallets/flask#2012.

Fixes #28.
2019-01-30 14:15:30 +00:00
Utkarsh Gupta
ad803e1caa builtins.pyi: Update __iadd__() and imul() in class list (#2754)
Fixes #2711
2019-01-21 21:57:15 +01:00
Frazer McLean
9e5816a539 Fix six.raise_from value type (#2746)
Fixes #2742
2019-01-17 20:16:38 +01:00
Hynek Schlawack
7b69e48d1b Add SSLCertVerificationError fields (#2745) 2019-01-17 16:48:34 +01:00
Евгений
6f09ccb63d logging: inherit TimedRotatingFileHandler from Handler (#2738) 2019-01-17 13:54:59 +01:00
Michael R. Shannon
a2ecfafa98 Add missing explicit Optional to stubs for the xml.etree package. (#2734)
Fixes #2733
2019-01-17 13:50:37 +01:00
Michael Noseworthy
e8c1111d13 Fix logging.getLevelName() type hints (#2730)
`logging.getLevelName()` can take either an `int` and returns a `str` or
a `str` and returns an `int` when the level name (`str`) or level
(`int`) is one of the registered log levels. If the value passed in
isn't one of the registered log levels, it returns the string `"level
%s" % lvl` where `lvl` is the value passed in to the function.
2019-01-17 13:40:03 +01:00
Jelle Zijlstra
78690405cf add back StopIteration.value in Python 3 (#2744)
Fixes python/mypy#6209.
2019-01-16 19:21:16 -08:00
Igor Davydenko
8e6e178a5a As of Python 3.6 dump_stats method allows PathLike object to be passed. (#2741)
Replicate typings from `pstats.dump_stats` into `profile` and `cProfile`
libraries.
2019-01-15 10:27:53 -08:00
cormoran
632eadc894 Make metavar in argparse be Optional (#2739) 2019-01-13 12:09:06 +01:00
Vield
ee20595996 Fix type of indent in JSONEncoder (#2737)
A None value for indent means the most compact representation (no newlines), it is also the default value.
2019-01-11 12:48:21 +01:00