Skip to content

Commit 169fe86

Browse files
committed
sonarcloud...
1 parent 3bbdbdd commit 169fe86

File tree

5 files changed

+16
-8
lines changed

5 files changed

+16
-8
lines changed

src/cogs/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING, Annotated, Union
3+
from typing import TYPE_CHECKING, Annotated
44

55
import discord
66
from discord import app_commands
@@ -40,7 +40,7 @@ def display_emoji(self) -> discord.PartialEmoji:
4040

4141
### Prefix utilities
4242

43-
def _clean_prefixes(self, prefixes: Union[str, list[str]]) -> str:
43+
def _clean_prefixes(self, prefixes: str | list[str]) -> str:
4444
if isinstance(prefixes, str):
4545
return f"`{prefixes}`"
4646

src/utils/checks.py

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

1919

2020
async def check_guild_permissions(
21-
ctx: KumikoContext, perms: dict[str, bool], *, check: bool = all
21+
ctx: KumikoContext,
22+
perms: dict[str, bool],
23+
*,
24+
check=all, # noqa: ANN001
2225
) -> bool:
2326
is_owner = await ctx.bot.is_owner(ctx.author)
2427
if is_owner:
@@ -34,7 +37,10 @@ async def check_guild_permissions(
3437

3538

3639
async def check_bot_permissions(
37-
ctx: KumikoContext, perms: dict[str, bool], *, check: bool = all
40+
ctx: KumikoContext,
41+
perms: dict[str, bool],
42+
*,
43+
check=all, # noqa: ANN001
3844
) -> bool:
3945
is_owner = await ctx.bot.is_owner(ctx.author)
4046
if is_owner:

src/utils/pages/paginator.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -205,6 +205,7 @@ async def go_to_previous_page(
205205
async def go_to_current_page(
206206
self, interaction: discord.Interaction, button: discord.ui.Button
207207
) -> None:
208+
# In the middle button, so no need for impl
208209
pass
209210

210211
@discord.ui.button(label="Next", style=discord.ButtonStyle.blurple)

src/utils/prefix.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
from __future__ import annotations
22

3-
from typing import TYPE_CHECKING, Union
3+
from typing import TYPE_CHECKING
44

55
from async_lru import alru_cache
66

@@ -11,7 +11,7 @@
1111

1212

1313
@alru_cache(maxsize=1024)
14-
async def get_prefix(bot: Kumiko, message: discord.Message) -> Union[str, list[str]]:
14+
async def get_prefix(bot: Kumiko, message: discord.Message) -> str | list[str]:
1515
"""Obtains the prefix for the guild
1616
1717
This coroutine is heavily cached in order to reduce database calls
@@ -44,5 +44,6 @@ async def get_prefix(bot: Kumiko, message: discord.Message) -> Union[str, list[s
4444
if prefixes is None:
4545
get_prefix.cache_invalidate(bot, message)
4646
return base
47+
4748
base.extend(item for item in prefixes)
4849
return base

src/utils/reloader.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ async def reload_or_load_extension(self, module: str) -> None:
4040
await self.bot.load_extension(module)
4141
self.logger.info("Loaded extension: %s", module)
4242

43-
async def reload_lib_modules(self, module: str) -> None:
43+
def reload_lib_modules(self, module: str) -> None:
4444
try:
4545
actual_module = sys.modules[module]
4646
importlib.reload(actual_module)
@@ -69,7 +69,7 @@ async def reload_cogs_and_libs(self, ctype: Change, true_module: str) -> None:
6969
await self.bot.unload_extension(true_module)
7070
elif true_module.startswith("libs"):
7171
self.logger.info("Reloaded library module: %s", true_module)
72-
await self.reload_lib_modules(true_module)
72+
self.reload_lib_modules(true_module)
7373

7474
async def _watch_cogs(self):
7575
async for changes in awatch(self._cogs_path, self._libs_path, recursive=True):

0 commit comments

Comments
 (0)