Browse Source

chore: remove unused imports and typings

pull/10166/head
DA-344 1 month ago
parent
commit
3040529281
  1. 1
      discord/ui/action_row.py
  2. 3
      discord/ui/container.py
  3. 4
      discord/ui/dynamic.py
  4. 1
      discord/ui/item.py
  5. 2
      discord/ui/view.py

1
discord/ui/action_row.py

@ -44,7 +44,6 @@ from typing import (
from .item import Item, ItemCallbackType
from .button import Button, button as _button
from .dynamic import DynamicItem
from .select import select as _select, Select, UserSelect, RoleSelect, ChannelSelect, MentionableSelect
from ..components import ActionRow as ActionRowComponent
from ..enums import ButtonStyle, ComponentType, ChannelType

3
discord/ui/container.py

@ -36,15 +36,12 @@ from typing import (
List,
Literal,
Optional,
Tuple,
Type,
TypeVar,
Union,
)
from .item import Item, ItemCallbackType
from .view import _component_to_item, LayoutView
from .dynamic import DynamicItem
from ..enums import ComponentType
from ..utils import MISSING, get as _utils_get
from ..colour import Colour, Color

4
discord/ui/dynamic.py

@ -146,7 +146,7 @@ class DynamicItem(Generic[BaseT], Item[Union[View, LayoutView]]):
@property
def custom_id(self) -> str:
""":class:`str`: The ID of the dynamic item that gets received during an interaction."""
return self.item.custom_id
return self.item.custom_id # type: ignore
@custom_id.setter
def custom_id(self, value: str) -> None:
@ -156,7 +156,7 @@ class DynamicItem(Generic[BaseT], Item[Union[View, LayoutView]]):
if not self.template.match(value):
raise ValueError(f'custom_id must match the template {self.template.pattern!r}')
self.item.custom_id = value
self.item.custom_id = value # type: ignore
self._provided_custom_id = True
@property

1
discord/ui/item.py

@ -24,7 +24,6 @@ DEALINGS IN THE SOFTWARE.
from __future__ import annotations
import os
from typing import Any, Callable, Coroutine, Dict, Generic, Optional, TYPE_CHECKING, Tuple, Type, TypeVar
from ..interactions import Interaction

2
discord/ui/view.py

@ -706,7 +706,7 @@ class BaseView:
def _refresh(self, components: List[Component]) -> None:
# fmt: off
old_state: Dict[str, Item[Any]] = {
item.custom_id: item
item.custom_id: item # type: ignore
for item in self._children
if item.is_dispatchable()
}

Loading…
Cancel
Save