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
Fixes the following issues:
* Literals rather than ... for default values
* None rather than ... for default value of typed variable
* Literals rather than ... # type for top level constants
* # Foo rather than # type: Foo
* return value of init not set to None
Both mypy and pytype only use the major and minor version in type checking. Using
checks like "sys.version_info >= (3, 4, 4)" won't actually work properly for
people type checking their code using version 3.4, because (3, 4) >= (3, 4, 4) will
always be false (at least in mypy's approach; not sure if pytype is different).
decode_header accepts a parameter of type str or Header, but the
stub for decode_header types the parameter as Header. Change
that to Union[Header, str].
* Change (Py3) email message payload type
The docstring of the Message get_payload method indicates that the
possible return types include None and bytes. Additionally the
set_payload method accepts bytes. Therefore I've changed the
PayloadType to include bytes and the get_payload return type to be an
Optional PayloadType.
* Change email (Py3) message_from_file IO types
Instead of using TextIO and BinaryIO use IO[str] and IO[bytes]
respectively to match the type returned by the open builtin. This
follows the recommendations in #283.
The error that prompts this is reproduced via:
```
from email import message_from_file
with open('email') as file_:
email = message_from_file(file_)
```
Argument 1 to "message_from_file" has incompatible type IO[Any]; expected "TextIO"