X Tutup
Skip to content

Commit 5b8efe0

Browse files
committed
upgrade yapf to ver 0.12.2
1 parent d07a1c3 commit 5b8efe0

37 files changed

+153
-132
lines changed

telegram/bot.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -682,11 +682,13 @@ def sendVenue(self, chat_id, latitude, longitude, title, address, foursquare_id=
682682

683683
url = '{0}/sendVenue'.format(self.base_url)
684684

685-
data = {'chat_id': chat_id,
686-
'latitude': latitude,
687-
'longitude': longitude,
688-
'address': address,
689-
'title': title}
685+
data = {
686+
'chat_id': chat_id,
687+
'latitude': latitude,
688+
'longitude': longitude,
689+
'address': address,
690+
'title': title
691+
}
690692

691693
if foursquare_id:
692694
data['foursquare_id'] = foursquare_id

telegram/game.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,5 +140,7 @@ def parse_text_entities(self, types=None):
140140
if types is None:
141141
types = MessageEntity.ALL_TYPES
142142

143-
return {entity: self.parse_text_entity(entity)
144-
for entity in self.text_entities if entity.type in types}
143+
return {
144+
entity: self.parse_text_entity(entity)
145+
for entity in self.text_entities if entity.type in types
146+
}

telegram/inlinekeyboardmarkup.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,10 @@ def de_json(data, bot):
5252
if not data:
5353
return None
5454

55-
data['inline_keyboard'] = [InlineKeyboardButton.de_list(inline_keyboard, bot)
56-
for inline_keyboard in data['inline_keyboard']]
55+
data['inline_keyboard'] = [
56+
InlineKeyboardButton.de_list(inline_keyboard, bot)
57+
for inline_keyboard in data['inline_keyboard']
58+
]
5759

5860
return InlineKeyboardMarkup(**data)
5961

telegram/message.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -465,5 +465,7 @@ def parse_entities(self, types=None):
465465
if types is None:
466466
types = MessageEntity.ALL_TYPES
467467

468-
return {entity: self.parse_entity(entity)
469-
for entity in self.entities if entity.type in types}
468+
return {
469+
entity: self.parse_entity(entity)
470+
for entity in self.entities if entity.type in types
471+
}

telegram/messageentity.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,5 +80,6 @@ def de_list(data, bot):
8080
PRE = 'pre'
8181
TEXT_LINK = 'text_link'
8282
TEXT_MENTION = 'text_mention'
83-
ALL_TYPES = [MENTION, HASHTAG, BOT_COMMAND, URL, EMAIL, BOLD, ITALIC, CODE, PRE, TEXT_LINK,
84-
TEXT_MENTION]
83+
ALL_TYPES = [
84+
MENTION, HASHTAG, BOT_COMMAND, URL, EMAIL, BOLD, ITALIC, CODE, PRE, TEXT_LINK, TEXT_MENTION
85+
]

tests/test_chat.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,12 @@ def setUp(self):
3838
self.type = 'group'
3939
self.all_members_are_admins = False
4040

41-
self.json_dict = {'id': self.id,
42-
'title': self.title,
43-
'type': self.type,
44-
'all_members_are_admins': self.all_members_are_admins}
41+
self.json_dict = {
42+
'id': self.id,
43+
'title': self.title,
44+
'type': self.type,
45+
'all_members_are_admins': self.all_members_are_admins
46+
}
4547

4648
def test_group_chat_de_json_empty_json(self):
4749
group_chat = telegram.Chat.de_json({}, self._bot)

tests/test_conversationhandler.py

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,14 +66,17 @@ class ConversationHandlerTest(BaseTest, unittest.TestCase):
6666
def setUp(self):
6767
self.current_state = dict()
6868
self.entry_points = [CommandHandler('start', self.start)]
69-
self.states = {self.THIRSTY: [CommandHandler('brew', self.brew),
70-
CommandHandler('wait', self.start)],
71-
self.BREWING: [CommandHandler('pourCoffee', self.drink)],
72-
self.DRINKING: [CommandHandler('startCoding', self.code),
73-
CommandHandler('drinkMore', self.drink)],
74-
self.CODING: [CommandHandler('keepCoding', self.code),
75-
CommandHandler('gettingThirsty', self.start),
76-
CommandHandler('drinkMore', self.drink)],}
69+
self.states = {
70+
self.THIRSTY: [CommandHandler('brew', self.brew), CommandHandler('wait', self.start)],
71+
self.BREWING: [CommandHandler('pourCoffee', self.drink)],
72+
self.DRINKING:
73+
[CommandHandler('startCoding', self.code), CommandHandler('drinkMore', self.drink)],
74+
self.CODING: [
75+
CommandHandler('keepCoding', self.code),
76+
CommandHandler('gettingThirsty', self.start),
77+
CommandHandler('drinkMore', self.drink)
78+
],
79+
}
7780
self.fallbacks = [CommandHandler('eat', self.start)]
7881

7982
def _setup_updater(self, *args, **kwargs):

tests/test_document.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,10 +37,12 @@ def setUp(self):
3737
self.document_file = open('tests/data/telegram.png', 'rb')
3838
self.document_file_id = 'BQADAQADpAADHyP1B04ipZxJTe2BAg'
3939
self.document_file_url = 'https://raw.githubusercontent.com/python-telegram-bot/python-telegram-bot/master/tests/data/telegram.gif'
40-
self.thumb = {'width': 90,
41-
'height': 90,
42-
'file_id': 'BQADAQADoQADHyP1B0mzJMVyzcB0Ag',
43-
'file_size': 2364}
40+
self.thumb = {
41+
'width': 90,
42+
'height': 90,
43+
'file_id': 'BQADAQADoQADHyP1B0mzJMVyzcB0Ag',
44+
'file_size': 2364
45+
}
4446
self.file_name = 'telegram.png'
4547
self.mime_type = 'image/png'
4648
self.file_size = 12948

tests/test_forcereply.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ def setUp(self):
3535
self.force_reply = True
3636
self.selective = True
3737

38-
self.json_dict = {'force_reply': self.force_reply,
39-
'selective': self.selective,}
38+
self.json_dict = {
39+
'force_reply': self.force_reply,
40+
'selective': self.selective,
41+
}
4042

4143
def test_send_message_with_force_reply(self):
4244
message = self._bot.sendMessage(

tests/test_game.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -96,8 +96,9 @@ def test_parse_entities(self):
9696
self.title, self.description, self.photo, text=text, text_entities=[entity_2, entity])
9797
self.assertDictEqual(
9898
game.parse_text_entities(telegram.MessageEntity.URL), {entity: 'http://google.com'})
99-
self.assertDictEqual(game.parse_text_entities(), {entity: 'http://google.com',
100-
entity_2: 'h'})
99+
self.assertDictEqual(game.parse_text_entities(),
100+
{entity: 'http://google.com',
101+
entity_2: 'h'})
101102

102103

103104
class AnimationTest(BaseTest, unittest.TestCase):

0 commit comments

Comments
 (0)
X Tutup