aboutsummaryrefslogtreecommitdiffstats
path: root/bot/exts/core/extensions.py
diff options
context:
space:
mode:
authorGravatar Chris Lovering <[email protected]>2023-05-06 16:12:32 +0100
committerGravatar Chris Lovering <[email protected]>2023-05-09 15:41:50 +0100
commit613840ebcf303e84048d48ace37fb001c1afe687 (patch)
tree9acaf0bae0527fe8389483a419b44e06997ca060 /bot/exts/core/extensions.py
parentMigrate to ruff (diff)
Apply fixes for ruff linting
Co-authored-by: wookie184 <[email protected]> Co-authored-by: Amrou Bellalouna <[email protected]>
Diffstat (limited to 'bot/exts/core/extensions.py')
-rw-r--r--bot/exts/core/extensions.py16
1 files changed, 7 insertions, 9 deletions
diff --git a/bot/exts/core/extensions.py b/bot/exts/core/extensions.py
index 1d22cf37..87ef2ed1 100644
--- a/bot/exts/core/extensions.py
+++ b/bot/exts/core/extensions.py
@@ -2,7 +2,6 @@ import functools
import logging
from collections.abc import Mapping
from enum import Enum
-from typing import Optional
from discord import Colour, Embed
from discord.ext import commands
@@ -48,7 +47,7 @@ class Extension(commands.Converter):
if argument in ctx.bot.all_extensions:
return argument
- elif (qualified_arg := f"{exts.__name__}.{argument}") in ctx.bot.all_extensions:
+ if (qualified_arg := f"{exts.__name__}.{argument}") in ctx.bot.all_extensions:
return qualified_arg
matches = []
@@ -63,10 +62,9 @@ class Extension(commands.Converter):
f":x: `{argument}` is an ambiguous extension name. "
f"Please use one of the following fully-qualified names.```\n{names}\n```"
)
- elif matches:
+ if matches:
return matches[0]
- else:
- raise commands.BadArgument(f":x: Could not find the extension `{argument}`.")
+ raise commands.BadArgument(f":x: Could not find the extension `{argument}`.")
class Extensions(commands.Cog):
@@ -86,7 +84,7 @@ class Extensions(commands.Cog):
Load extensions given their fully qualified or unqualified names.
If '\*' or '\*\*' is given as the name, all unloaded extensions will be loaded.
- """ # noqa: W605
+ """
if not extensions:
await self.bot.invoke_help_command(ctx)
return
@@ -103,7 +101,7 @@ class Extensions(commands.Cog):
Unload currently loaded extensions given their fully qualified or unqualified names.
If '\*' or '\*\*' is given as the name, all loaded extensions will be unloaded.
- """ # noqa: W605
+ """
if not extensions:
await self.bot.invoke_help_command(ctx)
return
@@ -129,7 +127,7 @@ class Extensions(commands.Cog):
If '\*' is given as the name, all currently loaded extensions will be reloaded.
If '\*\*' is given as the name, all extensions, including unloaded ones, will be reloaded.
- """ # noqa: W605
+ """
if not extensions:
await self.bot.invoke_help_command(ctx)
return
@@ -220,7 +218,7 @@ class Extensions(commands.Cog):
return msg
- async def manage(self, action: Action, ext: str) -> tuple[str, Optional[str]]:
+ async def manage(self, action: Action, ext: str) -> tuple[str, str | None]:
"""Apply an action to an extension and return the status message and any error message."""
verb = action.name.lower()
error_msg = None