ruff: Fix ISC001 Implicitly concatenated string literals on one line.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
2f581293d9
commit
c471f26d45
13 changed files with 20 additions and 22 deletions
|
@ -122,7 +122,7 @@ at <https://zulip.com/integrations/doc/trello>.
|
||||||
parser.add_argument(
|
parser.add_argument(
|
||||||
"--trello-board-id",
|
"--trello-board-id",
|
||||||
required=True,
|
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(
|
parser.add_argument(
|
||||||
"--trello-api-key",
|
"--trello-api-key",
|
||||||
|
|
|
@ -41,7 +41,7 @@ Zulip API configuration:
|
||||||
expanded_test_path = os.path.abspath(os.path.expanduser(test_path))
|
expanded_test_path = os.path.abspath(os.path.expanduser(test_path))
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
str(cm.exception),
|
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",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -1395,7 +1395,7 @@ class Client:
|
||||||
|
|
||||||
def list_subscriptions(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
|
def list_subscriptions(self, request: Optional[Dict[str, Any]] = None) -> Dict[str, Any]:
|
||||||
logger.warning(
|
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)
|
return self.get_subscriptions(request)
|
||||||
|
|
||||||
|
@ -1699,7 +1699,7 @@ class Client:
|
||||||
if message_id is None:
|
if message_id is None:
|
||||||
if propagate_mode != "change_all":
|
if propagate_mode != "change_all":
|
||||||
raise AttributeError(
|
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.
|
# ask the server for the latest message ID in the topic.
|
||||||
|
|
|
@ -142,7 +142,7 @@ class BaremetricsHandler:
|
||||||
response = "**Listing sources:** \n"
|
response = "**Listing sources:** \n"
|
||||||
for index, source in enumerate(sources_data):
|
for index, source in enumerate(sources_data):
|
||||||
response += (
|
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)
|
).format(_count=index + 1, **source)
|
||||||
|
|
||||||
return response
|
return response
|
||||||
|
|
|
@ -401,7 +401,7 @@ def make_loss_response(board: chess.Board, reason: str) -> str:
|
||||||
|
|
||||||
Returns: The loss response string.
|
Returns: The loss response string.
|
||||||
"""
|
"""
|
||||||
return ("*{}* {}. **{}** wins!\n\n" "{}").format(
|
return ("*{}* {}. **{}** wins!\n\n{}").format(
|
||||||
"White" if board.turn else "Black",
|
"White" if board.turn else "Black",
|
||||||
reason,
|
reason,
|
||||||
"Black" if board.turn else "White",
|
"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.
|
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()
|
move_san, make_str(board, board.turn), make_footer()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@ def get_bot_giphy_response(
|
||||||
"let's try again later! :grin:"
|
"let's try again later! :grin:"
|
||||||
)
|
)
|
||||||
except GiphyNoResultException:
|
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 (
|
return (
|
||||||
f"[Click to enlarge]({gif_url})"
|
f"[Click to enlarge]({gif_url})"
|
||||||
"[](/static/images/interactive-bot/giphy/powered-by-giphy.png)"
|
"[](/static/images/interactive-bot/giphy/powered-by-giphy.png)"
|
||||||
|
|
|
@ -19,7 +19,7 @@ def getInfo():
|
||||||
|
|
||||||
:return: Info on how to start the game
|
: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():
|
def getHelp():
|
||||||
|
@ -70,7 +70,7 @@ def beat(message, topic_name, merels_storage):
|
||||||
p2 = [int(x) for x in match.group(3).split(",")]
|
p2 = [int(x) for x in match.group(3).split(",")]
|
||||||
|
|
||||||
if mechanics.get_take_status(topic_name, merels_storage) == 1:
|
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"
|
responses += mechanics.move_man(topic_name, p1, p2, merels_storage) + "\n"
|
||||||
no_moves = after_event_checkup(responses, topic_name, merels_storage)
|
no_moves = after_event_checkup(responses, topic_name, merels_storage)
|
||||||
|
@ -98,7 +98,7 @@ def beat(message, topic_name, merels_storage):
|
||||||
responses = ""
|
responses = ""
|
||||||
|
|
||||||
if mechanics.get_take_status(topic_name, merels_storage) == 1:
|
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"
|
responses += mechanics.put_man(topic_name, p1[0], p1[1], merels_storage) + "\n"
|
||||||
no_moves = after_event_checkup(responses, topic_name, merels_storage)
|
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):
|
if not mechanics.can_make_any_move(topic_name, merels_storage):
|
||||||
mechanics.update_change_turn(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 ""
|
return ""
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@ class TestMerelsBot(BotTestCase, DefaultTests):
|
||||||
)
|
)
|
||||||
res = self.get_response(message)
|
res = self.get_response(message)
|
||||||
self.assertEqual(
|
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
|
# FIXME: Add tests for computer moves
|
||||||
|
|
|
@ -22,7 +22,7 @@ def execute(message: str, apikey: str) -> str:
|
||||||
len_params = len(params)
|
len_params = len(params)
|
||||||
|
|
||||||
if len_params < 2:
|
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 = {
|
options = {
|
||||||
"secret": apikey,
|
"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
|
# the user needs to modify the asset_count. There are probably ways
|
||||||
# to counteract this, but I think this is more fast to run.
|
# to counteract this, but I think this is more fast to run.
|
||||||
else:
|
else:
|
||||||
return "Unknown command. Available commands: `check <website> " "[params]`"
|
return "Unknown command. Available commands: `check <website> [params]`"
|
||||||
|
|
||||||
|
|
||||||
def failed(message: str) -> str:
|
def failed(message: str) -> str:
|
||||||
|
|
|
@ -253,9 +253,7 @@ class TicTacToeMessageHandler:
|
||||||
return f"{original_player} put a token at {move_info}"
|
return f"{original_player} put a token at {move_info}"
|
||||||
|
|
||||||
def game_start_message(self) -> str:
|
def game_start_message(self) -> str:
|
||||||
return (
|
return "Welcome to tic-tac-toe!To make a move, type @-mention `move <number>` or `<number>`"
|
||||||
"Welcome to tic-tac-toe!" "To make a move, type @-mention `move <number>` or `<number>`"
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
class ticTacToeHandler(GameAdapter):
|
class ticTacToeHandler(GameAdapter):
|
||||||
|
|
|
@ -83,7 +83,7 @@ class TestTrelloBot(BotTestCase, DefaultTests):
|
||||||
with self.mock_http_conversation("get_lists"):
|
with self.mock_http_conversation("get_lists"):
|
||||||
self.verify_reply(
|
self.verify_reply(
|
||||||
"get-all-lists TEST",
|
"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:
|
def test_command_exceptions(self) -> None:
|
||||||
|
|
|
@ -108,5 +108,5 @@ class TestYoutubeBot(BotTestCase, DefaultTests):
|
||||||
"requests.get", side_effect=ConnectionError()
|
"requests.get", side_effect=ConnectionError()
|
||||||
), patch("logging.exception"):
|
), patch("logging.exception"):
|
||||||
self.verify_reply(
|
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"
|
||||||
)
|
)
|
||||||
|
|
|
@ -37,7 +37,7 @@ class YoutubeHandler:
|
||||||
assert e.response is not None
|
assert e.response is not None
|
||||||
if e.response.json()["error"]["errors"][0]["reason"] == "keyInvalid":
|
if e.response.json()["error"]["errors"][0]["reason"] == "keyInvalid":
|
||||||
bot_handler.quit(
|
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:
|
else:
|
||||||
raise
|
raise
|
||||||
|
@ -112,7 +112,7 @@ def get_bot_response(
|
||||||
return YoutubeHandler.help_content
|
return YoutubeHandler.help_content
|
||||||
|
|
||||||
except (ConnectionError, HTTPError):
|
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 + "` : "
|
reply = "Here is what I found for `" + query + "` : "
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue