Fix type hints for Python 3.5.2 (#1177)

This commit is contained in:
Lonami Exo 2019-05-12 13:07:07 +02:00
parent 5d41246e73
commit 5754ad589f

View File

@ -1,5 +1,4 @@
import datetime import datetime
import io
import typing import typing
from . import helpers from . import helpers
@ -35,6 +34,8 @@ TotalList = helpers.TotalList
DateLike = typing.Optional[typing.Union[float, datetime.datetime, datetime.date, datetime.timedelta]] DateLike = typing.Optional[typing.Union[float, datetime.datetime, datetime.date, datetime.timedelta]]
# Note: we can't use `io.BytesIO` directly due to a bug in
# Python 3.5.2's `typing`: https://github.com/python/typing/issues/266
LocalPath = str LocalPath = str
ExternalUrl = str ExternalUrl = str
BotFileID = str BotFileID = str
@ -43,7 +44,7 @@ FileLike = typing.Union[
ExternalUrl, ExternalUrl,
BotFileID, BotFileID,
bytes, bytes,
io.IOBase, typing.BinaryIO,
types.TypeMessageMedia, types.TypeMessageMedia,
types.TypeInputFile, types.TypeInputFile,
types.TypeInputFileLocation types.TypeInputFileLocation
@ -52,7 +53,7 @@ FileLike = typing.Union[
OutFileLike = typing.Union[ OutFileLike = typing.Union[
str, str,
typing.Type[bytes], typing.Type[bytes],
io.IOBase typing.BinaryIO
] ]
MessageLike = typing.Union[str, types.Message] MessageLike = typing.Union[str, types.Message]