From c471f26d45ce8bc138ebbd59e991ebe80faf162d Mon Sep 17 00:00:00 2001 From: Anders Kaseorg Date: Fri, 27 Oct 2023 22:12:49 -0700 Subject: [PATCH] ruff: Fix ISC001 Implicitly concatenated string literals on one line. Signed-off-by: Anders Kaseorg --- zulip/integrations/trello/zulip_trello.py | 2 +- zulip/tests/test_default_arguments.py | 2 +- zulip/zulip/__init__.py | 4 ++-- zulip_bots/zulip_bots/bots/baremetrics/baremetrics.py | 2 +- zulip_bots/zulip_bots/bots/chessbot/chessbot.py | 4 ++-- zulip_bots/zulip_bots/bots/giphy/giphy.py | 2 +- zulip_bots/zulip_bots/bots/merels/libraries/game.py | 8 ++++---- zulip_bots/zulip_bots/bots/merels/test_merels.py | 2 +- zulip_bots/zulip_bots/bots/monkeytestit/lib/parse.py | 4 ++-- zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py | 4 +--- zulip_bots/zulip_bots/bots/trello/test_trello.py | 2 +- zulip_bots/zulip_bots/bots/youtube/test_youtube.py | 2 +- zulip_bots/zulip_bots/bots/youtube/youtube.py | 4 ++-- 13 files changed, 20 insertions(+), 22 deletions(-) diff --git a/zulip/integrations/trello/zulip_trello.py b/zulip/integrations/trello/zulip_trello.py index e7a58de0..08aeadd7 100755 --- a/zulip/integrations/trello/zulip_trello.py +++ b/zulip/integrations/trello/zulip_trello.py @@ -122,7 +122,7 @@ at . parser.add_argument( "--trello-board-id", required=True, - help=("The Trello board short ID. Can usually be found " "in the URL of the Trello board."), + help=("The Trello board short ID. Can usually be found in the URL of the Trello board."), ) parser.add_argument( "--trello-api-key", diff --git a/zulip/tests/test_default_arguments.py b/zulip/tests/test_default_arguments.py index 2853b015..c4f0e0b0 100755 --- a/zulip/tests/test_default_arguments.py +++ b/zulip/tests/test_default_arguments.py @@ -41,7 +41,7 @@ Zulip API configuration: expanded_test_path = os.path.abspath(os.path.expanduser(test_path)) self.assertEqual( str(cm.exception), - "api_key or email not specified and " f"file {expanded_test_path} does not exist", + f"api_key or email not specified and file {expanded_test_path} does not exist", ) diff --git a/zulip/zulip/__init__.py b/zulip/zulip/__init__.py index 6f8a7c3f..40b7a954 100644 --- a/zulip/zulip/__init__.py +++ b/zulip/zulip/__init__.py @@ -1395,7 +1395,7 @@ class Client: def list_subscriptions(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]: logger.warning( - "list_subscriptions() is deprecated." " Please use get_subscriptions() instead." + "list_subscriptions() is deprecated. Please use get_subscriptions() instead." ) return self.get_subscriptions(request) @@ -1699,7 +1699,7 @@ class Client: if message_id is None: if propagate_mode != "change_all": raise AttributeError( - "A message_id must be provided if " 'propagate_mode isn\'t "change_all"' + 'A message_id must be provided if propagate_mode isn\'t "change_all"' ) # ask the server for the latest message ID in the topic. diff --git a/zulip_bots/zulip_bots/bots/baremetrics/baremetrics.py b/zulip_bots/zulip_bots/bots/baremetrics/baremetrics.py index 810e96e7..13aa067a 100644 --- a/zulip_bots/zulip_bots/bots/baremetrics/baremetrics.py +++ b/zulip_bots/zulip_bots/bots/baremetrics/baremetrics.py @@ -142,7 +142,7 @@ class BaremetricsHandler: response = "**Listing sources:** \n" for index, source in enumerate(sources_data): response += ( - "{_count}.ID: {id}\n" "Provider: {provider}\n" "Provider ID: {provider_id}\n\n" + "{_count}.ID: {id}\nProvider: {provider}\nProvider ID: {provider_id}\n\n" ).format(_count=index + 1, **source) return response diff --git a/zulip_bots/zulip_bots/bots/chessbot/chessbot.py b/zulip_bots/zulip_bots/bots/chessbot/chessbot.py index fb5a0e5e..e6c48cb8 100644 --- a/zulip_bots/zulip_bots/bots/chessbot/chessbot.py +++ b/zulip_bots/zulip_bots/bots/chessbot/chessbot.py @@ -401,7 +401,7 @@ def make_loss_response(board: chess.Board, reason: str) -> str: Returns: The loss response string. """ - return ("*{}* {}. **{}** wins!\n\n" "{}").format( + return ("*{}* {}. **{}** wins!\n\n{}").format( "White" if board.turn else "Black", reason, "Black" if board.turn else "White", @@ -418,7 +418,7 @@ def make_not_legal_response(board: chess.Board, move_san: str) -> str: Returns: The not-legal-move response string. """ - return ("Sorry, the move *{}* isn't legal.\n\n" "{}" "\n\n\n" "{}").format( + return ("Sorry, the move *{}* isn't legal.\n\n{}\n\n\n{}").format( move_san, make_str(board, board.turn), make_footer() ) diff --git a/zulip_bots/zulip_bots/bots/giphy/giphy.py b/zulip_bots/zulip_bots/bots/giphy/giphy.py index 3087072e..d0e0c73e 100644 --- a/zulip_bots/zulip_bots/bots/giphy/giphy.py +++ b/zulip_bots/zulip_bots/bots/giphy/giphy.py @@ -96,7 +96,7 @@ def get_bot_giphy_response( "let's try again later! :grin:" ) except GiphyNoResultException: - return f'Sorry, I don\'t have a GIF for "{keyword}"! ' ":astonished:" + return f'Sorry, I don\'t have a GIF for "{keyword}"! :astonished:' return ( f"[Click to enlarge]({gif_url})" "[](/static/images/interactive-bot/giphy/powered-by-giphy.png)" diff --git a/zulip_bots/zulip_bots/bots/merels/libraries/game.py b/zulip_bots/zulip_bots/bots/merels/libraries/game.py index 8cc3b2d6..4798fcbf 100644 --- a/zulip_bots/zulip_bots/bots/merels/libraries/game.py +++ b/zulip_bots/zulip_bots/bots/merels/libraries/game.py @@ -19,7 +19,7 @@ def getInfo(): :return: Info on how to start the game """ - return "To start a game, mention me and add `create`. A game will start " "in that topic. " + return "To start a game, mention me and add `create`. A game will start in that topic. " def getHelp(): @@ -70,7 +70,7 @@ def beat(message, topic_name, merels_storage): p2 = [int(x) for x in match.group(3).split(",")] if mechanics.get_take_status(topic_name, merels_storage) == 1: - raise BadMoveException("Take is required to proceed." " Please try again.\n") + raise BadMoveException("Take is required to proceed. Please try again.\n") responses += mechanics.move_man(topic_name, p1, p2, merels_storage) + "\n" no_moves = after_event_checkup(responses, topic_name, merels_storage) @@ -98,7 +98,7 @@ def beat(message, topic_name, merels_storage): responses = "" if mechanics.get_take_status(topic_name, merels_storage) == 1: - raise BadMoveException("Take is required to proceed." " Please try again.\n") + raise BadMoveException("Take is required to proceed. Please try again.\n") responses += mechanics.put_man(topic_name, p1[0], p1[1], merels_storage) + "\n" no_moves = after_event_checkup(responses, topic_name, merels_storage) @@ -162,7 +162,7 @@ def check_any_moves(topic_name, merels_storage): """ if not mechanics.can_make_any_move(topic_name, merels_storage): mechanics.update_change_turn(topic_name, merels_storage) - return "Cannot make any move on the grid. Switching to " "previous player.\n" + return "Cannot make any move on the grid. Switching to previous player.\n" return "" diff --git a/zulip_bots/zulip_bots/bots/merels/test_merels.py b/zulip_bots/zulip_bots/bots/merels/test_merels.py index eefe8b01..b6e2b706 100644 --- a/zulip_bots/zulip_bots/bots/merels/test_merels.py +++ b/zulip_bots/zulip_bots/bots/merels/test_merels.py @@ -15,7 +15,7 @@ class TestMerelsBot(BotTestCase, DefaultTests): ) res = self.get_response(message) self.assertEqual( - res["content"], "You are not in a game at the moment." " Type `help` for help." + res["content"], "You are not in a game at the moment. Type `help` for help." ) # FIXME: Add tests for computer moves diff --git a/zulip_bots/zulip_bots/bots/monkeytestit/lib/parse.py b/zulip_bots/zulip_bots/bots/monkeytestit/lib/parse.py index 9866f484..e4403bfd 100644 --- a/zulip_bots/zulip_bots/bots/monkeytestit/lib/parse.py +++ b/zulip_bots/zulip_bots/bots/monkeytestit/lib/parse.py @@ -22,7 +22,7 @@ def execute(message: str, apikey: str) -> str: len_params = len(params) if len_params < 2: - return failed("You **must** provide at least an URL to perform a " "check.") + return failed("You **must** provide at least an URL to perform a check.") options = { "secret": apikey, @@ -65,7 +65,7 @@ def execute(message: str, apikey: str) -> str: # the user needs to modify the asset_count. There are probably ways # to counteract this, but I think this is more fast to run. else: - return "Unknown command. Available commands: `check " "[params]`" + return "Unknown command. Available commands: `check [params]`" def failed(message: str) -> str: diff --git a/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py b/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py index b9e80744..f3b1ffc0 100644 --- a/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py +++ b/zulip_bots/zulip_bots/bots/tictactoe/tictactoe.py @@ -253,9 +253,7 @@ class TicTacToeMessageHandler: return f"{original_player} put a token at {move_info}" def game_start_message(self) -> str: - return ( - "Welcome to tic-tac-toe!" "To make a move, type @-mention `move ` or ``" - ) + return "Welcome to tic-tac-toe!To make a move, type @-mention `move ` or ``" class ticTacToeHandler(GameAdapter): diff --git a/zulip_bots/zulip_bots/bots/trello/test_trello.py b/zulip_bots/zulip_bots/bots/trello/test_trello.py index 9559a343..4cb0832c 100644 --- a/zulip_bots/zulip_bots/bots/trello/test_trello.py +++ b/zulip_bots/zulip_bots/bots/trello/test_trello.py @@ -83,7 +83,7 @@ class TestTrelloBot(BotTestCase, DefaultTests): with self.mock_http_conversation("get_lists"): self.verify_reply( "get-all-lists TEST", - ("**Lists:**\n" "1. TEST_A\n" " * TEST_1\n" "2. TEST_B\n" " * TEST_2"), + ("**Lists:**\n1. TEST_A\n * TEST_1\n2. TEST_B\n * TEST_2"), ) def test_command_exceptions(self) -> None: diff --git a/zulip_bots/zulip_bots/bots/youtube/test_youtube.py b/zulip_bots/zulip_bots/bots/youtube/test_youtube.py index d003d545..4bfcee0a 100644 --- a/zulip_bots/zulip_bots/bots/youtube/test_youtube.py +++ b/zulip_bots/zulip_bots/bots/youtube/test_youtube.py @@ -108,5 +108,5 @@ class TestYoutubeBot(BotTestCase, DefaultTests): "requests.get", side_effect=ConnectionError() ), patch("logging.exception"): self.verify_reply( - "Wow !", "Uh-Oh, couldn't process the request " "right now.\nPlease again later" + "Wow !", "Uh-Oh, couldn't process the request right now.\nPlease again later" ) diff --git a/zulip_bots/zulip_bots/bots/youtube/youtube.py b/zulip_bots/zulip_bots/bots/youtube/youtube.py index b65cda7c..3d1a5cbc 100644 --- a/zulip_bots/zulip_bots/bots/youtube/youtube.py +++ b/zulip_bots/zulip_bots/bots/youtube/youtube.py @@ -37,7 +37,7 @@ class YoutubeHandler: assert e.response is not None if e.response.json()["error"]["errors"][0]["reason"] == "keyInvalid": bot_handler.quit( - "Invalid key." "Follow the instructions in doc.md for setting API key." + "Invalid key.Follow the instructions in doc.md for setting API key." ) else: raise @@ -112,7 +112,7 @@ def get_bot_response( return YoutubeHandler.help_content except (ConnectionError, HTTPError): - return "Uh-Oh, couldn't process the request " "right now.\nPlease again later" + return "Uh-Oh, couldn't process the request right now.\nPlease again later" reply = "Here is what I found for `" + query + "` : "