Replace invariant container types with wider types where applicable

This commit is contained in:
Josh
2022-03-17 21:26:01 +10:00
committed by GitHub
parent 3e77a7b29e
commit e01d4a31eb
9 changed files with 88 additions and 83 deletions

View File

@ -37,7 +37,7 @@ import time
import re
from urllib.parse import quote as urlquote
from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Tuple, Union, TypeVar, Type, overload
from typing import Any, Dict, List, Literal, Optional, TYPE_CHECKING, Sequence, Tuple, Union, TypeVar, Type, overload
import weakref
from .. import utils
@ -116,7 +116,7 @@ class WebhookAdapter:
*,
payload: Optional[Dict[str, Any]] = None,
multipart: Optional[List[Dict[str, Any]]] = None,
files: Optional[List[File]] = None,
files: Optional[Sequence[File]] = None,
reason: Optional[str] = None,
auth_token: Optional[str] = None,
params: Optional[Dict[str, Any]] = None,
@ -279,7 +279,7 @@ class WebhookAdapter:
session: Session,
payload: Optional[Dict[str, Any]] = None,
multipart: Optional[List[Dict[str, Any]]] = None,
files: Optional[List[File]] = None,
files: Optional[Sequence[File]] = None,
thread_id: Optional[int] = None,
wait: bool = False,
) -> MessagePayload:
@ -315,7 +315,7 @@ class WebhookAdapter:
session: Session,
payload: Optional[Dict[str, Any]] = None,
multipart: Optional[List[Dict[str, Any]]] = None,
files: Optional[List[File]] = None,
files: Optional[Sequence[File]] = None,
) -> MessagePayload:
route = Route(
'PATCH',
@ -394,9 +394,9 @@ class SyncWebhookMessage(Message):
def edit(
self,
content: Optional[str] = MISSING,
embeds: List[Embed] = MISSING,
embeds: Sequence[Embed] = MISSING,
embed: Optional[Embed] = MISSING,
attachments: List[Union[Attachment, File]] = MISSING,
attachments: Sequence[Union[Attachment, File]] = MISSING,
allowed_mentions: Optional[AllowedMentions] = None,
) -> SyncWebhookMessage:
"""Edits the message.
@ -848,9 +848,9 @@ class SyncWebhook(BaseWebhook):
avatar_url: Any = MISSING,
tts: bool = MISSING,
file: File = MISSING,
files: List[File] = MISSING,
files: Sequence[File] = MISSING,
embed: Embed = MISSING,
embeds: List[Embed] = MISSING,
embeds: Sequence[Embed] = MISSING,
allowed_mentions: AllowedMentions = MISSING,
wait: Literal[True],
suppress_embeds: bool = MISSING,
@ -866,9 +866,9 @@ class SyncWebhook(BaseWebhook):
avatar_url: Any = MISSING,
tts: bool = MISSING,
file: File = MISSING,
files: List[File] = MISSING,
files: Sequence[File] = MISSING,
embed: Embed = MISSING,
embeds: List[Embed] = MISSING,
embeds: Sequence[Embed] = MISSING,
allowed_mentions: AllowedMentions = MISSING,
wait: Literal[False] = ...,
suppress_embeds: bool = MISSING,
@ -883,9 +883,9 @@ class SyncWebhook(BaseWebhook):
avatar_url: Any = MISSING,
tts: bool = False,
file: File = MISSING,
files: List[File] = MISSING,
files: Sequence[File] = MISSING,
embed: Embed = MISSING,
embeds: List[Embed] = MISSING,
embeds: Sequence[Embed] = MISSING,
allowed_mentions: AllowedMentions = MISSING,
thread: Snowflake = MISSING,
wait: bool = False,
@ -1050,9 +1050,9 @@ class SyncWebhook(BaseWebhook):
message_id: int,
*,
content: Optional[str] = MISSING,
embeds: List[Embed] = MISSING,
embeds: Sequence[Embed] = MISSING,
embed: Optional[Embed] = MISSING,
attachments: List[Union[Attachment, File]] = MISSING,
attachments: Sequence[Union[Attachment, File]] = MISSING,
allowed_mentions: Optional[AllowedMentions] = None,
) -> SyncWebhookMessage:
"""Edits a message owned by this webhook.