mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-09-06 09:56:09 +00:00
Use typing.Self throughout library
This commit is contained in:
@ -23,7 +23,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
from typing import Type, TypeVar, Union, List, TYPE_CHECKING, Any, Union
|
||||
from typing import Union, List, TYPE_CHECKING, Any, Union
|
||||
|
||||
# fmt: off
|
||||
__all__ = (
|
||||
@ -32,6 +32,8 @@ __all__ = (
|
||||
# fmt: on
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from typing_extensions import Self
|
||||
|
||||
from .types.message import AllowedMentions as AllowedMentionsPayload
|
||||
from .abc import Snowflake
|
||||
|
||||
@ -49,8 +51,6 @@ class _FakeBool:
|
||||
|
||||
default: Any = _FakeBool()
|
||||
|
||||
A = TypeVar('A', bound='AllowedMentions')
|
||||
|
||||
|
||||
class AllowedMentions:
|
||||
"""A class that represents what mentions are allowed in a message.
|
||||
@ -98,7 +98,7 @@ class AllowedMentions:
|
||||
self.replied_user = replied_user
|
||||
|
||||
@classmethod
|
||||
def all(cls: Type[A]) -> A:
|
||||
def all(cls) -> Self:
|
||||
"""A factory method that returns a :class:`AllowedMentions` with all fields explicitly set to ``True``
|
||||
|
||||
.. versionadded:: 1.5
|
||||
@ -106,7 +106,7 @@ class AllowedMentions:
|
||||
return cls(everyone=True, users=True, roles=True, replied_user=True)
|
||||
|
||||
@classmethod
|
||||
def none(cls: Type[A]) -> A:
|
||||
def none(cls) -> Self:
|
||||
"""A factory method that returns a :class:`AllowedMentions` with all fields set to ``False``
|
||||
|
||||
.. versionadded:: 1.5
|
||||
|
Reference in New Issue
Block a user