From 6dbd40a8efa61e47ff22d758e2fa07f436359495 Mon Sep 17 00:00:00 2001 From: Josh Date: Tue, 22 Feb 2022 00:13:18 +1000 Subject: [PATCH] Remove use of typing.Self from TextInput --- discord/ui/text_input.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/discord/ui/text_input.py b/discord/ui/text_input.py index 5ab3d24aa..bde7a093b 100644 --- a/discord/ui/text_input.py +++ b/discord/ui/text_input.py @@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE. from __future__ import annotations import os -from typing import TYPE_CHECKING, Optional, Tuple, TypeVar +from typing import TYPE_CHECKING, Optional, Tuple, Type, TypeVar from ..components import TextInput as TextInputComponent from ..enums import ComponentType, TextStyle @@ -33,8 +33,6 @@ from ..utils import MISSING from .item import Item if TYPE_CHECKING: - from typing_extensions import Self - from ..types.components import TextInput as TextInputPayload from ..types.interactions import ModalSubmitTextInputInteractionData as ModalSubmitTextInputInteractionDataPayload from .view import View @@ -47,7 +45,7 @@ __all__ = ( # fmt: on V = TypeVar('V', bound='View', covariant=True) - +TI = TypeVar('TI', bound='TextInput') class TextInput(Item[V]): """Represents a UI text input. @@ -211,7 +209,7 @@ class TextInput(Item[V]): self._value = data.get('value', None) @classmethod - def from_component(cls, component: TextInput) -> Self: + def from_component(cls: Type[TI], component: TextInputComponent) -> TI: return cls( label=component.label, style=component.style,