From 5a17c60987ee7415bb0cad1c64d3e62303c2ee53 Mon Sep 17 00:00:00 2001 From: PIG208 <359101898@qq.com> Date: Sat, 22 May 2021 17:21:45 +0800 Subject: [PATCH] lint: Pre-fix places where Black will reformat incorrectly. --- .../zulip_bots/bots/dropbox_share/dropbox_share.py | 9 +++------ .../zulip_bots/bots/dropbox_share/test_dropbox_share.py | 9 +++------ .../zulip_bots/bots/game_handler_bot/game_handler_bot.py | 3 +-- .../zulip_bots/bots/game_of_fifteen/game_of_fifteen.py | 3 +-- zulip_bots/zulip_bots/bots/merels/libraries/game.py | 3 +-- zulip_bots/zulip_bots/bots/twitpost/test_twitpost.py | 3 +-- zulip_bots/zulip_bots/bots/yoda/yoda.py | 3 +-- 7 files changed, 11 insertions(+), 22 deletions(-) diff --git a/zulip_bots/zulip_bots/bots/dropbox_share/dropbox_share.py b/zulip_bots/zulip_bots/bots/dropbox_share/dropbox_share.py index aac354a..ff1d09e 100644 --- a/zulip_bots/zulip_bots/bots/dropbox_share/dropbox_share.py +++ b/zulip_bots/zulip_bots/bots/dropbox_share/dropbox_share.py @@ -166,8 +166,7 @@ def dbx_write(client: Any, fn: str, content: str) -> str: result = client.files_upload(content.encode(), fn) msg = "Written to file: " + URL.format(name=result.name, path=result.path_lower) except Exception: - msg = "Incorrect file path or file already exists.\n"\ - "Usage: `write CONTENT`" + msg = "Incorrect file path or file already exists.\nUsage: `write CONTENT`" return msg @@ -178,8 +177,7 @@ def dbx_read(client: Any, fn: str) -> str: result = client.files_download(fn) msg = "**{}** :\n{}".format(result[0].name, result[1].text) except Exception: - msg = "Please provide a correct file path\n"\ - "Usage: `read ` to read content of a file" + msg = "Please provide a correct file path\nUsage: `read ` to read content of a file" return msg @@ -218,8 +216,7 @@ def dbx_share(client: Any, fn: str): result = client.sharing_create_shared_link(fn) msg = result.url except Exception: - msg = "Please provide a correct file name.\n"\ - "Usage: `share `" + msg = "Please provide a correct file name.\nUsage: `share `" return msg diff --git a/zulip_bots/zulip_bots/bots/dropbox_share/test_dropbox_share.py b/zulip_bots/zulip_bots/bots/dropbox_share/test_dropbox_share.py index 7aaade1..8b51056 100644 --- a/zulip_bots/zulip_bots/bots/dropbox_share/test_dropbox_share.py +++ b/zulip_bots/zulip_bots/bots/dropbox_share/test_dropbox_share.py @@ -142,8 +142,7 @@ class TestDropboxBot(BotTestCase, DefaultTests): self.verify_reply('write foo boo', bot_response) def test_dbx_write_error(self): - bot_response = "Incorrect file path or file already exists.\n"\ - "Usage: `write CONTENT`" + bot_response = "Incorrect file path or file already exists.\nUsage: `write CONTENT`" with patch('dropbox.Dropbox.files_upload', side_effect=Exception()), \ self.mock_config_info(self.config_info): self.verify_reply('write foo boo', bot_response) @@ -162,8 +161,7 @@ class TestDropboxBot(BotTestCase, DefaultTests): self.verify_reply('read foo', bot_response) def test_dbx_search(self): - bot_response = " - [foo](https://www.dropbox.com/home/foo)\n"\ - " - [fooboo](https://www.dropbox.com/home/fooboo)" + bot_response = " - [foo](https://www.dropbox.com/home/foo)\n - [fooboo](https://www.dropbox.com/home/fooboo)" with patch('dropbox.Dropbox.files_search', side_effect=search_files), \ self.mock_config_info(self.config_info): self.verify_reply('search foo', bot_response) @@ -191,8 +189,7 @@ class TestDropboxBot(BotTestCase, DefaultTests): self.verify_reply('share boo', bot_response) def test_dbx_share_error(self): - bot_response = "Please provide a correct file name.\n"\ - "Usage: `share `" + bot_response = "Please provide a correct file name.\nUsage: `share `" with patch('dropbox.Dropbox.sharing_create_shared_link', side_effect=Exception()), \ self.mock_config_info(self.config_info): self.verify_reply('share boo', bot_response) diff --git a/zulip_bots/zulip_bots/bots/game_handler_bot/game_handler_bot.py b/zulip_bots/zulip_bots/bots/game_handler_bot/game_handler_bot.py index 6cd168c..5c9a025 100644 --- a/zulip_bots/zulip_bots/bots/game_handler_bot/game_handler_bot.py +++ b/zulip_bots/zulip_bots/bots/game_handler_bot/game_handler_bot.py @@ -51,8 +51,7 @@ class GameHandlerBotHandler(GameAdapter): def __init__(self) -> None: game_name = 'foo test game' bot_name = 'game_handler_bot' - move_help_message = '* To make your move during a game, type\n' \ - '```move ```' + move_help_message = '* To make your move during a game, type\n```move ```' move_regex = r'move (\d)$' model = MockModel gameMessageHandler = GameHandlerBotMessageHandler diff --git a/zulip_bots/zulip_bots/bots/game_of_fifteen/game_of_fifteen.py b/zulip_bots/zulip_bots/bots/game_of_fifteen/game_of_fifteen.py index 3706445..124de95 100644 --- a/zulip_bots/zulip_bots/bots/game_of_fifteen/game_of_fifteen.py +++ b/zulip_bots/zulip_bots/bots/game_of_fifteen/game_of_fifteen.py @@ -124,8 +124,7 @@ class GameOfFifteenBotHandler(GameAdapter): def __init__(self) -> None: game_name = 'Game of Fifteen' bot_name = 'Game of Fifteen' - move_help_message = '* To make your move during a game, type\n' \ - '```move ...```' + move_help_message = '* To make your move during a game, type\n```move ...```' move_regex = r'move [\d{1}\s]+$' model = GameOfFifteenModel gameMessageHandler = GameOfFifteenMessageHandler diff --git a/zulip_bots/zulip_bots/bots/merels/libraries/game.py b/zulip_bots/zulip_bots/bots/merels/libraries/game.py index e47c08b..1822d29 100644 --- a/zulip_bots/zulip_bots/bots/merels/libraries/game.py +++ b/zulip_bots/zulip_bots/bots/merels/libraries/game.py @@ -41,8 +41,7 @@ def unknown_command(): :return: A string containing info about available commands """ - message = "Unknown command. Available commands: " \ - "put (v,h), take (v,h), move (v,h) -> (v,h)" + message = "Unknown command. Available commands: put (v,h), take (v,h), move (v,h) -> (v,h)" raise BadMoveException(message) def beat(message, topic_name, merels_storage): diff --git a/zulip_bots/zulip_bots/bots/twitpost/test_twitpost.py b/zulip_bots/zulip_bots/bots/twitpost/test_twitpost.py index 0a24688..fe91cf7 100644 --- a/zulip_bots/zulip_bots/bots/twitpost/test_twitpost.py +++ b/zulip_bots/zulip_bots/bots/twitpost/test_twitpost.py @@ -42,7 +42,6 @@ class TestTwitpostBot(BotTestCase, DefaultTests): @patch('tweepy.API.update_status', return_value=api_response) def test_tweet(self, mockedarg): test_message = 'tweet Maybe he\'ll finally find his keys. #peterfalk' - bot_response = 'Tweet Posted\n'\ - 'https://twitter.com/jasoncosta/status/243145735212777472' + bot_response = 'Tweet Posted\nhttps://twitter.com/jasoncosta/status/243145735212777472' with self.mock_config_info(self.mock_config): self.verify_reply(test_message, bot_response) diff --git a/zulip_bots/zulip_bots/bots/yoda/yoda.py b/zulip_bots/zulip_bots/bots/yoda/yoda.py index 2931eeb..323777e 100644 --- a/zulip_bots/zulip_bots/bots/yoda/yoda.py +++ b/zulip_bots/zulip_bots/bots/yoda/yoda.py @@ -103,8 +103,7 @@ class YodaSpeakHandler: logging.error(reply_message) except ApiKeyError: - reply_message = 'Invalid Api Key. Did you follow the instructions in the ' \ - '`readme.md` file?' + reply_message = 'Invalid Api Key. Did you follow the instructions in the `readme.md` file?' logging.error(reply_message) bot_handler.send_reply(message, reply_message)