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:
@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
import os
|
||||
from typing import TYPE_CHECKING, Optional, Tuple, Type, TypeVar
|
||||
from typing import TYPE_CHECKING, Optional, Tuple, TypeVar
|
||||
|
||||
from ..components import TextInput as TextInputComponent
|
||||
from ..enums import ComponentType, TextStyle
|
||||
@ -33,6 +33,8 @@ 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
|
||||
@ -45,7 +47,6 @@ __all__ = (
|
||||
# fmt: on
|
||||
|
||||
V = TypeVar('V', bound='View', covariant=True)
|
||||
TI = TypeVar('TI', bound='TextInput')
|
||||
|
||||
|
||||
class TextInput(Item[V]):
|
||||
@ -210,7 +211,7 @@ class TextInput(Item[V]):
|
||||
self._value = data.get('value', None)
|
||||
|
||||
@classmethod
|
||||
def from_component(cls: Type[TI], component: TextInputComponent) -> TI:
|
||||
def from_component(cls, component: TextInputComponent) -> Self:
|
||||
return cls(
|
||||
label=component.label,
|
||||
style=component.style,
|
||||
|
Reference in New Issue
Block a user