Skip to content

Commit

Permalink
Lint repo with new ruff rules
Browse files Browse the repository at this point in the history
  • Loading branch information
ChrisLovering committed Apr 1, 2024
1 parent a044329 commit 53ca458
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 4 deletions.
1 change: 1 addition & 0 deletions bot/exts/advent_of_code/_caches.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
class AoCSettingOption(Enum):
COMPLETIONIST_ENABLED = "completionist_enabled"


# How many people are in each leaderboard
# RedisCache[leaderboard_id, int]
leaderboard_counts = async_rediscache.RedisCache(namespace="AOC_leaderboard_counts")
Expand Down
4 changes: 2 additions & 2 deletions bot/exts/advent_of_code/_cog.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,8 @@ async def join_leaderboard(self, interaction: discord.Interaction) -> None:
current_date = datetime.now(tz=UTC)
allowed_months = (Month.NOVEMBER.value, Month.DECEMBER.value)
if not (
current_date.month in allowed_months and current_date.year == AocConfig.year
or current_date.month == Month.JANUARY.value and current_date.year == AocConfig.year + 1
(current_date.month in allowed_months and current_date.year == AocConfig.year)
or (current_date.month == Month.JANUARY.value and current_date.year == AocConfig.year + 1)
):
# Only allow joining the leaderboard in the run up to AOC and the January following.
await interaction.response.send_message(
Expand Down
3 changes: 1 addition & 2 deletions bot/utils/checks.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
from collections.abc import Callable, Container
from typing import NoReturn

from discord.ext import commands
from discord.ext.commands import Context
Expand All @@ -13,7 +12,7 @@

def in_code_jam_category(code_jam_category_name: str) -> Callable:
"""Raises `CodeJamCategoryCheckFailure` when the command is invoked outside the Code Jam categories."""
async def predicate(ctx: commands.Context) -> bool | NoReturn:
async def predicate(ctx: commands.Context) -> bool:
if not ctx.guild:
return False
if not ctx.message.channel.category:
Expand Down
1 change: 1 addition & 0 deletions tests/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -666,6 +666,7 @@ class MockAsyncWebhook(CustomMockMixin, unittest.mock.MagicMock):
spec_set = webhook_instance
additional_spec_asyncs = ("send", "edit", "delete", "execute")


@contextmanager
def no_create_task():
def side_effect(coro, *_, **__):
Expand Down

0 comments on commit 53ca458

Please sign in to comment.