Browse Source

chore: fix linting

pull/10166/head
DA-344 3 months ago
parent
commit
eae08956de
  1. 8
      discord/client.py
  2. 8
      discord/state.py

8
discord/client.py

@ -72,7 +72,7 @@ from .object import Object
from .backoff import ExponentialBackoff from .backoff import ExponentialBackoff
from .webhook import Webhook from .webhook import Webhook
from .appinfo import AppInfo from .appinfo import AppInfo
from .ui.view import View from .ui.view import BaseView
from .ui.dynamic import DynamicItem from .ui.dynamic import DynamicItem
from .stage_instance import StageInstance from .stage_instance import StageInstance
from .threads import Thread from .threads import Thread
@ -3149,7 +3149,7 @@ class Client:
self._connection.remove_dynamic_items(*items) self._connection.remove_dynamic_items(*items)
def add_view(self, view: View, *, message_id: Optional[int] = None) -> None: def add_view(self, view: BaseView, *, message_id: Optional[int] = None) -> None:
"""Registers a :class:`~discord.ui.View` for persistent listening. """Registers a :class:`~discord.ui.View` for persistent listening.
This method should be used for when a view is comprised of components This method should be used for when a view is comprised of components
@ -3175,7 +3175,7 @@ class Client:
and all their components have an explicitly provided custom_id. and all their components have an explicitly provided custom_id.
""" """
if not isinstance(view, View): if not isinstance(view, BaseView):
raise TypeError(f'expected an instance of View not {view.__class__.__name__}') raise TypeError(f'expected an instance of View not {view.__class__.__name__}')
if not view.is_persistent(): if not view.is_persistent():
@ -3187,7 +3187,7 @@ class Client:
self._connection.store_view(view, message_id) self._connection.store_view(view, message_id)
@property @property
def persistent_views(self) -> Sequence[View]: def persistent_views(self) -> Sequence[BaseView]:
"""Sequence[:class:`.View`]: A sequence of persistent views added to the client. """Sequence[:class:`.View`]: A sequence of persistent views added to the client.
.. versionadded:: 2.0 .. versionadded:: 2.0

8
discord/state.py

@ -71,7 +71,7 @@ from .flags import ApplicationFlags, Intents, MemberCacheFlags
from .invite import Invite from .invite import Invite
from .integrations import _integration_factory from .integrations import _integration_factory
from .interactions import Interaction from .interactions import Interaction
from .ui.view import ViewStore, View from .ui.view import ViewStore, BaseView
from .scheduled_event import ScheduledEvent from .scheduled_event import ScheduledEvent
from .stage_instance import StageInstance from .stage_instance import StageInstance
from .threads import Thread, ThreadMember from .threads import Thread, ThreadMember
@ -412,12 +412,12 @@ class ConnectionState(Generic[ClientT]):
self._stickers[sticker_id] = sticker = GuildSticker(state=self, data=data) self._stickers[sticker_id] = sticker = GuildSticker(state=self, data=data)
return sticker return sticker
def store_view(self, view: View, message_id: Optional[int] = None, interaction_id: Optional[int] = None) -> None: def store_view(self, view: BaseView, message_id: Optional[int] = None, interaction_id: Optional[int] = None) -> None:
if interaction_id is not None: if interaction_id is not None:
self._view_store.remove_interaction_mapping(interaction_id) self._view_store.remove_interaction_mapping(interaction_id)
self._view_store.add_view(view, message_id) self._view_store.add_view(view, message_id)
def prevent_view_updates_for(self, message_id: int) -> Optional[View]: def prevent_view_updates_for(self, message_id: int) -> Optional[BaseView]:
return self._view_store.remove_message_tracking(message_id) return self._view_store.remove_message_tracking(message_id)
def store_dynamic_items(self, *items: Type[DynamicItem[Item[Any]]]) -> None: def store_dynamic_items(self, *items: Type[DynamicItem[Item[Any]]]) -> None:
@ -427,7 +427,7 @@ class ConnectionState(Generic[ClientT]):
self._view_store.remove_dynamic_items(*items) self._view_store.remove_dynamic_items(*items)
@property @property
def persistent_views(self) -> Sequence[View]: def persistent_views(self) -> Sequence[BaseView]:
return self._view_store.persistent_views return self._view_store.persistent_views
@property @property

Loading…
Cancel
Save