|
6 | 6 | import time
|
7 | 7 | from functools import partial
|
8 | 8 | from itertools import groupby
|
9 |
| -from typing import TYPE_CHECKING, Any, Callable, TypeVar, Union |
| 9 | +from typing import TYPE_CHECKING, Any, TypeVar, Union |
10 | 10 |
|
11 | 11 | from ..enums import ComponentType
|
12 | 12 | from ..utils import find
|
@@ -171,13 +171,13 @@ def add_item(self, item: ModalItem) -> Self:
|
171 | 171 | Parameters
|
172 | 172 | ----------
|
173 | 173 | item: Union[class:`InputText`, :class:`Item`]
|
174 |
| - The item to add to the modal |
| 174 | + The item to add to the modal |
175 | 175 | """
|
176 | 176 |
|
177 | 177 | if len(self._children) > 5:
|
178 | 178 | raise ValueError("You can only have up to 5 items in a modal.")
|
179 | 179 |
|
180 |
| - if not isinstance(item, (Item, )): |
| 180 | + if not isinstance(item, (Item,)): |
181 | 181 | raise TypeError(f"expected Item, not {item.__class__!r}")
|
182 | 182 |
|
183 | 183 | self._children.append(item)
|
@@ -239,6 +239,7 @@ async def on_timeout(self) -> None:
|
239 | 239 | A callback that is called when a modal's timeout elapses without being explicitly stopped.
|
240 | 240 | """
|
241 | 241 |
|
| 242 | + |
242 | 243 | class Modal(BaseModal):
|
243 | 244 | """Represents a UI modal for InputText components.
|
244 | 245 |
|
@@ -338,6 +339,7 @@ def remove_item(self, item: ModalItem) -> Self:
|
338 | 339 | pass
|
339 | 340 | return self
|
340 | 341 |
|
| 342 | + |
341 | 343 | class DesignerModal(BaseModal):
|
342 | 344 | """Represents a UI modal compatible with all modal features.
|
343 | 345 |
|
@@ -388,8 +390,10 @@ def add_item(self, item: ModalItem) -> Self:
|
388 | 390 | The item to add to the modal
|
389 | 391 | """
|
390 | 392 |
|
391 |
| - if isinstance(item, (InputText, )): |
392 |
| - raise TypeError(f"DesignerModal does not accept InputText directly. Use Label instead.") |
| 393 | + if isinstance(item, (InputText,)): |
| 394 | + raise TypeError( |
| 395 | + f"DesignerModal does not accept InputText directly. Use Label instead." |
| 396 | + ) |
393 | 397 |
|
394 | 398 | super().add_item(item)
|
395 | 399 | return self
|
|
0 commit comments