ruff: Fix PLR5501 Use elif
instead of else
then if
, to reduce indentation.
Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
parent
5c934e544d
commit
11ea5c7b62
6 changed files with 33 additions and 41 deletions
|
@ -295,9 +295,8 @@ def run_mirror() -> None:
|
|||
if event_date > since:
|
||||
handle_event(event)
|
||||
since = event_date
|
||||
else:
|
||||
elif sleep_interval < 22:
|
||||
# back off a bit
|
||||
if sleep_interval < 22:
|
||||
sleep_interval += 4
|
||||
time.sleep(sleep_interval)
|
||||
|
||||
|
|
|
@ -258,8 +258,7 @@ def get_phase_number(grid, turn, x_pieces_possessed_not_on_grid, o_pieces_posses
|
|||
if x_pieces_possessed_not_on_grid != 0 or o_pieces_possessed_not_on_grid != 0:
|
||||
# Placing pieces
|
||||
return 1
|
||||
else:
|
||||
if get_piece("X", grid) <= 3 or get_piece("O", grid) <= 3:
|
||||
elif get_piece("X", grid) <= 3 or get_piece("O", grid) <= 3:
|
||||
# Flying
|
||||
return 3
|
||||
else:
|
||||
|
|
|
@ -60,8 +60,7 @@ class TrelloHandler:
|
|||
bot_reply = self.get_all_supported_commands()
|
||||
elif content == ["get-all-boards"]:
|
||||
bot_reply = self.get_all_boards()
|
||||
else:
|
||||
if content[0] == "get-all-cards":
|
||||
elif content[0] == "get-all-cards":
|
||||
bot_reply = self.get_all_cards(content)
|
||||
elif content[0] == "get-all-checklists":
|
||||
bot_reply = self.get_all_checklists(content)
|
||||
|
|
|
@ -207,8 +207,7 @@ def update_quiz(quiz: Dict[str, Any], quiz_id: str, bot_handler: BotHandler) ->
|
|||
def build_response(is_correct: bool, num_answers: int) -> str:
|
||||
if is_correct:
|
||||
response = ":tada: **{answer}** is correct, {sender_name}!"
|
||||
else:
|
||||
if num_answers >= 3:
|
||||
elif num_answers >= 3:
|
||||
response = ":disappointed: WRONG, {sender_name}! The correct answer is **{answer}**."
|
||||
else:
|
||||
response = ":disappointed: WRONG, {sender_name}! {option} is not correct."
|
||||
|
|
|
@ -290,8 +290,7 @@ class GameAdapter:
|
|||
self.send_reply(
|
||||
message, "You are not in a game at the moment. Type `help` for help."
|
||||
)
|
||||
else:
|
||||
if self.is_single_player:
|
||||
elif self.is_single_player:
|
||||
self.send_reply(message, self.help_message_single_player())
|
||||
else:
|
||||
self.send_reply(message, self.help_message())
|
||||
|
@ -893,8 +892,7 @@ class GameInstance:
|
|||
return
|
||||
if self.is_turn_of(player_email):
|
||||
self.handle_current_player_command(content)
|
||||
else:
|
||||
if self.game_adapter.is_single_player:
|
||||
elif self.game_adapter.is_single_player:
|
||||
self.broadcast("It's your turn")
|
||||
else:
|
||||
self.broadcast(
|
||||
|
@ -1022,8 +1020,7 @@ class GameInstance:
|
|||
values.update({"games_drawn": 1})
|
||||
else:
|
||||
values.update({"games_lost": 1})
|
||||
else:
|
||||
if u == loser:
|
||||
elif u == loser:
|
||||
values.update({"games_lost": 1})
|
||||
else:
|
||||
values.update({"games_won": 1})
|
||||
|
|
|
@ -72,8 +72,7 @@ def exit_gracefully_if_zulip_config_is_missing(config_file: Optional[str]) -> No
|
|||
else:
|
||||
error_msg = f"ERROR: {config_file} does not exist."
|
||||
|
||||
else:
|
||||
if zulip_env_vars_are_present():
|
||||
elif zulip_env_vars_are_present():
|
||||
return
|
||||
else:
|
||||
error_msg = "ERROR: You did not supply a Zulip config file."
|
||||
|
|
Loading…
Add table
Reference in a new issue