GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — flake8 revamp · saintbyte/python-telegram-bot@baec1bb

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • .pre-commit-config.yaml
  • examples
    • inlinebot.py
  • telegram/ext
    • jobqueue.py
  • tests
    • test_bot.py
    • test_constants.py
    • test_conversationhandler.py
    • test_dispatcher.py
    • test_inlinekeyboardbutton.py
    • test_inlinequeryresultarticle.py
    • test_inlinequeryresultaudio.py
    • test_inlinequeryresultcachedaudio.py
    • test_inlinequeryresultcacheddocument.py
    • test_inlinequeryresultcachedgif.py
    • test_inlinequeryresultcachedmpeg4gif.py
    • test_inlinequeryresultcachedphoto.py
    • test_inlinequeryresultcachedsticker.py
    • test_inlinequeryresultcachedvideo.py
    • test_inlinequeryresultcachedvoice.py
    • test_inlinequeryresultcontact.py
    • test_inlinequeryresultdocument.py
    • test_inlinequeryresultgame.py
    • test_inlinequeryresultgif.py
    • test_inlinequeryresultlocation.py
    • test_inlinequeryresultmpeg4gif.py
    • test_inlinequeryresultphoto.py
    • test_inlinequeryresultvenue.py
    • test_inlinequeryresultvideo.py
    • test_inlinequeryresultvoice.py
    • test_inputcontactmessagecontent.py
    • test_inputlocationmessagecontent.py
    • test_inputmedia.py
    • test_inputtextmessagecontent.py
    • test_inputvenuemessagecontent.py
    • test_invoice.py
    • test_messagehandler.py
    • test_official.py
    • test_precheckoutquery.py
    • test_precheckoutqueryhandler.py
    • test_regexhandler.py
    • test_replykeyboardmarkup.py
    • test_replykeyboardremove.py
    • test_shippingqueryhandler.py
    • test_successfulpayment.py
    • test_updater.py

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎.pre-commit-config.yaml‎

Copy file name to clipboardExpand all lines: .pre-commit-config.yaml
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@
66
args:
77
- --diff
88
- repo: git://github.com/pre-commit/pre-commit-hooks
9-
sha: 78818b90cd694c29333ba54d38f9e60b6359ccfc
9+
sha: v1.2.0
1010
hooks:
1111
- id: flake8
12-
files: ^telegram/.*\.py$
12+
exclude: ^(setup.py|docs/source/conf.py)$
1313
- repo: git://github.com/pre-commit/mirrors-pylint
1414
sha: v1.7.1
1515
hooks:
Collapse file

‎examples/inlinebot.py‎

