From 3054b484bcd9bc8a94d2d9b78dae0dc8b1e9506e Mon Sep 17 00:00:00 2001 From: Katelyn Gigante Date: Thu, 4 Dec 2025 13:28:16 +1100 Subject: [PATCH] fix: Fix more type hints to use the covariant Sequence instead of the invariant List --- .../api/http/http_requests/interactions.py | 4 ++-- interactions/client/client.py | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/interactions/api/http/http_requests/interactions.py b/interactions/api/http/http_requests/interactions.py index 0144fb974..0d5e79dab 100644 --- a/interactions/api/http/http_requests/interactions.py +++ b/interactions/api/http/http_requests/interactions.py @@ -1,4 +1,4 @@ -from typing import TYPE_CHECKING, cast +from typing import TYPE_CHECKING, Sequence, cast import discord_typings @@ -84,7 +84,7 @@ async def get_application_commands( ) async def overwrite_application_commands( - self, app_id: "Snowflake_Type", data: list[dict], guild_id: "Snowflake_Type" + self, app_id: "Snowflake_Type", data: Sequence[dict], guild_id: "Snowflake_Type" ) -> list[discord_typings.ApplicationCommandData]: # todo type "data" """ Take a list of commands and overwrite the existing command list within the given scope diff --git a/interactions/client/client.py b/interactions/client/client.py index 0f2ede684..6db7383c7 100644 --- a/interactions/client/client.py +++ b/interactions/client/client.py @@ -1165,8 +1165,8 @@ async def wait_for_component( self, messages: Union[Message, int, list], components: Union[ - List[List[Union["BaseComponent", dict]]], - List[Union["BaseComponent", dict]], + Sequence[Sequence[Union["BaseComponent", dict]]], + Sequence[Union["BaseComponent", dict]], "BaseComponent", dict, ], @@ -1179,8 +1179,8 @@ async def wait_for_component( self, *, components: Union[ - List[List[Union["BaseComponent", dict]]], - List[Union["BaseComponent", dict]], + Sequence[Sequence[Union["BaseComponent", dict]]], + Sequence[Union["BaseComponent", dict]], "BaseComponent", dict, ], @@ -1193,8 +1193,8 @@ async def wait_for_component( self, messages: None, components: Union[ - List[List[Union["BaseComponent", dict]]], - List[Union["BaseComponent", dict]], + Sequence[Sequence[Union["BaseComponent", dict]]], + Sequence[Union["BaseComponent", dict]], "BaseComponent", dict, ], @@ -1661,7 +1661,7 @@ async def sync_scope( self, cmd_scope: "Snowflake_Type", delete_cmds: bool, - local_cmds_json: Dict["Snowflake_Type", List[Dict[str, Any]]], + local_cmds_json: Dict["Snowflake_Type", Sequence[Dict[str, Any]]], ) -> None: """ Sync a single scope. @@ -1746,7 +1746,7 @@ def _build_sync_payload( return sync_payload, sync_needed_flag async def _sync_commands_with_discord( - self, sync_payload: List[Dict[str, Any]], cmd_scope: "Snowflake_Type" + self, sync_payload: Sequence[Dict[str, Any]], cmd_scope: "Snowflake_Type" ) -> None: """ Sync the commands with discord.