mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-07 10:22:59 +00:00
Reformat code using black
Segments where readability was hampered were fixed by appropriate format skipping directives. New code should hopefully be black compatible. The moment they remove the -S option is probably the moment I stop using black though.
This commit is contained in:
@ -28,9 +28,11 @@ from typing import Any, Callable, Coroutine, Dict, Generic, Optional, TYPE_CHECK
|
||||
|
||||
from ..interactions import Interaction
|
||||
|
||||
# fmt: off
|
||||
__all__ = (
|
||||
'Item',
|
||||
)
|
||||
# fmt: on
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from ..enums import ComponentType
|
||||
|
@ -42,9 +42,11 @@ if TYPE_CHECKING:
|
||||
from ..types.interactions import ModalSubmitComponentInteractionData as ModalSubmitComponentInteractionDataPayload
|
||||
|
||||
|
||||
# fmt: off
|
||||
__all__ = (
|
||||
'Modal',
|
||||
)
|
||||
# fmt: on
|
||||
|
||||
|
||||
_log = logging.getLogger(__name__)
|
||||
|
@ -224,7 +224,6 @@ class Select(Item[V]):
|
||||
default=default,
|
||||
)
|
||||
|
||||
|
||||
self.append_option(option)
|
||||
|
||||
def append_option(self, option: SelectOption):
|
||||
|
@ -40,10 +40,11 @@ if TYPE_CHECKING:
|
||||
from .view import View
|
||||
|
||||
|
||||
# fmt: off
|
||||
__all__ = (
|
||||
'TextInput',
|
||||
)
|
||||
|
||||
# fmt: on
|
||||
|
||||
V = TypeVar('V', bound='View', covariant=True)
|
||||
|
||||
@ -177,7 +178,7 @@ class TextInput(Item[V]):
|
||||
def max_length(self) -> Optional[int]:
|
||||
""":class:`int`: The maximum length of the text input."""
|
||||
return self._underlying.max_length
|
||||
|
||||
|
||||
@max_length.setter
|
||||
def max_length(self, value: Optional[int]) -> None:
|
||||
self._underlying.max_length = value
|
||||
|
@ -43,9 +43,11 @@ from ..components import (
|
||||
)
|
||||
from ..utils import MISSING
|
||||
|
||||
# fmt: off
|
||||
__all__ = (
|
||||
'View',
|
||||
)
|
||||
# fmt: on
|
||||
|
||||
|
||||
if TYPE_CHECKING:
|
||||
@ -81,9 +83,11 @@ def _component_to_item(component: Component) -> Item:
|
||||
|
||||
|
||||
class _ViewWeights:
|
||||
# fmt: off
|
||||
__slots__ = (
|
||||
'weights',
|
||||
)
|
||||
# fmt: on
|
||||
|
||||
def __init__(self, children: List[Item]):
|
||||
self.weights: List[int] = [0, 0, 0, 0, 0]
|
||||
@ -517,7 +521,7 @@ class ViewStore:
|
||||
def remove_view(self, view: View):
|
||||
if view.__discord_ui_modal__:
|
||||
self._modals.pop(view.custom_id, None) # type: ignore
|
||||
return
|
||||
return
|
||||
|
||||
for item in view.children:
|
||||
if item.is_dispatchable():
|
||||
@ -542,7 +546,12 @@ class ViewStore:
|
||||
item.refresh_state(interaction.data) # type: ignore
|
||||
view._dispatch_item(item, interaction)
|
||||
|
||||
def dispatch_modal(self, custom_id: str, interaction: Interaction, components: List[ModalSubmitComponentInteractionDataPayload]):
|
||||
def dispatch_modal(
|
||||
self,
|
||||
custom_id: str,
|
||||
interaction: Interaction,
|
||||
components: List[ModalSubmitComponentInteractionDataPayload],
|
||||
):
|
||||
modal = self._modals.get(custom_id)
|
||||
if modal is None:
|
||||
_log.debug("Modal interaction referencing unknown custom_id %s. Discarding", custom_id)
|
||||
|
Reference in New Issue
Block a user