Commit Graph

2534 Commits

Author SHA1 Message Date
Vasily Zakharov 34cc5545fe email.mime.application.MIMEApplication expects data to be bytes, while it should be Union[str, bytes] (#2855)
Fixes #2831
2019-03-11 20:42:55 +01:00
Vasily Zakharov e4e19d6e98 Add email.charset.SHORTEST, QP, BASE64 to the stub for Python 2 (#2857)
Also mark Python 3 constants as undocumented.

Fixes #2830
2019-03-11 20:41:19 +01:00
Vasily Zakharov 08555f80d1 Make vars arguments Optional, as they default to None (#2853)
Closes #2847
2019-03-11 15:12:35 +01:00
Lawrence Chan 4856458251 Add logging.Formatter.formatMessage method (#2850) 2019-03-11 08:46:21 +01:00
Jelle Zijlstra 832bf52c28 asyncio: make type alias private and CamelCase (#2849) 2019-03-11 08:43:00 +01:00
Sebastian Rittau 6f00053511 Add stubs for bleach (#2709)
* Add stubs for bleach

* Support Python 2 for bleach

* Add missing imports
2019-03-10 21:08:46 -07:00
Chen Li 012901e318 [asyncio] Change _set_running_loop(loop: AbstractEventLoop) to _set_running_loop(loop: Optional[AbstractEventLoop]) (#2828) 2019-03-11 00:29:53 +01:00
Gleb Chipiga 6282e9f59f Update asyncio streams stub (#2845)
* Add is_closing and wait_closed methods to StreamWriter [Python 3.7]
* Update type of open_unix_connection and start_unix_server path parameter [Python 3.7]
2019-03-11 00:15:03 +01:00
Gleb Chipiga bf370b5908 Update attr stubs to 19.1.0 (#2846) 2019-03-11 00:11:26 +01:00
Eric Traut ef5fc92b98 Added missing default value annotation (#2841) 2019-03-10 12:19:29 +01:00
Eric Traut 06c682449f Fix inconsistent self/cls parameter names (#2838)
Fixed several inconsistent parameter names so all instance methods take 'self' and all class methods take 'cls'. This avoids warnings or errors from linting tools that enforce standard naming conventions.
2019-03-10 03:17:55 +01:00
Eric Traut 20b3b54460 Changed parameter name of several methods in logging module from 'lvl' to 'level' to match the implementation. Use in a keyword arg of 'lvl' results in runtime errors. (#2840) 2019-03-10 03:04:31 +01:00
Eric Traut 748ad3d21f Removed extraneous import statement that was redefining three symbols in markupsafe/__init__.py. This redefinition triggered type checking/linting errors. (#2842) 2019-03-10 02:57:54 +01:00
Brandt Bucher ab4c262043 Add isascii methods to str, bytes, and bytearray [Python 3.7]. (#2834) 2019-03-08 11:07:28 -08:00
herr kaste 4dcd516caa Improve min/max (#2833)
* For min/max return Union type if default given
* For min/max mark keyword only arguments
* Also mark positional arguments
2019-03-08 19:25:34 +01:00
Pascal Corpet 979534c764 Prefer Mapping to Dict for input of csv DictWriter methods. (#2829) 2019-03-07 15:04:56 +01:00
秋葉 b588d43a32 Add sunder names to enum (#2822)
Closes #2766
2019-03-06 15:31:53 +01:00
Michael J. Sullivan 939be9a787 Make 2.7's json.load use a protocol for fp (#2826)
This matches what the 3 stub does
2019-03-05 12:14:00 -08:00
Sean McLemon e0211269d1 Add itermonthdays3 and itermonthdays4, fix incorrect 'cssclass_today' (#2825)
Closes #2806
2019-03-05 20:12:57 +01:00
Sean McLemon 17cd91eeb3 multiprocessing.spawn submodule and multiprocessing.pool stubs (#2823)
Added stub for multiprocessing.spawn submodule and updated multiprocessing.pool stub

Closes #2758
2019-03-05 14:52:02 +01:00
Maxim Kurnikov b80b2e4b98 make IMapIterator a subclass of Iterator (#2814) 2019-03-05 10:15:25 +01:00
Michael J. Sullivan f569957bbe Make urllib2.urlopen return a non-optional addinfourl (#2821)
This is technically wrong. The documentation states that:
"Note that None may be returned if no handler handles the request
(though the default installed global OpenerDirector uses
UnknownHandler to ensure this never happens)."

This is super marginal and making it optional causes a few dozen
errors in an internal dropbox code base.
2019-03-01 16:08:26 -08:00
Jelle Zijlstra 14e387b6fd fix some minor lint errors (#2820)
Caught by a newer version of flake8
2019-03-01 12:29:23 +01:00
Ivan Levkivskyi 3d638b0677 Revert "Fixing signature for Mapping.get's default parameter (#2810)" (#2817)
This reverts commit 3f83195558.
2019-02-27 18:09:46 +00:00
Sean McLemon 0efb2469d4 README.md suggests running tests with PYTHONPATH instead of MYPYPATH (#2813)
* The 'Running the tests' section suggests setting PYTHONPATH instead of MYPYPATH when testing typeshed as a submodule of mypy

* actually PYTHONPATH was the right var to set ... but it was set slightly wrong after a directory reshuffle
2019-02-25 09:34:08 -08:00
Aymeric Augustin af9082c302 Fix signature of asyncio.create_connection. (#2756)
* local_addr and server_hostname are optional and default to None.
* If sock is given, none of host, port, family, proto, flags and
  local_addr should be specified.
2019-02-23 10:04:15 -08:00
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