Browse Source

chore: Run black

pull/10166/head
DA-344 3 months ago
parent
commit
568a3c396f
  1. 2
      discord/components.py
  2. 7
      discord/ui/section.py
  3. 16
      discord/ui/view.py

2
discord/components.py

@ -747,7 +747,7 @@ class SectionComponent(Component):
payload: SectionComponentPayload = { payload: SectionComponentPayload = {
'type': self.type.value, 'type': self.type.value,
'components': [c.to_dict() for c in self.components], 'components': [c.to_dict() for c in self.components],
'accessory': self.accessory.to_dict() 'accessory': self.accessory.to_dict(),
} }
return payload return payload

7
discord/ui/section.py

@ -79,10 +79,7 @@ class Section(Item[V]):
if len(children) > 3: if len(children) > 3:
raise ValueError('maximum number of children exceeded') raise ValueError('maximum number of children exceeded')
self._children.extend( self._children.extend(
[ [c if isinstance(c, Item) else TextDisplay(c) for c in children],
c if isinstance(c, Item)
else TextDisplay(c) for c in children
],
) )
self.accessory: Item[Any] = accessory self.accessory: Item[Any] = accessory
@ -179,6 +176,6 @@ class Section(Item[V]):
data = { data = {
'components': [c.to_component_dict() for c in self._children], 'components': [c.to_component_dict() for c in self._children],
'type': self.type.value, 'type': self.type.value,
'accessory': self.accessory.to_component_dict() 'accessory': self.accessory.to_component_dict(),
} }
return data return data

16
discord/ui/view.py

@ -23,7 +23,21 @@ DEALINGS IN THE SOFTWARE.
""" """
from __future__ import annotations from __future__ import annotations
from typing import Any, Callable, ClassVar, Coroutine, Dict, Iterator, List, Optional, Sequence, TYPE_CHECKING, Tuple, Type, Union from typing import (
Any,
Callable,
ClassVar,
Coroutine,
Dict,
Iterator,
List,
Optional,
Sequence,
TYPE_CHECKING,
Tuple,
Type,
Union,
)
from functools import partial from functools import partial
from itertools import groupby from itertools import groupby

Loading…
Cancel
Save