cleanup: Remove more unused variables.
MODIFY
zulip_bots/zulip_bots/bots/dropbox_share/test_dropbox_share.py
zulip_bots/zulip_bots/bots/dropbox_share/test_dropbox_share.py
@@ -226,7 +226,6 @@ class TestDropboxBot(BotTestCase, DefaultTests):
mkdir_error_response = "ERROR: syntax: mkdir <path>"
rm_error_response = "ERROR: syntax: rm <path>"
write_error_response = "ERROR: syntax: write <path> <some_text>"
- search_error_response = "ERROR: syntax: search <path> <some_text> <max_results>"
share_error_response = "ERROR: syntax: share <path>"
usage_error_response = "ERROR: syntax: usage"

MODIFY
zulip_bots/zulip_bots/bots/file_uploader/test_file_uploader.py
zulip_bots/zulip_bots/bots/file_uploader/test_file_uploader.py
@@ -19,7 +19,7 @@ class TestFileUploaderBot(BotTestCase, DefaultTests):
def test_file_upload_failed(self, is_file: Mock, resolve: Mock) -> None:
server_reply = dict(result='', msg='error')
with patch('zulip_bots.test_lib.StubBotHandler.upload_file_from_path',
- return_value=server_reply) as m:
+ return_value=server_reply):
self.verify_reply('file.txt', 'Failed to upload `/file.txt` file: error')
@patch('pathlib.Path.resolve', return_value=Path('/file.txt'))
@@ -27,7 +27,7 @@ class TestFileUploaderBot(BotTestCase, DefaultTests):
def test_file_upload_success(self, is_file: Mock, resolve: Mock) -> None:
server_reply = dict(result='success', uri='https://file/uri')
with patch('zulip_bots.test_lib.StubBotHandler.upload_file_from_path',
- return_value=server_reply) as m:
+ return_value=server_reply):
self.verify_reply('file.txt', '[file.txt](https://file/uri)')
def test_help(self):

MODIFY
zulip_bots/zulip_bots/bots/giphy/giphy.py
zulip_bots/zulip_bots/bots/giphy/giphy.py
@@ -69,7 +69,7 @@ def get_url_gif_giphy(keyword: str, api_key: str) -> Union[int, str]:
try:
data = requests.get(url, params=query)
- except requests.exceptions.ConnectionError as e: # Usually triggered by bad connection.
+ except requests.exceptions.ConnectionError: # Usually triggered by bad connection.
logging.exception('Bad connection')
raise
data.raise_for_status()

MODIFY
zulip_bots/zulip_bots/bots/idonethis/test_idonethis.py
zulip_bots/zulip_bots/bots/idonethis/test_idonethis.py
@@ -61,7 +61,7 @@ class TestIDoneThisBot(BotTestCase, DefaultTests):
def test_entries_list(self) -> None:
with self.mock_config_info({'api_key': '12345678', 'default_team': 'testing team 1'}), \
self.mock_http_conversation('test_entries_list'), \
- patch('zulip_bots.bots.idonethis.idonethis.get_team_hash', return_value='31415926535') as get_team_hashFunction:
+ patch('zulip_bots.bots.idonethis.idonethis.get_team_hash', return_value='31415926535'):
self.verify_reply('entries list testing team 1',
'Entries for testing team 1:\n'
' * TESTING\n'

MODIFY
zulip_bots/zulip_bots/bots/trivia_quiz/test_trivia_quiz.py
zulip_bots/zulip_bots/bots/trivia_quiz/test_trivia_quiz.py
@@ -100,7 +100,7 @@ class TestTriviaQuizBot(BotTestCase, DefaultTests):
# test correct answer
with patch('zulip_bots.bots.trivia_quiz.trivia_quiz.get_quiz_from_id',
return_value=json.dumps(quiz)):
- with patch('zulip_bots.bots.trivia_quiz.trivia_quiz.start_new_quiz') as mock_new_quiz:
+ with patch('zulip_bots.bots.trivia_quiz.trivia_quiz.start_new_quiz'):
self._test('answer Q001 A', ':tada: **Amphibian** is correct, Foo Test User!')
def test_update_quiz(self) -> None:

MODIFY
zulip_bots/zulip_bots/bots/xkcd/xkcd.py
zulip_bots/zulip_bots/bots/xkcd/xkcd.py
@@ -113,7 +113,7 @@ def fetch_xkcd_query(mode: int, comic_id: Optional[str]=None) -> Dict[str, str]:
raise XkcdServerError()
xkcd_json = fetched.json()
- except requests.exceptions.ConnectionError as e:
+ except requests.exceptions.ConnectionError:
logging.exception("Connection Error")
raise

MODIFY
zulip_bots/zulip_bots/bots/youtube/youtube.py
zulip_bots/zulip_bots/bots/youtube/youtube.py
@@ -66,7 +66,7 @@ def search_youtube(query: str, key: str,
url = 'https://www.googleapis.com/youtube/v3/search'
try:
r = requests.get(url, params=params)
- except ConnectionError as e: # Usually triggered by bad connection.
+ except ConnectionError: # Usually triggered by bad connection.
logging.exception('Bad connection')
raise
r.raise_for_status()

MODIFY
zulip_bots/zulip_bots/tests/test_lib.py
zulip_bots/zulip_bots/tests/test_lib.py
@@ -133,13 +133,12 @@ class LibTest(TestCase):
def test_content_and_full_content(self):
client = FakeClient()
client.get_profile()
- handler = ExternalBotHandler(
+ ExternalBotHandler(
client=client,
root_dir=None,
bot_details=None,
bot_config_file=None
)
- to = {'email': 'Some@User'}
def test_run_message_handler_for_bot(self):
with patch('zulip_bots.lib.Client', new=FakeClient) as fake_client:

cleanup: Remove more unused variables.

Signed-off-by: Anders Kaseorg <anders@zulipchat.com>