From 49122d6a9912fe47477c6635cdef350f8158e65f Mon Sep 17 00:00:00 2001 From: Leandro Toledo Date: Sat, 14 May 2016 23:26:56 -0300 Subject: [PATCH] Remove \ from base code #259 --- .pre-commit-config.yaml | 3 +- telegram/bot.py | 10 ++--- telegram/emoji.py | 42 ++++++++++----------- telegram/inlinekeyboardmarkup.py | 5 +-- telegram/inlinequeryresultarticle.py | 3 +- telegram/inlinequeryresultaudio.py | 3 +- telegram/inlinequeryresultcachedaudio.py | 3 +- telegram/inlinequeryresultcacheddocument.py | 3 +- telegram/inlinequeryresultcachedgif.py | 3 +- telegram/inlinequeryresultcachedmpeg4gif.py | 3 +- telegram/inlinequeryresultcachedphoto.py | 3 +- telegram/inlinequeryresultcachedsticker.py | 3 +- telegram/inlinequeryresultcachedvideo.py | 3 +- telegram/inlinequeryresultcachedvoice.py | 3 +- telegram/inlinequeryresultcontact.py | 3 +- telegram/inlinequeryresultdocument.py | 3 +- telegram/inlinequeryresultgif.py | 3 +- telegram/inlinequeryresultlocation.py | 3 +- telegram/inlinequeryresultmpeg4gif.py | 3 +- telegram/inlinequeryresultphoto.py | 3 +- telegram/inlinequeryresultvenue.py | 3 +- telegram/inlinequeryresultvideo.py | 3 +- telegram/inlinequeryresultvoice.py | 3 +- telegram/inputfile.py | 3 +- telegram/message.py | 3 +- telegram/update.py | 6 +-- 26 files changed, 52 insertions(+), 77 deletions(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9d0a4a4a4..02302b82d 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -2,6 +2,7 @@ sha: 'v0.7.1' hooks: - id: yapf + args: ['-i'] - repo: git://github.com/pre-commit/pre-commit-hooks sha: 'v0.5.0' @@ -13,4 +14,4 @@ sha: 'v1.5.5' hooks: - id: pylint - args: ['--errors-only', '--disable=no-name-in-module,import-error', 'telegram'] \ No newline at end of file + args: ['--errors-only', '--disable=no-name-in-module,import-error', 'telegram'] diff --git a/telegram/bot.py b/telegram/bot.py index cfd86ccd8..3147f2e37 100644 --- a/telegram/bot.py +++ b/telegram/bot.py @@ -22,8 +22,8 @@ import logging import functools -from telegram import User, Message, Update, UserProfilePhotos, File, \ - ReplyMarkup, TelegramObject, NullHandler +from telegram import (User, Message, Update, UserProfilePhotos, File, ReplyMarkup, TelegramObject, + NullHandler) from telegram.utils import request from telegram.utils.validate import validate_token @@ -120,12 +120,10 @@ class Bot(TelegramObject): url, data = func(self, *args, **kwargs) if kwargs.get('reply_to_message_id'): - data['reply_to_message_id'] = \ - kwargs.get('reply_to_message_id') + data['reply_to_message_id'] = kwargs.get('reply_to_message_id') if kwargs.get('disable_notification'): - data['disable_notification'] = \ - kwargs.get('disable_notification') + data['disable_notification'] = kwargs.get('disable_notification') if kwargs.get('reply_markup'): reply_markup = kwargs.get('reply_markup') diff --git a/telegram/emoji.py b/telegram/emoji.py index 1969c2198..c3dff9aea 100644 --- a/telegram/emoji.py +++ b/telegram/emoji.py @@ -1,6 +1,6 @@ #!/usr/bin/env python # flake8: noqa -# pylint: disable=C0103,C0301,R0903 +# pylint: disable=C0103,R0903 # # A library that provides a Python interface to the Telegram Bot API # Copyright (C) 2015-2016 @@ -162,26 +162,26 @@ class Emoji(object): SQUARED_SOS = n(b'\xF0\x9F\x86\x98') SQUARED_UP_WITH_EXCLAMATION_MARK = n(b'\xF0\x9F\x86\x99') SQUARED_VS = n(b'\xF0\x9F\x86\x9A') - REGIONAL_INDICATOR_SYMBOL_LETTER_D_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_E \ - = n(b'\xF0\x9F\x87\xA9\xF0\x9F\x87\xAA') - REGIONAL_INDICATOR_SYMBOL_LETTER_G_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_B \ - = n(b'\xF0\x9F\x87\xAC\xF0\x9F\x87\xA7') - REGIONAL_INDICATOR_SYMBOL_LETTER_C_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_N \ - = n(b'\xF0\x9F\x87\xA8\xF0\x9F\x87\xB3') - REGIONAL_INDICATOR_SYMBOL_LETTER_J_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_P \ - = n(b'\xF0\x9F\x87\xAF\xF0\x9F\x87\xB5') - REGIONAL_INDICATOR_SYMBOL_LETTER_K_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_R \ - = n(b'\xF0\x9F\x87\xB0\xF0\x9F\x87\xB7') - REGIONAL_INDICATOR_SYMBOL_LETTER_F_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_R \ - = n(b'\xF0\x9F\x87\xAB\xF0\x9F\x87\xB7') - REGIONAL_INDICATOR_SYMBOL_LETTER_E_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_S \ - = n(b'\xF0\x9F\x87\xAA\xF0\x9F\x87\xB8') - REGIONAL_INDICATOR_SYMBOL_LETTER_I_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_T \ - = n(b'\xF0\x9F\x87\xAE\xF0\x9F\x87\xB9') - REGIONAL_INDICATOR_SYMBOL_LETTER_U_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_S \ - = n(b'\xF0\x9F\x87\xBA\xF0\x9F\x87\xB8') - REGIONAL_INDICATOR_SYMBOL_LETTER_R_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_U \ - = n(b'\xF0\x9F\x87\xB7\xF0\x9F\x87\xBA') + REGIONAL_INDICATOR_SYMBOL_LETTER_D_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_E = n( + b'\xF0\x9F\x87\xA9\xF0\x9F\x87\xAA') + REGIONAL_INDICATOR_SYMBOL_LETTER_G_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_B = n( + b'\xF0\x9F\x87\xAC\xF0\x9F\x87\xA7') + REGIONAL_INDICATOR_SYMBOL_LETTER_C_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_N = n( + b'\xF0\x9F\x87\xA8\xF0\x9F\x87\xB3') + REGIONAL_INDICATOR_SYMBOL_LETTER_J_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_P = n( + b'\xF0\x9F\x87\xAF\xF0\x9F\x87\xB5') + REGIONAL_INDICATOR_SYMBOL_LETTER_K_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_R = n( + b'\xF0\x9F\x87\xB0\xF0\x9F\x87\xB7') + REGIONAL_INDICATOR_SYMBOL_LETTER_F_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_R = n( + b'\xF0\x9F\x87\xAB\xF0\x9F\x87\xB7') + REGIONAL_INDICATOR_SYMBOL_LETTER_E_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_S = n( + b'\xF0\x9F\x87\xAA\xF0\x9F\x87\xB8') + REGIONAL_INDICATOR_SYMBOL_LETTER_I_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_T = n( + b'\xF0\x9F\x87\xAE\xF0\x9F\x87\xB9') + REGIONAL_INDICATOR_SYMBOL_LETTER_U_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_S = n( + b'\xF0\x9F\x87\xBA\xF0\x9F\x87\xB8') + REGIONAL_INDICATOR_SYMBOL_LETTER_R_PLUS_REGIONAL_INDICATOR_SYMBOL_LETTER_U = n( + b'\xF0\x9F\x87\xB7\xF0\x9F\x87\xBA') SQUARED_KATAKANA_KOKO = n(b'\xF0\x9F\x88\x81') SQUARED_KATAKANA_SA = n(b'\xF0\x9F\x88\x82') SQUARED_CJK_UNIFIED_IDEOGRAPH_7121 = n(b'\xF0\x9F\x88\x9A') diff --git a/telegram/inlinekeyboardmarkup.py b/telegram/inlinekeyboardmarkup.py index 7df6a46c5..fadef209d 100644 --- a/telegram/inlinekeyboardmarkup.py +++ b/telegram/inlinekeyboardmarkup.py @@ -44,9 +44,8 @@ class InlineKeyboardMarkup(ReplyMarkup): if not data: return None - data['inline_keyboard'] = \ - [InlineKeyboardButton.de_list(inline_keyboard) for inline_keyboard - in data['inline_keyboard']] + data['inline_keyboard'] = [InlineKeyboardButton.de_list(inline_keyboard) + for inline_keyboard in data['inline_keyboard']] return InlineKeyboardMarkup(**data) diff --git a/telegram/inlinequeryresultarticle.py b/telegram/inlinequeryresultarticle.py index bcb3251ac..b94f93059 100644 --- a/telegram/inlinequeryresultarticle.py +++ b/telegram/inlinequeryresultarticle.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultArticle""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultArticle(InlineQueryResult): diff --git a/telegram/inlinequeryresultaudio.py b/telegram/inlinequeryresultaudio.py index 94010287d..81c777336 100644 --- a/telegram/inlinequeryresultaudio.py +++ b/telegram/inlinequeryresultaudio.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultAudio""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultAudio(InlineQueryResult): diff --git a/telegram/inlinequeryresultcachedaudio.py b/telegram/inlinequeryresultcachedaudio.py index d779fa968..9f1c9b731 100644 --- a/telegram/inlinequeryresultcachedaudio.py +++ b/telegram/inlinequeryresultcachedaudio.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultCachedAudio""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultCachedAudio(InlineQueryResult): diff --git a/telegram/inlinequeryresultcacheddocument.py b/telegram/inlinequeryresultcacheddocument.py index 865bdd72f..fa11f9339 100644 --- a/telegram/inlinequeryresultcacheddocument.py +++ b/telegram/inlinequeryresultcacheddocument.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultCachedDocument""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultCachedDocument(InlineQueryResult): diff --git a/telegram/inlinequeryresultcachedgif.py b/telegram/inlinequeryresultcachedgif.py index 4a386edb0..9b0429b78 100644 --- a/telegram/inlinequeryresultcachedgif.py +++ b/telegram/inlinequeryresultcachedgif.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultCachedGif""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultCachedGif(InlineQueryResult): diff --git a/telegram/inlinequeryresultcachedmpeg4gif.py b/telegram/inlinequeryresultcachedmpeg4gif.py index 76e548822..fb3350658 100644 --- a/telegram/inlinequeryresultcachedmpeg4gif.py +++ b/telegram/inlinequeryresultcachedmpeg4gif.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultMpeg4Gif""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultCachedMpeg4Gif(InlineQueryResult): diff --git a/telegram/inlinequeryresultcachedphoto.py b/telegram/inlinequeryresultcachedphoto.py index 220b465b7..be04b8ef4 100644 --- a/telegram/inlinequeryresultcachedphoto.py +++ b/telegram/inlinequeryresultcachedphoto.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultPhoto""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultCachedPhoto(InlineQueryResult): diff --git a/telegram/inlinequeryresultcachedsticker.py b/telegram/inlinequeryresultcachedsticker.py index c8578686c..c6cc54c69 100644 --- a/telegram/inlinequeryresultcachedsticker.py +++ b/telegram/inlinequeryresultcachedsticker.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultCachedSticker""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultCachedSticker(InlineQueryResult): diff --git a/telegram/inlinequeryresultcachedvideo.py b/telegram/inlinequeryresultcachedvideo.py index 54a21ae59..060fa47b1 100644 --- a/telegram/inlinequeryresultcachedvideo.py +++ b/telegram/inlinequeryresultcachedvideo.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultCachedVideo""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultCachedVideo(InlineQueryResult): diff --git a/telegram/inlinequeryresultcachedvoice.py b/telegram/inlinequeryresultcachedvoice.py index 8f2029a24..11312b129 100644 --- a/telegram/inlinequeryresultcachedvoice.py +++ b/telegram/inlinequeryresultcachedvoice.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultCachedVoice""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultCachedVoice(InlineQueryResult): diff --git a/telegram/inlinequeryresultcontact.py b/telegram/inlinequeryresultcontact.py index 9306deca8..e475654c3 100644 --- a/telegram/inlinequeryresultcontact.py +++ b/telegram/inlinequeryresultcontact.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultContact""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultContact(InlineQueryResult): diff --git a/telegram/inlinequeryresultdocument.py b/telegram/inlinequeryresultdocument.py index 9bb3bc5ae..36f70ba61 100644 --- a/telegram/inlinequeryresultdocument.py +++ b/telegram/inlinequeryresultdocument.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultDocument""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultDocument(InlineQueryResult): diff --git a/telegram/inlinequeryresultgif.py b/telegram/inlinequeryresultgif.py index 93cd86be3..253880c3c 100644 --- a/telegram/inlinequeryresultgif.py +++ b/telegram/inlinequeryresultgif.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultGif""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultGif(InlineQueryResult): diff --git a/telegram/inlinequeryresultlocation.py b/telegram/inlinequeryresultlocation.py index 9c7d65891..00428285c 100644 --- a/telegram/inlinequeryresultlocation.py +++ b/telegram/inlinequeryresultlocation.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultLocation""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultLocation(InlineQueryResult): diff --git a/telegram/inlinequeryresultmpeg4gif.py b/telegram/inlinequeryresultmpeg4gif.py index 887421c69..8c331f31b 100644 --- a/telegram/inlinequeryresultmpeg4gif.py +++ b/telegram/inlinequeryresultmpeg4gif.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultMpeg4Gif""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultMpeg4Gif(InlineQueryResult): diff --git a/telegram/inlinequeryresultphoto.py b/telegram/inlinequeryresultphoto.py index 8bea7c0b8..7037d3d61 100644 --- a/telegram/inlinequeryresultphoto.py +++ b/telegram/inlinequeryresultphoto.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultPhoto""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultPhoto(InlineQueryResult): diff --git a/telegram/inlinequeryresultvenue.py b/telegram/inlinequeryresultvenue.py index 2d33fc751..13af862e1 100644 --- a/telegram/inlinequeryresultvenue.py +++ b/telegram/inlinequeryresultvenue.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultVenue""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultVenue(InlineQueryResult): diff --git a/telegram/inlinequeryresultvideo.py b/telegram/inlinequeryresultvideo.py index 07b0e4df9..f8efb03c4 100644 --- a/telegram/inlinequeryresultvideo.py +++ b/telegram/inlinequeryresultvideo.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultVideo""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultVideo(InlineQueryResult): diff --git a/telegram/inlinequeryresultvoice.py b/telegram/inlinequeryresultvoice.py index 8412ecfc7..fb3544bfc 100644 --- a/telegram/inlinequeryresultvoice.py +++ b/telegram/inlinequeryresultvoice.py @@ -19,8 +19,7 @@ """This module contains the classes that represent Telegram InlineQueryResultVoice""" -from telegram import InlineQueryResult, InlineKeyboardMarkup, \ - InputMessageContent +from telegram import InlineQueryResult, InlineKeyboardMarkup, InputMessageContent class InlineQueryResultVoice(InlineQueryResult): diff --git a/telegram/inputfile.py b/telegram/inputfile.py index 3112187ea..8c9276eb5 100644 --- a/telegram/inputfile.py +++ b/telegram/inputfile.py @@ -36,8 +36,7 @@ from future.moves.urllib.request import urlopen from telegram import TelegramError DEFAULT_MIME_TYPE = 'application/octet-stream' -USER_AGENT = 'Python Telegram Bot' \ - ' (https://github.com/python-telegram-bot/python-telegram-bot)' +USER_AGENT = 'Python Telegram Bot (https://github.com/python-telegram-bot/python-telegram-bot)' class InputFile(object): diff --git a/telegram/message.py b/telegram/message.py index e7886323e..2e2471ee3 100644 --- a/telegram/message.py +++ b/telegram/message.py @@ -161,8 +161,7 @@ class Message(TelegramObject): data['forward_from'] = User.de_json(data.get('forward_from')) data['forward_from_chat'] = Chat.de_json(data.get('forward_from_chat')) data['forward_date'] = Message._fromtimestamp(data.get('forward_date')) - data['reply_to_message'] = \ - Message.de_json(data.get('reply_to_message')) + data['reply_to_message'] = Message.de_json(data.get('reply_to_message')) data['audio'] = Audio.de_json(data.get('audio')) data['document'] = Document.de_json(data.get('document')) data['photo'] = PhotoSize.de_list(data.get('photo')) diff --git a/telegram/update.py b/telegram/update.py index 73cf7249b..17cc16603 100644 --- a/telegram/update.py +++ b/telegram/update.py @@ -65,9 +65,7 @@ class Update(TelegramObject): data['message'] = Message.de_json(data.get('message')) data['inline_query'] = InlineQuery.de_json(data.get('inline_query')) - data['chosen_inline_result'] = \ - ChosenInlineResult.de_json(data.get('chosen_inline_result')) - data['callback_query'] = \ - CallbackQuery.de_json(data.get('callback_query')) + data['chosen_inline_result'] = ChosenInlineResult.de_json(data.get('chosen_inline_result')) + data['callback_query'] = CallbackQuery.de_json(data.get('callback_query')) return Update(**data)