mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-10-22 00:13:01 +00:00
Replace invariant container types with wider types where applicable
This commit is contained in:
@@ -31,9 +31,11 @@ from typing import (
|
||||
Any,
|
||||
AsyncIterator,
|
||||
ClassVar,
|
||||
Collection,
|
||||
Coroutine,
|
||||
Dict,
|
||||
List,
|
||||
Mapping,
|
||||
NamedTuple,
|
||||
Sequence,
|
||||
Set,
|
||||
@@ -1063,7 +1065,7 @@ class Guild(Hashable):
|
||||
self,
|
||||
name: str,
|
||||
channel_type: Literal[ChannelType.text],
|
||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
category: Optional[Snowflake] = ...,
|
||||
**options: Any,
|
||||
) -> Coroutine[Any, Any, TextChannelPayload]:
|
||||
@@ -1074,7 +1076,7 @@ class Guild(Hashable):
|
||||
self,
|
||||
name: str,
|
||||
channel_type: Literal[ChannelType.voice],
|
||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
category: Optional[Snowflake] = ...,
|
||||
**options: Any,
|
||||
) -> Coroutine[Any, Any, VoiceChannelPayload]:
|
||||
@@ -1085,7 +1087,7 @@ class Guild(Hashable):
|
||||
self,
|
||||
name: str,
|
||||
channel_type: Literal[ChannelType.stage_voice],
|
||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
category: Optional[Snowflake] = ...,
|
||||
**options: Any,
|
||||
) -> Coroutine[Any, Any, StageChannelPayload]:
|
||||
@@ -1096,7 +1098,7 @@ class Guild(Hashable):
|
||||
self,
|
||||
name: str,
|
||||
channel_type: Literal[ChannelType.category],
|
||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
category: Optional[Snowflake] = ...,
|
||||
**options: Any,
|
||||
) -> Coroutine[Any, Any, CategoryChannelPayload]:
|
||||
@@ -1107,7 +1109,7 @@ class Guild(Hashable):
|
||||
self,
|
||||
name: str,
|
||||
channel_type: Literal[ChannelType.news],
|
||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
category: Optional[Snowflake] = ...,
|
||||
**options: Any,
|
||||
) -> Coroutine[Any, Any, NewsChannelPayload]:
|
||||
@@ -1118,7 +1120,7 @@ class Guild(Hashable):
|
||||
self,
|
||||
name: str,
|
||||
channel_type: Literal[ChannelType.store],
|
||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
category: Optional[Snowflake] = ...,
|
||||
**options: Any,
|
||||
) -> Coroutine[Any, Any, StoreChannelPayload]:
|
||||
@@ -1129,7 +1131,7 @@ class Guild(Hashable):
|
||||
self,
|
||||
name: str,
|
||||
channel_type: Literal[ChannelType.text],
|
||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
category: Optional[Snowflake] = ...,
|
||||
**options: Any,
|
||||
) -> Coroutine[Any, Any, GuildChannelPayload]:
|
||||
@@ -1140,7 +1142,7 @@ class Guild(Hashable):
|
||||
self,
|
||||
name: str,
|
||||
channel_type: ChannelType,
|
||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = ...,
|
||||
category: Optional[Snowflake] = ...,
|
||||
**options: Any,
|
||||
) -> Coroutine[Any, Any, GuildChannelPayload]:
|
||||
@@ -1150,13 +1152,13 @@ class Guild(Hashable):
|
||||
self,
|
||||
name: str,
|
||||
channel_type: ChannelType,
|
||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||
category: Optional[Snowflake] = None,
|
||||
**options: Any,
|
||||
) -> Coroutine[Any, Any, GuildChannelPayload]:
|
||||
if overwrites is MISSING:
|
||||
overwrites = {}
|
||||
elif not isinstance(overwrites, dict):
|
||||
elif not isinstance(overwrites, Mapping):
|
||||
raise TypeError('overwrites parameter expects a dict.')
|
||||
|
||||
perms = []
|
||||
@@ -1189,7 +1191,7 @@ class Guild(Hashable):
|
||||
topic: str = MISSING,
|
||||
slowmode_delay: int = MISSING,
|
||||
nsfw: bool = MISSING,
|
||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||
) -> TextChannel:
|
||||
"""|coro|
|
||||
|
||||
@@ -1306,7 +1308,7 @@ class Guild(Hashable):
|
||||
user_limit: int = MISSING,
|
||||
rtc_region: Optional[str] = MISSING,
|
||||
video_quality_mode: VideoQualityMode = MISSING,
|
||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||
) -> VoiceChannel:
|
||||
"""|coro|
|
||||
|
||||
@@ -1392,7 +1394,7 @@ class Guild(Hashable):
|
||||
*,
|
||||
topic: str,
|
||||
position: int = MISSING,
|
||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||
category: Optional[CategoryChannel] = None,
|
||||
reason: Optional[str] = None,
|
||||
) -> StageChannel:
|
||||
@@ -1460,7 +1462,7 @@ class Guild(Hashable):
|
||||
self,
|
||||
name: str,
|
||||
*,
|
||||
overwrites: Dict[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||
overwrites: Mapping[Union[Role, Member], PermissionOverwrite] = MISSING,
|
||||
reason: Optional[str] = None,
|
||||
position: int = MISSING,
|
||||
) -> CategoryChannel:
|
||||
@@ -2067,7 +2069,7 @@ class Guild(Hashable):
|
||||
*,
|
||||
days: int,
|
||||
compute_prune_count: bool = True,
|
||||
roles: List[Snowflake] = MISSING,
|
||||
roles: Collection[Snowflake] = MISSING,
|
||||
reason: Optional[str] = None,
|
||||
) -> Optional[int]:
|
||||
r"""|coro|
|
||||
@@ -2183,7 +2185,7 @@ class Guild(Hashable):
|
||||
data = await self._state.http.guild_webhooks(self.id)
|
||||
return [Webhook.from_state(d, state=self._state) for d in data]
|
||||
|
||||
async def estimate_pruned_members(self, *, days: int, roles: List[Snowflake] = MISSING) -> Optional[int]:
|
||||
async def estimate_pruned_members(self, *, days: int, roles: Collection[Snowflake] = MISSING) -> Optional[int]:
|
||||
"""|coro|
|
||||
|
||||
Similar to :meth:`prune_members` except instead of actually
|
||||
@@ -2736,7 +2738,7 @@ class Guild(Hashable):
|
||||
*,
|
||||
name: str,
|
||||
image: bytes,
|
||||
roles: List[Role] = MISSING,
|
||||
roles: Collection[Role] = MISSING,
|
||||
reason: Optional[str] = None,
|
||||
) -> Emoji:
|
||||
r"""|coro|
|
||||
@@ -2965,7 +2967,7 @@ class Guild(Hashable):
|
||||
# TODO: add to cache
|
||||
return role
|
||||
|
||||
async def edit_role_positions(self, positions: Dict[Snowflake, int], *, reason: Optional[str] = None) -> List[Role]:
|
||||
async def edit_role_positions(self, positions: Mapping[Snowflake, int], *, reason: Optional[str] = None) -> List[Role]:
|
||||
"""|coro|
|
||||
|
||||
Bulk edits a list of :class:`Role` in the guild.
|
||||
@@ -3014,7 +3016,7 @@ class Guild(Hashable):
|
||||
List[:class:`Role`]
|
||||
A list of all the roles in the guild.
|
||||
"""
|
||||
if not isinstance(positions, dict):
|
||||
if not isinstance(positions, Mapping):
|
||||
raise TypeError('positions parameter expects a dict.')
|
||||
|
||||
role_positions = []
|
||||
|
Reference in New Issue
Block a user