Remove use of typing.Self from TextInput

This commit is contained in:
Josh 2022-02-22 00:13:18 +10:00 committed by GitHub
parent 38e6dc4f27
commit 6dbd40a8ef
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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