Skip to content

Commit 6f308e8

Browse files
committed
Making flake8 happy
1 parent 1216fa3 commit 6f308e8

File tree

7 files changed

+21
-14
lines changed

7 files changed

+21
-14
lines changed

telegram/ext/commandhandler.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,8 @@ def __init__(self,
114114

115115
self.pass_args = pass_args
116116
if self.autowire:
117-
self.set_autowired_flags({'update_queue', 'job_queue', 'user_data', 'chat_data', 'args'})
117+
self.set_autowired_flags(
118+
{'update_queue', 'job_queue', 'user_data', 'chat_data', 'args'})
118119

119120
if isinstance(command, string_types):
120121
self.command = [command.lower()]
@@ -140,8 +141,8 @@ def check_update(self, update):
140141
:obj:`bool`
141142
142143
"""
143-
if (isinstance(update, Update)
144-
and (update.message or update.edited_message and self.allow_edited)):
144+
if (isinstance(update, Update) and
145+
(update.message or update.edited_message and self.allow_edited)):
145146
message = update.message or update.edited_message
146147

147148
if message.text:

telegram/ext/handler.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,10 @@ class Handler(object):
2626
"""
2727
The base class for all update handlers. Create custom handlers by inheriting from it.
2828
29-
If your subclass needs the *autowiring* functionality, make sure to call ``set_autowired_flags``
30-
**after** initializing the ``pass_*`` members. The ``passable`` argument to this method denotes
31-
all the flags your Handler supports, e.g. ``{'update_queue', 'job_queue', 'args'}``.
29+
If your subclass needs the *autowiring* functionality, make sure to call
30+
``set_autowired_flags`` **after** initializing the ``pass_*`` members. The ``passable``
31+
argument to this method denotes all the flags your Handler supports, e.g.
32+
``{'update_queue', 'job_queue', 'args'}``.
3233
3334
Attributes:
3435
callback (:obj:`callable`): The callback function for this handler.
@@ -153,7 +154,8 @@ def __should_pass_obj(self, name):
153154
return False
154155
return is_requested
155156

156-
def set_autowired_flags(self, passable={'update_queue', 'job_queue', 'user_data', 'chat_data'}):
157+
def set_autowired_flags(self,
158+
passable={'update_queue', 'job_queue', 'user_data', 'chat_data'}):
157159
"""
158160
This method inspects the callback handler for used arguments. If it finds arguments that
159161
are ``passable``, i.e. types that can also be passed by the various ``pass_*`` flags,

telegram/ext/regexhandler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ def __init__(self,
138138
self.pass_groups = pass_groups
139139
self.pass_groupdict = pass_groupdict
140140
if self.autowire:
141-
self.set_autowired_flags({'groups', 'groupdict', 'update_queue', 'job_queue', 'user_data', 'chat_data'})
141+
self.set_autowired_flags(
142+
{'groups', 'groupdict', 'update_queue', 'job_queue', 'user_data', 'chat_data'})
142143
self.allow_edited = allow_edited
143144
self.message_updates = message_updates
144145
self.channel_post_updates = channel_post_updates

tests/test_callbackqueryhandler.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,6 @@ def test_autowire(self, dp, callback_query):
195195
dp.process_update(callback_query)
196196
assert self.test_flag
197197

198-
199198
def test_other_update_types(self, false_update):
200199
handler = CallbackQueryHandler(self.callback_basic)
201200
assert not handler.check_update(false_update)

tests/test_handler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121

2222
from telegram.ext import Handler
2323

24+
2425
class TestHandler(object):
2526
test_flag = False
2627

@@ -117,5 +118,6 @@ def test_get_available_pass_flags(self):
117118

118119
handler.set_autowired_flags()
119120

120-
assert set(handler._get_available_pass_flags()) == {'pass_update_queue', 'pass_job_queue', 'pass_chat_data',
121+
assert set(handler._get_available_pass_flags()) == {'pass_update_queue', 'pass_job_queue',
122+
'pass_chat_data',
121123
'pass_user_data'}

tests/test_precheckoutqueryhandler.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,8 @@ def false_update(request):
4949

5050
@pytest.fixture(scope='class')
5151
def pre_checkout_query():
52-
return Update(1, pre_checkout_query=PreCheckoutQuery('id', User(1, 'test user', False), 'EUR', 223,
52+
return Update(1, pre_checkout_query=PreCheckoutQuery('id', User(1, 'test user', False), 'EUR',
53+
223,
5354
'invoice_payload'))
5455

5556

tests/test_shippingqueryhandler.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,9 +49,10 @@ def false_update(request):
4949

5050
@pytest.fixture(scope='class')
5151
def shiping_query():
52-
return Update(1, shipping_query=ShippingQuery(42, User(1, 'test user', False), 'invoice_payload',
53-
ShippingAddress('EN', 'my_state', 'my_city',
54-
'steer_1', '', 'post_code')))
52+
return Update(1,
53+
shipping_query=ShippingQuery(42, User(1, 'test user', False), 'invoice_payload',
54+
ShippingAddress('EN', 'my_state', 'my_city',
55+
'steer_1', '', 'post_code')))
5556

5657

5758
class TestShippingQueryHandler(object):

0 commit comments

Comments
 (0)