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.
Re-export the types from wsgiref.types for now to avoid breaking
existing code. wsgiref.types should be removed eventually.
Also, reduce the boilerplate description in _typeshed/wsgi.pyi as it
mirrors the description in _typeshed/__init__.pyi.
* Add FileWrapper protocol to wsgiref.types
* Annotate werkzeug's wrap_file and FileWrapper
* Remove empty line at end of file
* Fix _Readable protocols
* Add ExcInfo and OptExcInfo type aliases
* Implement StartResponse using a protocol
* Mark stub-only types with an underscore
* Remove wrong TODO note
python/mypy#1178 is about variable-length tuples, while exc_info()
always returns a tuple with length 3. Ideally, exc_info() would
return Union[Tuple[Type[_E], _E, TracebackType], Tuple[None, None, None]],
but that is a different issue.
StartResponse callbacks are required to accept and optional third argument.
Currently, there is no good way to describe this using type hints.
Previously, a Union was used, but that causes mypy to complain about any call
of start_response().
* Use typing.Text
* Add InputStream and ErrorStream WSGI protocols
* Fix return type of WSGIApplication
* Add type hints to wsgiref.validate
* Replace _Bytes by plain bytes
* Add wsgiref.util
* Add wsgiref.headers
* ErrorWrapper.writelines() takes an Iterable
* Fix start_response return type
* Make Python 2 and 3 branches resemble each other more closely
* Use typing.NoReturn
* Fix WriteWrapper.writer type
* Change return type of WriteWrapper.writer to Any