|
1 | 1 | # Copyright (c) NiceBots.xyz |
2 | 2 | # SPDX-License-Identifier: MIT |
3 | 3 |
|
4 | | -from typing import TYPE_CHECKING, TypeVar |
| 4 | +from typing import TYPE_CHECKING |
5 | 5 |
|
6 | 6 | import discord |
7 | 7 | import yaml |
|
20 | 20 | logger = main_logger.getChild("i18n") |
21 | 21 |
|
22 | 22 |
|
23 | | -T = TypeVar("T") |
24 | | -V = TypeVar("V") |
25 | | - |
26 | | - |
27 | | -def remove_none(d: dict[T, V]) -> dict[T, V]: |
| 23 | +def remove_none[T, V](d: dict[T, V]) -> dict[T, V]: |
28 | 24 | """Remove None values from a dictionary. |
29 | 25 |
|
30 | 26 | Args: |
@@ -70,18 +66,16 @@ def merge_command_translations( |
70 | 66 | return result |
71 | 67 |
|
72 | 68 |
|
73 | | -CommandT = TypeVar( |
74 | | - "CommandT", |
75 | | - discord.ApplicationCommand, # pyright: ignore[reportMissingTypeArgument] |
76 | | - discord.SlashCommand, |
77 | | - discord.SlashCommandGroup, |
78 | | - prefixed.Command, # pyright: ignore[reportMissingTypeArgument] |
79 | | - discord.MessageCommand, |
80 | | -) |
81 | | - |
82 | | - |
83 | | -def localize_commands( # noqa: PLR0912 |
84 | | - commands: list[CommandT], |
| 69 | +def localize_commands[ # noqa: PLR0912 |
| 70 | + T: ( |
| 71 | + discord.ApplicationCommand, # pyright: ignore[reportMissingTypeArgument] |
| 72 | + discord.SlashCommand, |
| 73 | + discord.SlashCommandGroup, |
| 74 | + prefixed.Command, # pyright: ignore[reportMissingTypeArgument] |
| 75 | + discord.MessageCommand, |
| 76 | + ) |
| 77 | +]( |
| 78 | + commands: list[T], |
85 | 79 | translations: ExtensionTranslation |
86 | 80 | | Deg1CommandTranslation |
87 | 81 | | Deg2CommandTranslation |
|
0 commit comments