Use typing.Self throughout library

This commit is contained in:
Josh authored and GitHub committed 2022-03-01 07:53:24 -05:00
1 parent a90e1824f4
commit 147948af9b
28 files changed
+212 -191

No files matched your search

+3 -2
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,