Use typing.Self throughout library

This commit is contained in:
Josh
2022-03-01 22:53:24 +10:00
committed by GitHub
parent a90e1824f4
commit 147948af9b
28 changed files with 212 additions and 191 deletions

View File

@ -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,