Copy file name to clipboardExpand all lines: examples/inlinebot.py
-2Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,6 @@
1818
"""
1919
from uuid import uuid4
2020

21-
import re
22-
2321
from telegram.utils.helpers import escape_markdown
2422

2523
from telegram import InlineQueryResultArticle, ParseMode, \
Collapse file

‎telegram/ext/jobqueue.py‎

Copy file name to clipboardExpand all lines: telegram/ext/jobqueue.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,7 +283,7 @@ def tick(self):
283283
self.logger.debug('Running job %s', job.name)
284284
job.run(self.bot)
285285

286-
except:
286+
except Exception:
287287
self.logger.exception('An uncaught error was raised while executing job %s',
288288
job.name)
289289
else:
Collapse file

‎tests/test_bot.py‎

Copy file name to clipboardExpand all lines: tests/test_bot.py
+1-2Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
# along with this program. If not, see [http://www.gnu.org/licenses/].
1919
import os
2020
import time
21-
from datetime import datetime, timedelta
21+
from datetime import datetime
2222
from platform import python_implementation
2323

2424
import pytest
@@ -552,7 +552,6 @@ def test_answer_pre_checkout_query_errors(self, monkeypatch, bot):
552552
def test_restrict_chat_member(self, bot, channel_id):
553553
# TODO: Add bot to supergroup so this can be tested properly
554554
with pytest.raises(BadRequest, match='Method is available only for supergroups'):
555-
until = datetime.now() + timedelta(seconds=30)
556555
assert bot.restrict_chat_member(channel_id,
557556
95205500,
558557
until_date=datetime.now(),
Collapse file

‎tests/test_constants.py‎

Copy file name to clipboardExpand all lines: tests/test_constants.py
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@ def test_max_caption_length(self, bot, chat_id):
4444
bad_caption = good_caption + 'Z'
4545
with pytest.raises(BadRequest, message="Media_caption_too_long"):
4646
with open('tests/data/telegram.png', 'rb') as f:
47-
bad_message = bot.send_photo(photo=f, caption=bad_caption, chat_id=chat_id)
47+
bot.send_photo(photo=f, caption=bad_caption, chat_id=chat_id)
Collapse file

‎tests/test_conversationhandler.py‎

Copy file name to clipboardExpand all lines: tests/test_conversationhandler.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,8 @@ def code(self, bot, update):
8888
# Tests
8989
def test_per_all_false(self):
9090
with pytest.raises(ValueError, match="can't all be 'False'"):
91-
handler = ConversationHandler(self.entry_points, self.states, self.fallbacks,
92-
per_chat=False, per_user=False, per_message=False)
91+
ConversationHandler(self.entry_points, self.states, self.fallbacks,
92+
per_chat=False, per_user=False, per_message=False)
9393

9494
def test_conversation_handler(self, dp, bot, user1, user2):
9595
handler = ConversationHandler(entry_points=self.entry_points, states=self.states,
Collapse file

‎tests/test_dispatcher.py‎

Copy file name to clipboardExpand all lines: tests/test_dispatcher.py
+2-1Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ def dp2(bot):
3535

3636

3737
class TestDispatcher(object):
38-
message_update = Update(1, message=Message(1, User(1, '', False), None, Chat(1, ''), text='Text'))
38+
message_update = Update(1,
39+
message=Message(1, User(1, '', False), None, Chat(1, ''), text='Text'))
3940
received = None
4041
count = 0
4142

Collapse file

‎tests/test_inlinekeyboardbutton.py‎

Copy file name to clipboardExpand all lines: tests/test_inlinekeyboardbutton.py
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ def test_expected_values(self, inline_keyboard_button):
4848
assert inline_keyboard_button.url == self.url
4949
assert inline_keyboard_button.callback_data == self.callback_data
5050
assert inline_keyboard_button.switch_inline_query == self.switch_inline_query
51-
assert inline_keyboard_button.switch_inline_query_current_chat == \
52-
self.switch_inline_query_current_chat
51+
assert (inline_keyboard_button.switch_inline_query_current_chat ==
52+
self.switch_inline_query_current_chat)
5353
assert inline_keyboard_button.callback_game == self.callback_game
5454
assert inline_keyboard_button.pay == self.pay
5555

@@ -60,9 +60,9 @@ def test_to_dict(self, inline_keyboard_button):
6060
assert inline_keyboard_button_dict['text'] == inline_keyboard_button.text
6161
assert inline_keyboard_button_dict['url'] == inline_keyboard_button.url
6262
assert inline_keyboard_button_dict['callback_data'] == inline_keyboard_button.callback_data
63-
assert inline_keyboard_button_dict['switch_inline_query'] == \
64-
inline_keyboard_button.switch_inline_query
65-
assert inline_keyboard_button_dict['switch_inline_query_current_chat'] == \
66-
inline_keyboard_button.switch_inline_query_current_chat
63+
assert (inline_keyboard_button_dict['switch_inline_query'] ==
64+
inline_keyboard_button.switch_inline_query)
65+
assert (inline_keyboard_button_dict['switch_inline_query_current_chat'] ==
66+
inline_keyboard_button.switch_inline_query_current_chat)
6767
assert inline_keyboard_button_dict['callback_game'] == inline_keyboard_button.callback_game
6868
assert inline_keyboard_button_dict['pay'] == inline_keyboard_button.pay
Collapse file

‎tests/test_inlinequeryresultarticle.py‎

Copy file name to clipboardExpand all lines: tests/test_inlinequeryresultarticle.py
+25-24Lines changed: 25 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,17 @@
2525

2626
@pytest.fixture(scope='class')
2727
def inline_query_result_article():
28-
return InlineQueryResultArticle(TestInlineQueryResultArticle.id,
29-
TestInlineQueryResultArticle.title,
30-
input_message_content=TestInlineQueryResultArticle.input_message_content,
31-
reply_markup=TestInlineQueryResultArticle.reply_markup,
32-
url=TestInlineQueryResultArticle.url,
33-
hide_url=TestInlineQueryResultArticle.hide_url,
34-
description=TestInlineQueryResultArticle.description,
35-
thumb_url=TestInlineQueryResultArticle.thumb_url,
36-
thumb_height=TestInlineQueryResultArticle.thumb_height,
37-
thumb_width=TestInlineQueryResultArticle.thumb_width)
28+
return InlineQueryResultArticle(
29+
TestInlineQueryResultArticle.id,
30+
TestInlineQueryResultArticle.title,
31+
input_message_content=TestInlineQueryResultArticle.input_message_content,
32+
reply_markup=TestInlineQueryResultArticle.reply_markup,
33+
url=TestInlineQueryResultArticle.url,
34+
hide_url=TestInlineQueryResultArticle.hide_url,
35+
description=TestInlineQueryResultArticle.description,
36+
thumb_url=TestInlineQueryResultArticle.thumb_url,
37+
thumb_height=TestInlineQueryResultArticle.thumb_height,
38+
thumb_width=TestInlineQueryResultArticle.thumb_width)
3839

3940

4041
class TestInlineQueryResultArticle(object):
@@ -54,8 +55,8 @@ def test_expected_values(self, inline_query_result_article):
5455
assert inline_query_result_article.type == self.type
5556
assert inline_query_result_article.id == self.id
5657
assert inline_query_result_article.title == self.title
57-
assert inline_query_result_article.input_message_content.to_dict() == \
58-
self.input_message_content.to_dict()
58+
assert (inline_query_result_article.input_message_content.to_dict() ==
59+
self.input_message_content.to_dict())
5960
assert inline_query_result_article.reply_markup.to_dict() == self.reply_markup.to_dict()
6061
assert inline_query_result_article.url == self.url
6162
assert inline_query_result_article.hide_url == self.hide_url
@@ -71,20 +72,20 @@ def test_to_dict(self, inline_query_result_article):
7172
assert inline_query_result_article_dict['type'] == inline_query_result_article.type
7273
assert inline_query_result_article_dict['id'] == inline_query_result_article.id
7374
assert inline_query_result_article_dict['title'] == inline_query_result_article.title
74-
assert inline_query_result_article_dict['input_message_content'] == \
75-
inline_query_result_article.input_message_content.to_dict()
76-
assert inline_query_result_article_dict['reply_markup'] == \
77-
inline_query_result_article.reply_markup.to_dict()
75+
assert (inline_query_result_article_dict['input_message_content'] ==
76+
inline_query_result_article.input_message_content.to_dict())
77+
assert (inline_query_result_article_dict['reply_markup'] ==
78+
inline_query_result_article.reply_markup.to_dict())
7879
assert inline_query_result_article_dict['url'] == inline_query_result_article.url
7980
assert inline_query_result_article_dict['hide_url'] == inline_query_result_article.hide_url
80-
assert inline_query_result_article_dict['description'] == \
81-
inline_query_result_article.description
82-
assert inline_query_result_article_dict['thumb_url'] == \
83-
inline_query_result_article.thumb_url
84-
assert inline_query_result_article_dict['thumb_height'] == \
85-
inline_query_result_article.thumb_height
86-
assert inline_query_result_article_dict['thumb_width'] == \
87-
inline_query_result_article.thumb_width
81+
assert (inline_query_result_article_dict['description'] ==
82+
inline_query_result_article.description)
83+
assert (inline_query_result_article_dict['thumb_url'] ==
84+
inline_query_result_article.thumb_url)
85+
assert (inline_query_result_article_dict['thumb_height'] ==
86+
inline_query_result_article.thumb_height)
87+
assert (inline_query_result_article_dict['thumb_width'] ==
88+
inline_query_result_article.thumb_width)
8889

8990
def test_equality(self):
9091
a = InlineQueryResultArticle(self.id, self.title, self.input_message_content)
Collapse file

‎tests/test_inlinequeryresultaudio.py‎

Copy file name to clipboardExpand all lines: tests/test_inlinequeryresultaudio.py
+18-17Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -25,15 +25,16 @@
2525

2626
@pytest.fixture(scope='class')
2727
def inline_query_result_audio():
28-
return InlineQueryResultAudio(TestInlineQueryResultAudio.id,
29-
TestInlineQueryResultAudio.audio_url,
30-
TestInlineQueryResultAudio.title,
31-
performer=TestInlineQueryResultAudio.performer,
32-
audio_duration=TestInlineQueryResultAudio.audio_duration,
33-
caption=TestInlineQueryResultAudio.caption,
34-
parse_mode=TestInlineQueryResultAudio.parse_mode,
35-
input_message_content=TestInlineQueryResultAudio.input_message_content,
36-
reply_markup=TestInlineQueryResultAudio.reply_markup)
28+
return InlineQueryResultAudio(
29+
TestInlineQueryResultAudio.id,
30+
TestInlineQueryResultAudio.audio_url,
31+
TestInlineQueryResultAudio.title,
32+
performer=TestInlineQueryResultAudio.performer,
33+
audio_duration=TestInlineQueryResultAudio.audio_duration,
34+
caption=TestInlineQueryResultAudio.caption,
35+
parse_mode=TestInlineQueryResultAudio.parse_mode,
36+
input_message_content=TestInlineQueryResultAudio.input_message_content,
37+
reply_markup=TestInlineQueryResultAudio.reply_markup)
3738

3839

3940
class TestInlineQueryResultAudio(object):
@@ -57,8 +58,8 @@ def test_expected_values(self, inline_query_result_audio):
5758
assert inline_query_result_audio.audio_duration == self.audio_duration
5859
assert inline_query_result_audio.caption == self.caption
5960
assert inline_query_result_audio.parse_mode == self.parse_mode
60-
assert inline_query_result_audio.input_message_content.to_dict() == \
61-
self.input_message_content.to_dict()
61+
assert (inline_query_result_audio.input_message_content.to_dict() ==
62+
self.input_message_content.to_dict())
6263
assert inline_query_result_audio.reply_markup.to_dict() == self.reply_markup.to_dict()
6364

6465
def test_to_dict(self, inline_query_result_audio):
@@ -70,14 +71,14 @@ def test_to_dict(self, inline_query_result_audio):
7071
assert inline_query_result_audio_dict['audio_url'] == inline_query_result_audio.audio_url
7172
assert inline_query_result_audio_dict['title'] == inline_query_result_audio.title
7273
assert inline_query_result_audio_dict['performer'] == inline_query_result_audio.performer
73-
assert inline_query_result_audio_dict['audio_duration'] == \
74-
inline_query_result_audio.audio_duration
74+
assert (inline_query_result_audio_dict['audio_duration'] ==
75+
inline_query_result_audio.audio_duration)
7576
assert inline_query_result_audio_dict['caption'] == inline_query_result_audio.caption
7677
assert inline_query_result_audio_dict['parse_mode'] == inline_query_result_audio.parse_mode
77-
assert inline_query_result_audio_dict['input_message_content'] == \
78-
inline_query_result_audio.input_message_content.to_dict()
79-
assert inline_query_result_audio_dict['reply_markup'] == \
80-
inline_query_result_audio.reply_markup.to_dict()
78+
assert (inline_query_result_audio_dict['input_message_content'] ==
79+
inline_query_result_audio.input_message_content.to_dict())
80+
assert (inline_query_result_audio_dict['reply_markup'] ==
81+
inline_query_result_audio.reply_markup.to_dict())
8182

8283
def test_equality(self):
8384
a = InlineQueryResultAudio(self.id, self.audio_url, self.title)

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.