Browse Source

chore: run black

pull/10166/head
DA-344 3 months ago
parent
commit
67bfa57f32
  1. 4
      discord/ui/action_row.py
  2. 24
      discord/ui/view.py

4
discord/ui/action_row.py

@ -331,7 +331,6 @@ class ActionRow(Item[V]):
) -> SelectCallbackDecorator[V, UserSelectT]: ) -> SelectCallbackDecorator[V, UserSelectT]:
... ...
@overload @overload
def select( def select(
self, self,
@ -348,7 +347,6 @@ class ActionRow(Item[V]):
) -> SelectCallbackDecorator[V, RoleSelectT]: ) -> SelectCallbackDecorator[V, RoleSelectT]:
... ...
@overload @overload
def select( def select(
self, self,
@ -365,7 +363,6 @@ class ActionRow(Item[V]):
) -> SelectCallbackDecorator[V, ChannelSelectT]: ) -> SelectCallbackDecorator[V, ChannelSelectT]:
... ...
@overload @overload
def select( def select(
self, self,
@ -484,6 +481,7 @@ class ActionRow(Item[V]):
@classmethod @classmethod
def from_component(cls, component: ActionRowComponent) -> ActionRow: def from_component(cls, component: ActionRowComponent) -> ActionRow:
from .view import _component_to_item from .view import _component_to_item
self = cls() self = cls()
for cmp in component.children: for cmp in component.children:
self.add_item(_component_to_item(cmp)) self.add_item(_component_to_item(cmp))

24
discord/ui/view.py

@ -750,7 +750,7 @@ class LayoutView(BaseView):
In order to modify and edit message components they must be In order to modify and edit message components they must be
converted into a :class:`LayoutView` first. converted into a :class:`LayoutView` first.
Unlike :meth:`View.from_message` this works for Unlike :meth:`View.from_message` this works for
Parameters Parameters
----------- -----------
@ -822,15 +822,21 @@ class ViewStore:
self._dynamic_items[pattern] = item.__class__ self._dynamic_items[pattern] = item.__class__
elif item.is_dispatchable(): elif item.is_dispatchable():
if getattr(item, '__discord_ui_container__', False): if getattr(item, '__discord_ui_container__', False):
is_fully_dynamic = item._update_store_data( # type: ignore is_fully_dynamic = (
dispatch_info, item._update_store_data( # type: ignore
self._dynamic_items, dispatch_info,
) or is_fully_dynamic self._dynamic_items,
)
or is_fully_dynamic
)
elif getattr(item, '__discord_ui_action_row__', False): elif getattr(item, '__discord_ui_action_row__', False):
is_fully_dynamic = item._update_store_data( # type: ignore is_fully_dynamic = (
dispatch_info, item._update_store_data( # type: ignore
self._dynamic_items, dispatch_info,
) or is_fully_dynamic self._dynamic_items,
)
or is_fully_dynamic
)
else: else:
dispatch_info[(item.type.value, item.custom_id)] = item # type: ignore dispatch_info[(item.type.value, item.custom_id)] = item # type: ignore
is_fully_dynamic = False is_fully_dynamic = False

Loading…
Cancel
Save