diff options
| author | 2023-05-09 16:01:01 +0100 | |
|---|---|---|
| committer | 2023-05-09 16:01:01 +0100 | |
| commit | c3e23e60278d34658f801bd7d7ed721d5a272637 (patch) | |
| tree | e159a0fae7850d706d713cf2b49dfed2140ce655 /bot/exts/events/trivianight/_questions.py | |
| parent | Bump sentry-sdk from 1.21.1 to 1.22.1 (#1273) (diff) | |
| parent | Move unshared contants inside modules (diff) | |
Merge pull request #1270 from python-discord/migrate-to-ruff
Migrate to ruff
Diffstat (limited to 'bot/exts/events/trivianight/_questions.py')
| -rw-r--r-- | bot/exts/events/trivianight/_questions.py | 12 | 
1 files changed, 6 insertions, 6 deletions
diff --git a/bot/exts/events/trivianight/_questions.py b/bot/exts/events/trivianight/_questions.py index 5f1046dc..a0dd545e 100644 --- a/bot/exts/events/trivianight/_questions.py +++ b/bot/exts/events/trivianight/_questions.py @@ -7,7 +7,7 @@ from discord.ui import Button, View  from bot.constants import Colours, NEGATIVE_REPLIES -from ._game import AlreadyUpdated, Question, QuestionClosed +from ._game import AlreadyUpdatedError, Question, QuestionClosedError  from ._scoreboard import Scoreboard @@ -29,7 +29,7 @@ class AnswerButton(Button):          """          try:              guess = self.question.guess(interaction.user.id, self.label) -        except AlreadyUpdated: +        except AlreadyUpdatedError:              await interaction.response.send_message(                  embed=Embed(                      title=choice(NEGATIVE_REPLIES), @@ -39,7 +39,7 @@ class AnswerButton(Button):                  ephemeral=True              )              return -        except QuestionClosed: +        except QuestionClosedError:              await interaction.response.send_message(                  embed=Embed(                      title=choice(NEGATIVE_REPLIES), @@ -91,7 +91,7 @@ class QuestionView(View):              - text: A string that represents the question description to 'unicodeify'          """          return "".join( -            f"{letter}\u200b" if letter not in ('\n', '\t', '`', 'p', 'y') else letter +            f"{letter}\u200b" if letter not in ("\n", "\t", "`", "p", "y") else letter              for idx, letter in enumerate(text)          ) @@ -127,13 +127,13 @@ class QuestionView(View):          if len(guesses) != 0:              answers_chosen = {                  answer_choice: len( -                    tuple(filter(lambda x: x[0] == answer_choice, guesses.values()))  # noqa: B023 +                    tuple(filter(lambda x: x[0] == answer_choice, guesses.values()))                  )                  for answer_choice in labels              }              answers_chosen = dict( -                sorted(list(answers_chosen.items()), key=lambda item: item[1], reverse=True) +                sorted(answers_chosen.items(), key=lambda item: item[1], reverse=True)              )              for answer, people_answered in answers_chosen.items():  |