Skip to content

Commit

Permalink
fix types oopsie
Browse files Browse the repository at this point in the history
lists aren't hashable, obviously.
  • Loading branch information
katrinafyi committed Dec 3, 2024
1 parent d39fb19 commit 1be5731
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
2 changes: 1 addition & 1 deletion uqcsbot/advent.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@ def make_message_arguments(self) -> Dict[str, Any]:
)

leaderboard = self._build_leaderboard(self._visible_members)
scoreboard_image = render_leaderboard_to_image(leaderboard)
scoreboard_image = render_leaderboard_to_image(tuple(leaderboard))
file = discord.File(io.BytesIO(scoreboard_image), self.basename + ".png")
embed.set_image(url=f"attachment://{file.filename}")

Expand Down
7 changes: 4 additions & 3 deletions uqcsbot/utils/advent_utils.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from typing import (
Any,
DefaultDict,
Iterable,
List,
Literal,
Dict,
Expand Down Expand Up @@ -418,7 +419,7 @@ def render_leaderboard_to_text(leaderboard: Leaderboard) -> str:


def _isolate_leaderboard_layers(
leaderboard: Leaderboard,
leaderboard: Iterable[str | ColourFragment],
) -> Tuple[str, Dict[Colour, str]]:
"""
Given a leaderboard made up of coloured fragments, split the
Expand Down Expand Up @@ -448,7 +449,7 @@ def _isolate_leaderboard_layers(


@lru_cache(maxsize=16)
def render_leaderboard_to_image(leaderboard: Leaderboard) -> bytes:
def render_leaderboard_to_image(leaderboard: Tuple[str | ColourFragment, ...]) -> bytes:
spaces, layers = _isolate_leaderboard_layers(leaderboard)

# NOTE: font choice should support as wide a range of glyphs as possible,
Expand Down Expand Up @@ -477,7 +478,7 @@ def render_leaderboard_to_image(leaderboard: Leaderboard) -> bytes:


def build_leaderboard(
columns: List[LeaderboardColumn], members: List[Member], day: Optional[Day]
columns: List[LeaderboardColumn], members: Iterable[Member], day: Optional[Day]
):
"""
Returns a leaderboard made up of fragments, with the given column configuration
Expand Down

0 comments on commit 1be5731

Please sign in to comment.