From c8b2b1415745abc5278749dfc42e059bd65f332b Mon Sep 17 00:00:00 2001 From: users Date: Mon, 2 Jul 2018 18:13:11 +0300 Subject: [PATCH 1/4] rename async -> async_dec --- telebot/__init__.py | 114 ++++++++++++++++++++++---------------------- telebot/util.py | 2 +- 2 files changed, 58 insertions(+), 58 deletions(-) diff --git a/telebot/__init__.py b/telebot/__init__.py index 32ed84d..fb7770b 100644 --- a/telebot/__init__.py +++ b/telebot/__init__.py @@ -1354,230 +1354,230 @@ class AsyncTeleBot(TeleBot): def __init__(self, *args, **kwargs): TeleBot.__init__(self, *args, **kwargs) - @util.async() + @util.async_dec() def get_me(self): return TeleBot.get_me(self) - @util.async() + @util.async_dec() def get_file(self, *args): return TeleBot.get_file(self, *args) - @util.async() + @util.async_dec() def download_file(self, *args): return TeleBot.download_file(self, *args) - @util.async() + @util.async_dec() def get_user_profile_photos(self, *args, **kwargs): return TeleBot.get_user_profile_photos(self, *args, **kwargs) - @util.async() + @util.async_dec() def get_chat(self, *args): return TeleBot.get_chat(self, *args) - @util.async() + @util.async_dec() def leave_chat(self, *args): return TeleBot.leave_chat(self, *args) - @util.async() + @util.async_dec() def get_chat_administrators(self, *args): return TeleBot.get_chat_administrators(self, *args) - @util.async() + @util.async_dec() def get_chat_members_count(self, *args): return TeleBot.get_chat_members_count(self, *args) - @util.async() + @util.async_dec() def set_chat_sticker_set(self, *args): return TeleBot.set_chat_sticker_set(self, *args) - @util.async() + @util.async_dec() def delete_chat_sticker_set(self, *args): return TeleBot.delete_chat_sticker_set(self, *args) - @util.async() + @util.async_dec() def get_chat_member(self, *args): return TeleBot.get_chat_member(self, *args) - @util.async() + @util.async_dec() def send_message(self, *args, **kwargs): return TeleBot.send_message(self, *args, **kwargs) - @util.async() + @util.async_dec() def forward_message(self, *args, **kwargs): return TeleBot.forward_message(self, *args, **kwargs) - @util.async() + @util.async_dec() def delete_message(self, *args): return TeleBot.delete_message(self, *args) - @util.async() + @util.async_dec() def send_photo(self, *args, **kwargs): return TeleBot.send_photo(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_audio(self, *args, **kwargs): return TeleBot.send_audio(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_voice(self, *args, **kwargs): return TeleBot.send_voice(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_document(self, *args, **kwargs): return TeleBot.send_document(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_sticker(self, *args, **kwargs): return TeleBot.send_sticker(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_video(self, *args, **kwargs): return TeleBot.send_video(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_video_note(self, *args, **kwargs): return TeleBot.send_video_note(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_media_group(self, *args, **kwargs): return TeleBot.send_media_group(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_location(self, *args, **kwargs): return TeleBot.send_location(self, *args, **kwargs) - @util.async() + @util.async_dec() def edit_message_live_location(self, *args, **kwargs): return TeleBot.edit_message_live_location(self, *args, **kwargs) - @util.async() + @util.async_dec() def stop_message_live_location(self, *args, **kwargs): return TeleBot.stop_message_live_location(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_venue(self, *args, **kwargs): return TeleBot.send_venue(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_contact(self, *args, **kwargs): return TeleBot.send_contact(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_chat_action(self, *args, **kwargs): return TeleBot.send_chat_action(self, *args, **kwargs) - @util.async() + @util.async_dec() def kick_chat_member(self, *args, **kwargs): return TeleBot.kick_chat_member(self, *args, **kwargs) - @util.async() + @util.async_dec() def unban_chat_member(self, *args): return TeleBot.unban_chat_member(self, *args) - @util.async() + @util.async_dec() def restrict_chat_member(self, *args, **kwargs): return TeleBot.restrict_chat_member(self, *args, **kwargs) - @util.async() + @util.async_dec() def promote_chat_member(self, *args, **kwargs): return TeleBot.promote_chat_member(self, *args, **kwargs) - @util.async() + @util.async_dec() def export_chat_invite_link(self, *args): return TeleBot.export_chat_invite_link(self, *args) - @util.async() + @util.async_dec() def set_chat_photo(self, *args): return TeleBot.set_chat_photo(self, *args) - @util.async() + @util.async_dec() def delete_chat_photo(self, *args): return TeleBot.delete_chat_photo(self, *args) - @util.async() + @util.async_dec() def set_chat_title(self, *args): return TeleBot.set_chat_title(self, *args) - @util.async() + @util.async_dec() def set_chat_description(self, *args): return TeleBot.set_chat_description(self, *args) - @util.async() + @util.async_dec() def pin_chat_message(self, *args, **kwargs): return TeleBot.pin_chat_message(self, *args, **kwargs) - @util.async() + @util.async_dec() def unpin_chat_message(self, *args): return TeleBot.unpin_chat_message(self, *args) - @util.async() + @util.async_dec() def edit_message_text(self, *args, **kwargs): return TeleBot.edit_message_text(self, *args, **kwargs) - @util.async() + @util.async_dec() def edit_message_reply_markup(self, *args, **kwargs): return TeleBot.edit_message_reply_markup(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_game(self, *args, **kwargs): return TeleBot.send_game(self, *args, **kwargs) - @util.async() + @util.async_dec() def set_game_score(self, *args, **kwargs): return TeleBot.set_game_score(self, *args, **kwargs) - @util.async() + @util.async_dec() def get_game_high_scores(self, *args, **kwargs): return TeleBot.get_game_high_scores(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_invoice(self, *args, **kwargs): return TeleBot.send_invoice(self, *args, **kwargs) - @util.async() + @util.async_dec() def answer_shipping_query(self, *args, **kwargs): return TeleBot.answer_shipping_query(self, *args, **kwargs) - @util.async() + @util.async_dec() def answer_pre_checkout_query(self, *args, **kwargs): return TeleBot.answer_pre_checkout_query(self, *args, **kwargs) - @util.async() + @util.async_dec() def edit_message_caption(self, *args, **kwargs): return TeleBot.edit_message_caption(self, *args, **kwargs) - @util.async() + @util.async_dec() def answer_inline_query(self, *args, **kwargs): return TeleBot.answer_inline_query(self, *args, **kwargs) - @util.async() + @util.async_dec() def answer_callback_query(self, *args, **kwargs): return TeleBot.answer_callback_query(self, *args, **kwargs) - @util.async() + @util.async_dec() def send_sticker(self, *args, **kwargs): return TeleBot.send_sticker(self, *args, **kwargs) - @util.async() + @util.async_dec() def get_sticker_set(self, *args, **kwargs): return TeleBot.get_sticker_set(self, *args, **kwargs) - @util.async() + @util.async_dec() def upload_sticker_file(self, *args, **kwargs): return TeleBot.upload_sticker_file(self, *args, **kwargs) - @util.async() + @util.async_dec() def create_new_sticker_set(self, *args, **kwargs): return TeleBot.create_new_sticker_set(self, *args, **kwargs) - @util.async() + @util.async_dec() def add_sticker_to_set(self, *args, **kwargs): return TeleBot.add_sticker_to_set(self, *args, **kwargs) - @util.async() + @util.async_dec() def set_sticker_position_in_set(self, *args, **kwargs): return TeleBot.set_sticker_position_in_set(self, *args, **kwargs) - @util.async() + @util.async_dec() def delete_sticker_from_set(self, *args, **kwargs): return TeleBot.delete_sticker_from_set(self, *args, **kwargs) diff --git a/telebot/util.py b/telebot/util.py index 769f73b..f448d78 100644 --- a/telebot/util.py +++ b/telebot/util.py @@ -143,7 +143,7 @@ class AsyncTask: return self.result -def async(): +def async_dec(): def decorator(fn): def wrapper(*args, **kwargs): return AsyncTask(fn, *args, **kwargs) From 9547a8d7b1dbf9934f44b765d9ec587c41c1d0cc Mon Sep 17 00:00:00 2001 From: user Date: Mon, 2 Jul 2018 23:23:48 +0300 Subject: [PATCH 2/4] test python 3.7 --- .travis.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.travis.yml b/.travis.yml index f5f202a..312da5f 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,6 +6,7 @@ python: - "3.4" - "3.5" - "3.6" + - "3.7" - "pypy" - "pypy3" install: "pip install -r requirements.txt" From 4079772fd3e0186bfea516490c8bd92189d79837 Mon Sep 17 00:00:00 2001 From: user Date: Mon, 2 Jul 2018 23:29:07 +0300 Subject: [PATCH 3/4] Update .travis.yml --- .travis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 312da5f..693456c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,7 @@ python: - "3.4" - "3.5" - "3.6" - - "3.7" + - "3.7-dev" - "pypy" - "pypy3" install: "pip install -r requirements.txt" From c3b6ee9dc0757b51234df87e9372f93d5a7b8c75 Mon Sep 17 00:00:00 2001 From: user Date: Mon, 2 Jul 2018 23:41:37 +0300 Subject: [PATCH 4/4] bug in travis-ci --- .travis.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.travis.yml b/.travis.yml index 693456c..f5f202a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,7 +6,6 @@ python: - "3.4" - "3.5" - "3.6" - - "3.7-dev" - "pypy" - "pypy3" install: "pip install -r requirements.txt"