As a followup to the work done in #2767 and #2830, and to address a
piece of #66, most of the email_mime submodules aren't typed in six
under python2, only python3. Now they are.
All Python 3 versions supported by typeshed (3.4+) have enum as part
of the standard library.
Make the third-party Python 2 version consistent with the Python 3 version.
pathlib2 is the Python 2.7 backport of the pathlib module from Python 3.
Hence we use the same stub file for both.
The maintainer of pathlib2 granted permission for stubs to be added in
mcmtroffaes/pathlib2#44.
I found some code that called DEFINE_integer() and DEFINE_float() with default set to None. Perusing the code that seems to be a totally valid usage. I am not super familiar with gflags but I believe this PR consistently changes all those default values to Optional[].
Make the Python 2 and 3 concurrent.futures stubs identical so fixes get
applied to both.
For example, #1305 and #2233 fixed the same problem at different times,
as did #1078 and #1911.
By making the stubs identical, we apply the fix from #1711 to Python 2.
Fixes#2234.
Use parameterized types in Future.add_done_callback(), wait(), and
as_completed().
Mark the traceback argument to Future.set_exception_info() as optional.
The Python 2 version was slightly outdated compared to the Python 3
version.
The Python 2 version of Headers.__delitem__() had an optional argument
_index_operation that also exists in the implementation. But considering
this is internal use only, it was missing from the Python 3 version, and
it created problems with derived classes, I decided not to add it to
the merged stub. See also pallets/werkzeug#1051.
* Move google protobuf from 2 to 2and3
This should generally be ok. I ran the internal consistency
tests and they seemed to pass.
* Convert str to bytes
* repr to use str in google.protobuf.internal.containers
To support "from six.moves.cPickle import loads", we must add a stub for
six.moves.cPickle as if it were a real submodule, even though it isn't
implemented as such. This fixespython/mypy#1550.
We don't apply this approach to six.moves.builtins on Python 2, because
it seems to confuse mypy.
We also add stubs for aliases in six.moves whose underlying modules have
been added to typeshed.
For Python 2:
- six.moves.SimpleHTTPServer (alias for SimpleHTTPServer)
For Python 3:
- six.moves.tkinter_dialog (alias for tkinter.dialog)
- six.moves.tkinter_filedialog (alias for tkinter.filedialog)
- six.moves.tkinter_commondialog (alias for tkinter.commondialog)
- six.moves.tkinter_tkfiledialog (alias for tkinter.filedialog)
Currently the Python 2 stub for `IntEnum` just inherits from `Enum` without changing anything, meaning that its `value` has type `Any`. This changes it such that, if you know you have an `IntEnum` you get the more specific `int` type for the `value`. Note that this has already been done for Python 3 `IntEnum` (both in `third_party/3/enum.pyi` and `stdlib/3.4/enum.pyi`).
This fixes an error in Travis that seems to have been caused by python/mypy#4319.
The fix was taken from the stdlib/3.4/enum.pyi stub. Mypy no longer assumes
that classes whose metaclass is EnumMeta are subclasses of Enum, so we can't
bound the typevar on Enum.