Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump dep to latest #103

Merged
merged 2 commits into from
Nov 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions bot/constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,17 @@
class EnvConfig(
BaseSettings,
env_file=".env",
env_file_encoding = "utf-8",
env_nested_delimiter = "__",
env_file_encoding="utf-8",
env_nested_delimiter="__",
extra="ignore",
):
"""Our default configuration for models that should load from .env files."""


@dataclasses.dataclass
class AdventOfCodeLeaderboard:
"""Config required for a since AoC leaderboard."""

id: str
_session: str
join_code: str
Expand Down Expand Up @@ -83,7 +85,7 @@ class _Channels(EnvConfig, env_prefix="CHANNEL_"):
advent_of_code: int = 897932085766004786
advent_of_code_commands: int = 897932607545823342
bot_commands: int = 267659945086812160
devlog: int = 622895325144940554
devlog: int = 622895325144940554
code_jam_planning: int = 490217981872177157
summer_aoc_main: int = 988979042847957042
summer_aoc_discussion: int = 996438901331861554
Expand All @@ -107,6 +109,13 @@ class _Categories(EnvConfig, env_prefix="CATEGORY_"):


class Month(enum.IntEnum):
"""
Enum lookup between Months & month numbers.

Can bre replaced with the below when upgrading to 3.12
https://docs.python.org/3/library/calendar.html#calendar.Month
"""

JANUARY = 1
FEBRUARY = 2
MARCH = 3
Expand Down Expand Up @@ -165,7 +174,7 @@ class _Roles(EnvConfig, env_prefix="ROLE_"):
events_lead: int = 778361735739998228
event_runner: int = 940911658799333408
summer_aoc: int = 988801794668908655
code_jam_participants: int = 991678713093705781
code_jam_participants: int = 991678713093705781
helpers: int = 267630620367257601
aoc_completionist: int = 916691790181056532
bots: int = 277546923144249364
Expand All @@ -185,6 +194,8 @@ class _RedisConfig(EnvConfig, env_prefix="REDIS_"):


class Colours:
"""Colour hex values commonly used throughout the bot."""

blue = 0x0279FD
twitter_blue = 0x1DA1F2
bright_green = 0x01D277
Expand Down
2 changes: 1 addition & 1 deletion bot/exts/source.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def get_source_link(self, source_item: SourceType) -> tuple[str, str, int | None
except OSError:
raise commands.BadArgument("Cannot get source for a dynamically-created object.")

lines_extension = f"#L{first_line_no}-L{first_line_no+len(lines)-1}"
lines_extension = f"#L{first_line_no}-L{first_line_no + len(lines) - 1}"
else:
first_line_no = None
lines_extension = ""
Expand Down
2 changes: 1 addition & 1 deletion bot/utils/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def check(message: discord.Message) -> bool:
# Love that duplicate code
for coro in pending:
coro.cancel()
except asyncio.TimeoutError:
except TimeoutError:
raise BadArgument("Timed out.")

# Guaranteed to not error because of isdecimal() in check
Expand Down
2 changes: 1 addition & 1 deletion bot/utils/blurple_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -560,7 +560,7 @@ def unparse(node: ast.AST, nl_able: bool = False, avoid_backslashes: bool = True
module, names, level = node.module, node.names, node.level

return (
f"from{space()}{'.'*level}{module}{space()}import{space()}"
f"from{space()}{'.' * level}{module}{space()}import{space()}"
+ f"{space()},{space()}".join(
f"{name.name}"
+ (f"{space()}as{space()}{name.asname}" if name.asname else "")
Expand Down
5 changes: 2 additions & 3 deletions bot/utils/pagination.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import asyncio
import logging
from collections.abc import Iterable

Expand Down Expand Up @@ -195,7 +194,7 @@ def event_check(reaction_: Reaction, user_: Member) -> bool:
try:
reaction, user = await ctx.bot.wait_for("reaction_add", timeout=timeout, check=event_check)
log.trace(f"Got reaction: {reaction}")
except asyncio.TimeoutError:
except TimeoutError:
log.debug("Timed out waiting for a reaction")
break # We're done, no reactions for the last 5 minutes

Expand Down Expand Up @@ -370,7 +369,7 @@ def check_event(reaction_: Reaction, member: Member) -> bool:
# Start waiting for reactions
try:
reaction, user = await ctx.bot.wait_for("reaction_add", timeout=timeout, check=check_event)
except asyncio.TimeoutError:
except TimeoutError:
log.debug("Timed out waiting for a reaction")
break # We're done, no reactions for the last 5 minutes

Expand Down
Loading
Loading