Skip to content

Commit cb33876

Browse files
Bump python to 3.14 (#774)
1 parent 4738f3d commit cb33876

59 files changed

Lines changed: 835 additions & 640 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.python-version‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
3.13
1+
3.14

‎Dockerfile‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM ghcr.io/astral-sh/uv:python3.13-trixie-slim AS builder
1+
FROM ghcr.io/astral-sh/uv:python3.14-trixie-slim AS builder
22

33
RUN apt-get update && \
44
apt-get upgrade -y && \
@@ -20,7 +20,7 @@ COPY utils/ /app/utils/
2020
COPY db/ /app/db/
2121
COPY cogs/ /app/cogs/
2222

23-
FROM python:3.13-slim-trixie
23+
FROM python:3.14-slim-trixie
2424

2525
RUN groupadd --system --gid 999 nonroot && useradd --system --gid 999 --uid 999 --create-home nonroot
2626

‎cogs/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@
5050

5151
from utils import TeXBot, TeXBotBaseCog
5252

53-
__all__: "Sequence[str]" = (
53+
__all__: Sequence[str] = (
5454
"AddUsersToThreadsAndChannelsCommandCog",
5555
"AnnualRolesResetCommandCog",
5656
"AnnualYearChannelsIncrementCommandCog",
@@ -89,7 +89,7 @@
8989
)
9090

9191

92-
def setup(bot: "TeXBot") -> None:
92+
def setup(bot: TeXBot) -> None:
9393
"""Add all the cogs to the bot, at bot startup."""
9494
cogs: Iterable[type[TeXBotBaseCog]] = (
9595
AddUsersToThreadsAndChannelsCommandsCog,

‎cogs/add_users_to_threads_and_channels.py‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,24 +20,24 @@
2020
from utils import TeXBotApplicationContext, TeXBotAutocompleteContext
2121

2222

23-
__all__: "Sequence[str]" = ("AddUsersToThreadsAndChannelsCommandsCog",)
23+
__all__: Sequence[str] = ("AddUsersToThreadsAndChannelsCommandsCog",)
2424

2525

26-
logger: "Final[Logger]" = logging.getLogger("TeX-Bot")
26+
logger: Final[Logger] = logging.getLogger("TeX-Bot")
2727

2828

2929
class AddUsersToThreadsAndChannelsCommandsCog(TeXBotBaseCog):
3030
"""Cog for adding users to threads."""
3131

3232
@staticmethod
3333
async def autocomplete_get_members(
34-
ctx: "TeXBotAutocompleteContext",
35-
) -> "AbstractSet[discord.OptionChoice] | AbstractSet[str]":
34+
ctx: TeXBotAutocompleteContext,
35+
) -> AbstractSet[discord.OptionChoice] | AbstractSet[str]:
3636
"""Autocomplete callable that generates the set of available selectable members."""
3737
try:
3838
main_guild: discord.Guild = ctx.bot.main_guild
3939
guest_role: discord.Role = await ctx.bot.guest_role
40-
except (GuildDoesNotExistError, GuestRoleDoesNotExistError):
40+
except GuildDoesNotExistError, GuestRoleDoesNotExistError:
4141
return set()
4242

4343
members: set[discord.Member] = {
@@ -58,8 +58,8 @@ async def autocomplete_get_members(
5858

5959
@staticmethod
6060
async def autocomplete_get_roles(
61-
ctx: "TeXBotAutocompleteContext",
62-
) -> "AbstractSet[discord.OptionChoice] | AbstractSet[str]":
61+
ctx: TeXBotAutocompleteContext,
62+
) -> AbstractSet[discord.OptionChoice] | AbstractSet[str]:
6363
"""Autocomplete callable that generates the set of available selectable roles."""
6464
try:
6565
main_guild: discord.Guild = ctx.bot.main_guild
@@ -205,7 +205,7 @@ async def on_thread_create(self, thread: discord.Thread) -> None:
205205
@CommandChecks.check_interaction_user_in_main_guild
206206
async def add_user_to_channel(
207207
self,
208-
ctx: "TeXBotApplicationContext",
208+
ctx: TeXBotApplicationContext,
209209
user_id_str: str,
210210
silent: bool, # noqa: FBT001
211211
) -> None:
@@ -260,7 +260,7 @@ async def add_user_to_channel(
260260
@CommandChecks.check_interaction_user_in_main_guild
261261
async def add_role_to_channel(
262262
self,
263-
ctx: "TeXBotApplicationContext",
263+
ctx: TeXBotApplicationContext,
264264
role_id_str: str,
265265
silent: bool, # noqa: FBT001
266266
) -> None:

‎cogs/annual_handover_and_reset.py‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,14 @@
1717

1818
from utils import AllChannelTypes, TeXBotApplicationContext
1919

20-
__all__: "Sequence[str]" = (
20+
__all__: Sequence[str] = (
2121
"AnnualRolesResetCommandCog",
2222
"AnnualYearChannelsIncrementCommandCog",
2323
"CommitteeHandoverCommandCog",
2424
)
2525

2626

27-
logger: "Final[Logger]" = logging.getLogger("TeX-Bot")
27+
logger: Final[Logger] = logging.getLogger("TeX-Bot")
2828

2929

3030
class CommitteeHandoverCommandCog(TeXBotBaseCog):
@@ -36,7 +36,7 @@ class CommitteeHandoverCommandCog(TeXBotBaseCog):
3636
)
3737
@CommandChecks.check_interaction_user_has_committee_role
3838
@CommandChecks.check_interaction_user_in_main_guild
39-
async def committee_handover(self, ctx: "TeXBotApplicationContext") -> None:
39+
async def committee_handover(self, ctx: TeXBotApplicationContext) -> None:
4040
"""
4141
Definition & callback response of the "committee_handover" command.
4242
@@ -165,7 +165,7 @@ async def committee_handover(self, ctx: "TeXBotApplicationContext") -> None:
165165
class AnnualRolesResetCommandCog(TeXBotBaseCog):
166166
"""Cog class that defines the "/annual-roles-reset" command."""
167167

168-
ACADEMIC_YEAR_ROLE_NAMES: "Final[frozenset[str]]" = frozenset(
168+
ACADEMIC_YEAR_ROLE_NAMES: Final[frozenset[str]] = frozenset(
169169
{
170170
"Foundation Year",
171171
"First Year",
@@ -184,7 +184,7 @@ class AnnualRolesResetCommandCog(TeXBotBaseCog):
184184
)
185185
@CommandChecks.check_interaction_user_has_committee_role
186186
@CommandChecks.check_interaction_user_in_main_guild
187-
async def annual_roles_reset(self, ctx: "TeXBotApplicationContext") -> None:
187+
async def annual_roles_reset(self, ctx: TeXBotApplicationContext) -> None:
188188
"""
189189
Definition & callback response of the "annual_roles_reset" command.
190190
@@ -273,7 +273,7 @@ class AnnualYearChannelsIncrementCommandCog(TeXBotBaseCog):
273273
)
274274
@CommandChecks.check_interaction_user_has_committee_role
275275
@CommandChecks.check_interaction_user_in_main_guild
276-
async def increment_year_channels(self, ctx: "TeXBotApplicationContext") -> None:
276+
async def increment_year_channels(self, ctx: TeXBotApplicationContext) -> None:
277277
"""
278278
Definition and callback response of the "increment_year_channels" command.
279279

‎cogs/archive.py‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,19 +18,19 @@
1818

1919
from utils import AllChannelTypes, TeXBotApplicationContext, TeXBotAutocompleteContext
2020

21-
__all__: "Sequence[str]" = ("ArchiveCommandsCog",)
21+
__all__: Sequence[str] = ("ArchiveCommandsCog",)
2222

2323

24-
logger: "Final[Logger]" = logging.getLogger("TeX-Bot")
24+
logger: Final[Logger] = logging.getLogger("TeX-Bot")
2525

2626

2727
class ArchiveCommandsCog(TeXBotBaseCog):
2828
"""Cog class that defines the "/archive" command and its call-back method."""
2929

3030
@staticmethod
3131
async def autocomplete_get_non_archival_categories(
32-
ctx: "TeXBotAutocompleteContext",
33-
) -> "AbstractSet[discord.OptionChoice] | AbstractSet[str]":
32+
ctx: TeXBotAutocompleteContext,
33+
) -> AbstractSet[discord.OptionChoice] | AbstractSet[str]:
3434
"""
3535
Autocomplete callable that generates the set of available selectable categories.
3636
@@ -50,8 +50,8 @@ async def autocomplete_get_non_archival_categories(
5050

5151
@staticmethod
5252
async def autocomplete_get_archival_categories(
53-
ctx: "TeXBotAutocompleteContext",
54-
) -> "AbstractSet[discord.OptionChoice] | AbstractSet[str]":
53+
ctx: TeXBotAutocompleteContext,
54+
) -> AbstractSet[discord.OptionChoice] | AbstractSet[str]:
5555
"""
5656
Autocomplete callable that generates the set of categories to hold archived channels.
5757
@@ -72,8 +72,8 @@ async def autocomplete_get_archival_categories(
7272

7373
@staticmethod
7474
async def autocomplete_get_non_archived_channels(
75-
ctx: "TeXBotAutocompleteContext",
76-
) -> "AbstractSet[discord.OptionChoice] | AbstractSet[str]":
75+
ctx: TeXBotAutocompleteContext,
76+
) -> AbstractSet[discord.OptionChoice] | AbstractSet[str]:
7777
"""
7878
Autocomplete callable that generates the set of channels that the user can archive.
7979
@@ -123,7 +123,7 @@ async def autocomplete_get_non_archived_channels(
123123
@CommandChecks.check_interaction_user_in_main_guild
124124
async def archive_category(
125125
self,
126-
ctx: "TeXBotApplicationContext",
126+
ctx: TeXBotApplicationContext,
127127
str_category_id: str,
128128
allow_archivist: bool, # noqa: FBT001
129129
) -> None:
@@ -236,7 +236,7 @@ async def archive_category(
236236
@CommandChecks.check_interaction_user_has_committee_role
237237
@CommandChecks.check_interaction_user_in_main_guild
238238
async def archive_channel(
239-
self, ctx: "TeXBotApplicationContext", str_channel_id: str, str_category_id: str
239+
self, ctx: TeXBotApplicationContext, str_channel_id: str, str_category_id: str
240240
) -> None:
241241
"""
242242
Definition & callback response of the "archive-channel" command.

‎cogs/check_su_platform_authorisation.py‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -23,19 +23,17 @@
2323

2424
from utils import TeXBot, TeXBotApplicationContext
2525

26-
__all__: "Sequence[str]" = (
26+
__all__: Sequence[str] = (
2727
"CheckSUPlatformAuthorisationCommandCog",
2828
"CheckSUPlatformAuthorisationTaskCog",
2929
)
3030

3131

32-
logger: "Final[Logger]" = logging.getLogger("TeX-Bot")
32+
logger: Final[Logger] = logging.getLogger("TeX-Bot")
3333

3434

35-
SU_PLATFORM_PROFILE_URL: "Final[str]" = "https://guildofstudents.com/profile"
36-
SU_PLATFORM_ORGANISATION_URL: "Final[str]" = (
37-
"https://www.guildofstudents.com/organisation/admin"
38-
)
35+
SU_PLATFORM_PROFILE_URL: Final[str] = "https://guildofstudents.com/profile"
36+
SU_PLATFORM_ORGANISATION_URL: Final[str] = "https://www.guildofstudents.com/organisation/admin"
3937

4038

4139
class SUPlatformAccessCookieStatus(Enum):
@@ -93,7 +91,7 @@ async def get_su_platform_access_cookie_status(self) -> SUPlatformAccessCookieSt
9391
)
9492
return SUPlatformAccessCookieStatus.INVALID
9593

96-
async def get_su_platform_organisations(self) -> "Iterable[str]":
94+
async def get_su_platform_organisations(self) -> Iterable[str]:
9795
"""Retrieve the MSL organisations the current SU platform cookie has access to."""
9896
response_object: bs4.BeautifulSoup = bs4.BeautifulSoup(
9997
await fetch_url_content_with_session(SU_PLATFORM_PROFILE_URL), "html.parser"
@@ -170,7 +168,7 @@ class CheckSUPlatformAuthorisationCommandCog(CheckSUPlatformAuthorisationBaseCog
170168
)
171169
@CommandChecks.check_interaction_user_has_committee_role
172170
@CommandChecks.check_interaction_user_in_main_guild
173-
async def check_su_platform_authorisation(self, ctx: "TeXBotApplicationContext") -> None:
171+
async def check_su_platform_authorisation(self, ctx: TeXBotApplicationContext) -> None:
174172
"""
175173
Definition of the "check_su_platform_authorisation" command.
176174
@@ -209,7 +207,7 @@ class CheckSUPlatformAuthorisationTaskCog(CheckSUPlatformAuthorisationBaseCog):
209207
"""Cog class defining a repeated task for checking SU platform access cookie."""
210208

211209
@override
212-
def __init__(self, bot: "TeXBot") -> None:
210+
def __init__(self, bot: TeXBot) -> None:
213211
"""Start all task managers when this cog is initialised."""
214212
if settings["AUTO_SU_PLATFORM_ACCESS_COOKIE_CHECKING"]:
215213
_ = self.su_platform_access_cookie_check_task.start()

‎cogs/command_error.py‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,18 +18,18 @@
1818

1919
from utils import TeXBotApplicationContext
2020

21-
__all__: "Sequence[str]" = ("CommandErrorCog",)
21+
__all__: Sequence[str] = ("CommandErrorCog",)
2222

2323

24-
logger: "Final[Logger]" = logging.getLogger("TeX-Bot")
24+
logger: Final[Logger] = logging.getLogger("TeX-Bot")
2525

2626

2727
class CommandErrorCog(TeXBotBaseCog):
2828
"""Cog class that defines additional code to execute upon a command error."""
2929

3030
@TeXBotBaseCog.listener()
3131
async def on_application_command_error(
32-
self, ctx: "TeXBotApplicationContext", error: discord.ApplicationCommandError
32+
self, ctx: TeXBotApplicationContext, error: discord.ApplicationCommandError
3333
) -> None:
3434
"""Log any major command errors in the logging channel & stderr."""
3535
error_code: str | None = None

0 commit comments

Comments
 (0)