From 2a426697a79a5ad3c32f06443340c98884c49f93 Mon Sep 17 00:00:00 2001 From: wookie184 Date: Tue, 8 Apr 2025 12:56:48 +0100 Subject: Use enum.member instead of functools.partial workaround The workaround would no longer work in future versions --- bot/exts/core/extensions.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/bot/exts/core/extensions.py b/bot/exts/core/extensions.py index 24a28e2b..d8cb6f0c 100644 --- a/bot/exts/core/extensions.py +++ b/bot/exts/core/extensions.py @@ -1,6 +1,5 @@ -import functools from collections.abc import Mapping -from enum import Enum +from enum import Enum, member from discord import Colour, Embed from discord.ext import commands @@ -24,10 +23,9 @@ BASE_PATH_LEN = len(exts.__name__.split(".")) class Action(Enum): """Represents an action to perform on an extension.""" - # Need to be partial otherwise they are considered to be function definitions. - LOAD = functools.partial(Bot.load_extension) - UNLOAD = functools.partial(Bot.unload_extension) - RELOAD = functools.partial(Bot.reload_extension) + LOAD = member(Bot.load_extension) + UNLOAD = member(Bot.unload_extension) + RELOAD = member(Bot.reload_extension) class Extension(commands.Converter): -- cgit v1.2.3