aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/christmas
diff options
context:
space:
mode:
Diffstat (limited to 'bot/exts/christmas')
-rw-r--r--bot/exts/christmas/advent_of_code/_cog.py2
-rw-r--r--bot/exts/christmas/advent_of_code/_helpers.py15
-rw-r--r--bot/exts/christmas/hanukkah_embed.py5
3 files changed, 10 insertions, 12 deletions
diff --git a/bot/exts/christmas/advent_of_code/_cog.py b/bot/exts/christmas/advent_of_code/_cog.py
index 3d61753b..bc2ccc04 100644
--- a/bot/exts/christmas/advent_of_code/_cog.py
+++ b/bot/exts/christmas/advent_of_code/_cog.py
@@ -29,7 +29,7 @@ AOC_WHITELIST = AOC_WHITELIST_RESTRICTED + (Channels.advent_of_code,)
class AdventOfCode(commands.Cog):
"""Advent of Code festivities! Ho Ho Ho!"""
- def __init__(self, bot: Bot) -> None:
+ def __init__(self, bot: Bot):
self.bot = bot
self._base_url = f"https://adventofcode.com/{AocConfig.year}"
diff --git a/bot/exts/christmas/advent_of_code/_helpers.py b/bot/exts/christmas/advent_of_code/_helpers.py
index e26a17ca..b64b44a6 100644
--- a/bot/exts/christmas/advent_of_code/_helpers.py
+++ b/bot/exts/christmas/advent_of_code/_helpers.py
@@ -5,8 +5,7 @@ import json
import logging
import math
import operator
-import typing
-from typing import Tuple
+from typing import Any, Optional
import aiohttp
import arrow
@@ -71,7 +70,7 @@ class FetchingLeaderboardFailedError(Exception):
"""Raised when one or more leaderboards could not be fetched at all."""
-def leaderboard_sorting_function(entry: typing.Tuple[str, dict]) -> typing.Tuple[int, int]:
+def leaderboard_sorting_function(entry: tuple[str, dict]) -> tuple[int, int]:
"""
Provide a sorting value for our leaderboard.
@@ -155,7 +154,7 @@ def _parse_raw_leaderboard_data(raw_leaderboard_data: dict) -> dict:
return {"daily_stats": daily_stats, "leaderboard": sorted_leaderboard}
-def _format_leaderboard(leaderboard: typing.Dict[str, dict]) -> str:
+def _format_leaderboard(leaderboard: dict[str, dict]) -> str:
"""Format the leaderboard using the AOC_TABLE_TEMPLATE."""
leaderboard_lines = [HEADER]
for rank, data in enumerate(leaderboard.values(), start=1):
@@ -171,7 +170,7 @@ def _format_leaderboard(leaderboard: typing.Dict[str, dict]) -> str:
return "\n".join(leaderboard_lines)
-async def _leaderboard_request(url: str, board: int, cookies: dict) -> typing.Optional[dict]:
+async def _leaderboard_request(url: str, board: str, cookies: dict) -> dict[str, Any]:
"""Make a leaderboard request using the specified session cookie."""
async with aiohttp.request("GET", url, headers=AOC_REQUEST_HEADER, cookies=cookies) as resp:
# The Advent of Code website redirects silently with a 200 response if a
@@ -188,7 +187,7 @@ async def _leaderboard_request(url: str, board: int, cookies: dict) -> typing.Op
return await resp.json()
-async def _fetch_leaderboard_data() -> typing.Dict[str, typing.Any]:
+async def _fetch_leaderboard_data() -> dict[str, Any]:
"""Fetch data for all leaderboards and return a pooled result."""
year = AdventOfCode.year
@@ -333,7 +332,7 @@ def get_summary_embed(leaderboard: dict) -> discord.Embed:
return aoc_embed
-async def get_public_join_code(author: discord.Member) -> typing.Optional[str]:
+async def get_public_join_code(author: discord.Member) -> Optional[str]:
"""
Get the join code for one of the non-staff leaderboards.
@@ -398,7 +397,7 @@ def is_in_advent() -> bool:
return arrow.now(EST).day in range(1, 25) and arrow.now(EST).month == 12
-def time_left_to_est_midnight() -> Tuple[datetime.datetime, datetime.timedelta]:
+def time_left_to_est_midnight() -> tuple[datetime.datetime, datetime.timedelta]:
"""Calculate the amount of time left until midnight EST/UTC-5."""
# Change all time properties back to 00:00
todays_midnight = arrow.now(EST).replace(
diff --git a/bot/exts/christmas/hanukkah_embed.py b/bot/exts/christmas/hanukkah_embed.py
index 119f2446..00125be3 100644
--- a/bot/exts/christmas/hanukkah_embed.py
+++ b/bot/exts/christmas/hanukkah_embed.py
@@ -1,6 +1,5 @@
import datetime
import logging
-from typing import List
from discord import Embed
from discord.ext import commands
@@ -26,7 +25,7 @@ class HanukkahEmbed(commands.Cog):
self.hanukkah_months = []
self.hanukkah_years = []
- async def get_hanukkah_dates(self) -> List[str]:
+ async def get_hanukkah_dates(self) -> list[str]:
"""Gets the dates for hanukkah festival."""
hanukkah_dates = []
async with self.bot.http_session.get(HEBCAL_URL) as response:
@@ -101,7 +100,7 @@ class HanukkahEmbed(commands.Cog):
await ctx.send(embed=embed)
- def hanukkah_dates_split(self, hanukkah_dates: List[str]) -> None:
+ def hanukkah_dates_split(self, hanukkah_dates: list[str]) -> None:
"""We are splitting the dates for hanukkah into days, months and years."""
for date in hanukkah_dates:
self.hanukkah_days.append(date[8:10])