From 3df9d2b429d90d7d5625b5984424496b27a9012f Mon Sep 17 00:00:00 2001 From: Leandro Toledo Date: Sun, 12 Jul 2015 10:39:11 -0300 Subject: [PATCH] Working on Python 3 support --- Makefile | 2 +- telegram/__init__.py | 49 +++++++++++++++++---------------- telegram/forcereply.py | 2 +- telegram/replykeyboardhide.py | 2 +- telegram/replykeyboardmarkup.py | 2 +- 5 files changed, 30 insertions(+), 27 deletions(-) diff --git a/Makefile b/Makefile index 56114981a..ec8ec3b62 100644 --- a/Makefile +++ b/Makefile @@ -11,7 +11,7 @@ clean: find . -name '*~' -exec rm -f {} \; lint: - flake8 telegram + flake8 --doctests --max-complexity 10 telegram test: python telegram_test.py diff --git a/telegram/__init__.py b/telegram/__init__.py index 4368078b5..072c9876b 100644 --- a/telegram/__init__.py +++ b/telegram/__init__.py @@ -1,31 +1,34 @@ #!/usr/bin/env python -# flake8: noqa """A library that provides a Python interface to the Telegram Bots API""" __author__ = 'leandrotoledodesouza@gmail.com' __version__ = '1.1' -import json +from .user import User +from .message import Message +from .update import Update +from .groupchat import GroupChat +from .photosize import PhotoSize +from .audio import Audio +from .document import Document +from .sticker import Sticker +from .video import Video +from .contact import Contact +from .location import Location +from .chataction import ChatAction +from .userprofilephotos import UserProfilePhotos +from .replykeyboardmarkup import ReplyKeyboardMarkup +from .replykeyboardhide import ReplyKeyboardHide +from .forcereply import ForceReply +from .replymarkup import ReplyMarkup +from .inputfile import InputFile +from .error import TelegramError +from .emoji import Emoji +from .bot import Bot -from user import User -from message import Message -from update import Update -from groupchat import GroupChat -from photosize import PhotoSize -from audio import Audio -from document import Document -from sticker import Sticker -from video import Video -from contact import Contact -from location import Location -from chataction import ChatAction -from userprofilephotos import UserProfilePhotos -from replykeyboardmarkup import ReplyKeyboardMarkup -from replykeyboardhide import ReplyKeyboardHide -from forcereply import ForceReply -from replymarkup import ReplyMarkup -from inputfile import InputFile -from error import TelegramError -from emoji import Emoji -from bot import Bot +__all__ = ['Bot', 'Emoji', 'TelegramError', 'InputFile', 'ReplyMarkup', + 'ForceReply', 'ReplyKeyboardHide', 'ReplyKeyboardMarkup', + 'UserProfilePhotos', 'ChatAction', 'Location', 'Contact', + 'Video', 'Sticker', 'Document', 'Audio', 'PhotoSize', 'GroupChat', + 'Update', 'Message', 'User'] diff --git a/telegram/forcereply.py b/telegram/forcereply.py index 6cb5a149d..0dca6fb4d 100644 --- a/telegram/forcereply.py +++ b/telegram/forcereply.py @@ -2,7 +2,7 @@ import json -from replymarkup import ReplyMarkup +from .replymarkup import ReplyMarkup class ForceReply(ReplyMarkup): diff --git a/telegram/replykeyboardhide.py b/telegram/replykeyboardhide.py index 2f4830e5d..bba71149b 100644 --- a/telegram/replykeyboardhide.py +++ b/telegram/replykeyboardhide.py @@ -2,7 +2,7 @@ import json -from replymarkup import ReplyMarkup +from .replymarkup import ReplyMarkup class ReplyKeyboardHide(ReplyMarkup): diff --git a/telegram/replykeyboardmarkup.py b/telegram/replykeyboardmarkup.py index b217fb5d6..e3c273c00 100644 --- a/telegram/replykeyboardmarkup.py +++ b/telegram/replykeyboardmarkup.py @@ -2,7 +2,7 @@ import json -from replymarkup import ReplyMarkup +from .replymarkup import ReplyMarkup class ReplyKeyboardMarkup(ReplyMarkup):