Skip to content

Commit b025df5

Browse files
style(pre-commit): auto fixes from pre-commit.com hooks
1 parent 9af88cf commit b025df5

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

discord/components.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
from .types.components import Component as ComponentPayload
5151
from .types.components import ContainerComponent as ContainerComponentPayload
5252
from .types.components import FileComponent as FileComponentPayload
53+
from .types.components import FileUploadComponent as FileUploadComponentPayload
5354
from .types.components import InputText as InputTextComponentPayload
5455
from .types.components import LabelComponent as LabelComponentPayload
5556
from .types.components import MediaGalleryComponent as MediaGalleryComponentPayload
@@ -62,7 +63,6 @@
6263
from .types.components import TextDisplayComponent as TextDisplayComponentPayload
6364
from .types.components import ThumbnailComponent as ThumbnailComponentPayload
6465
from .types.components import UnfurledMediaItem as UnfurledMediaItemPayload
65-
from .types.components import FileUploadComponent as FileUploadComponentPayload
6666

6767
__all__ = (
6868
"Component",
@@ -989,8 +989,8 @@ def __init__(self, data: ThumbnailComponentPayload, state=None):
989989
self.type: ComponentType = try_enum(ComponentType, data["type"])
990990
self.id: int = data.get("id")
991991
self.media: UnfurledMediaItem = (
992-
umi := data.get("media")
993-
) and UnfurledMediaItem.from_dict(umi, state=state)
992+
umi := data.get("media")
993+
) and UnfurledMediaItem.from_dict(umi, state=state)
994994
self.description: str | None = data.get("description")
995995
self.spoiler: bool | None = data.get("spoiler")
996996

discord/types/components.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,9 @@ class FileUploadComponent(BaseComponent):
174174
required: NotRequired[bool]
175175

176176

177-
Component = Union[ActionRow, ButtonComponent, SelectMenu, InputText, FileUploadComponent]
177+
Component = Union[
178+
ActionRow, ButtonComponent, SelectMenu, InputText, FileUploadComponent
179+
]
178180

179181

180182
AllowedContainerComponents = Union[

discord/ui/file_upload.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import os
44
from typing import TYPE_CHECKING
55

6-
from ..message import Attachment
76
from ..components import FileUpload as FileUploadComponent
87
from ..enums import ComponentType
8+
from ..message import Attachment
99

1010
__all__ = ("FileUpload",)
1111

@@ -171,8 +171,12 @@ def values(self) -> list[Attachment] | None:
171171
attachments = []
172172
for attachment_id in self._values:
173173
print(attachment_id)
174-
attachment_data = self._interaction.data["resolved"]["attachments"][attachment_id]
175-
attachments.append(Attachment(state=self._interaction._state, data=attachment_data))
174+
attachment_data = self._interaction.data["resolved"]["attachments"][
175+
attachment_id
176+
]
177+
attachments.append(
178+
Attachment(state=self._interaction._state, data=attachment_data)
179+
)
176180
return attachments
177181

178182
@property
@@ -190,4 +194,3 @@ def refresh_from_modal(self, interaction: Interaction, data: dict) -> None:
190194
@staticmethod
191195
def uses_label() -> bool:
192196
return True
193-

discord/ui/modal.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,13 @@ def add_item(self, item: ModalItem) -> Self:
251251
raise ValueError("You can only have up to 5 items in a modal dialog.")
252252

253253
if not isinstance(item, (InputText, FileUpload, Item)):
254-
raise TypeError(f"expected InputText, FileUpload, or Item, not {item.__class__!r}")
254+
raise TypeError(
255+
f"expected InputText, FileUpload, or Item, not {item.__class__!r}"
256+
)
255257
if isinstance(item, (InputText, FileUpload, Select)) and not item.label:
256-
raise ValueError("InputTexts, FileUploads, and Selects must have a label set")
258+
raise ValueError(
259+
"InputTexts, FileUploads, and Selects must have a label set"
260+
)
257261

258262
self._weights.add_item(item)
259263
self._children.append(item)

0 commit comments

Comments
 (0)