mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-05 09:26:10 +00:00
Use typing.Self throughout library
This commit is contained in:
@ -43,13 +43,14 @@ __all__ = (
|
||||
)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing_extensions import Self
|
||||
|
||||
from .view import View
|
||||
from ..types.components import SelectMenu as SelectMenuPayload
|
||||
from ..types.interactions import (
|
||||
MessageComponentInteractionData,
|
||||
)
|
||||
|
||||
S = TypeVar('S', bound='Select')
|
||||
V = TypeVar('V', bound='View', covariant=True)
|
||||
|
||||
|
||||
@ -272,7 +273,7 @@ class Select(Item[V]):
|
||||
self._selected_values = data.get('values', [])
|
||||
|
||||
@classmethod
|
||||
def from_component(cls: Type[S], component: SelectMenu) -> S:
|
||||
def from_component(cls, component: SelectMenu) -> Self:
|
||||
return cls(
|
||||
custom_id=component.custom_id,
|
||||
placeholder=component.placeholder,
|
||||
|
Reference in New Issue
Block a user