Skip to content

Commit 3054b48

Browse files
committed
fix: Fix more type hints to use the covariant Sequence instead of the invariant List
1 parent 238a2eb commit 3054b48

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

interactions/api/http/http_requests/interactions.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import TYPE_CHECKING, cast
1+
from typing import TYPE_CHECKING, Sequence, cast
22

33
import discord_typings
44

@@ -84,7 +84,7 @@ async def get_application_commands(
8484
)
8585

8686
async def overwrite_application_commands(
87-
self, app_id: "Snowflake_Type", data: list[dict], guild_id: "Snowflake_Type"
87+
self, app_id: "Snowflake_Type", data: Sequence[dict], guild_id: "Snowflake_Type"
8888
) -> list[discord_typings.ApplicationCommandData]: # todo type "data"
8989
"""
9090
Take a list of commands and overwrite the existing command list within the given scope

interactions/client/client.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1165,8 +1165,8 @@ async def wait_for_component(
11651165
self,
11661166
messages: Union[Message, int, list],
11671167
components: Union[
1168-
List[List[Union["BaseComponent", dict]]],
1169-
List[Union["BaseComponent", dict]],
1168+
Sequence[Sequence[Union["BaseComponent", dict]]],
1169+
Sequence[Union["BaseComponent", dict]],
11701170
"BaseComponent",
11711171
dict,
11721172
],
@@ -1179,8 +1179,8 @@ async def wait_for_component(
11791179
self,
11801180
*,
11811181
components: Union[
1182-
List[List[Union["BaseComponent", dict]]],
1183-
List[Union["BaseComponent", dict]],
1182+
Sequence[Sequence[Union["BaseComponent", dict]]],
1183+
Sequence[Union["BaseComponent", dict]],
11841184
"BaseComponent",
11851185
dict,
11861186
],
@@ -1193,8 +1193,8 @@ async def wait_for_component(
11931193
self,
11941194
messages: None,
11951195
components: Union[
1196-
List[List[Union["BaseComponent", dict]]],
1197-
List[Union["BaseComponent", dict]],
1196+
Sequence[Sequence[Union["BaseComponent", dict]]],
1197+
Sequence[Union["BaseComponent", dict]],
11981198
"BaseComponent",
11991199
dict,
12001200
],
@@ -1661,7 +1661,7 @@ async def sync_scope(
16611661
self,
16621662
cmd_scope: "Snowflake_Type",
16631663
delete_cmds: bool,
1664-
local_cmds_json: Dict["Snowflake_Type", List[Dict[str, Any]]],
1664+
local_cmds_json: Dict["Snowflake_Type", Sequence[Dict[str, Any]]],
16651665
) -> None:
16661666
"""
16671667
Sync a single scope.
@@ -1746,7 +1746,7 @@ def _build_sync_payload(
17461746
return sync_payload, sync_needed_flag
17471747

17481748
async def _sync_commands_with_discord(
1749-
self, sync_payload: List[Dict[str, Any]], cmd_scope: "Snowflake_Type"
1749+
self, sync_payload: Sequence[Dict[str, Any]], cmd_scope: "Snowflake_Type"
17501750
) -> None:
17511751
"""
17521752
Sync the commands with discord.

0 commit comments

Comments
 (0)