diff --git a/discord/_typed_dict.py b/discord/_typed_dict.py deleted file mode 100644 index dfd1e4e9eb..0000000000 --- a/discord/_typed_dict.py +++ /dev/null @@ -1,38 +0,0 @@ -""" -The MIT License (MIT) - -Copyright (c) 2021-present Pycord Development - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and associated documentation files (the "Software"), -to deal in the Software without restriction, including without limitation -the rights to use, copy, modify, merge, publish, distribute, sublicense, -and/or sell copies of the Software, and to permit persons to whom the -Software is furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in -all copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS -OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER -DEALINGS IN THE SOFTWARE. -""" - -import sys - -# PEP 655 Required and NotRequired were added in python 3.11. This file is simply a -# shortcut import, so we don't have to repeat this import logic across files. -if sys.version_info >= (3, 11): - from typing import NotRequired, Required, TypedDict -else: - from typing_extensions import NotRequired, Required, TypedDict - -__all__ = ( - "Required", - "NotRequired", - "TypedDict", -) diff --git a/discord/_version.py b/discord/_version.py index c1bc153507..ba68799dfe 100644 --- a/discord/_version.py +++ b/discord/_version.py @@ -30,7 +30,7 @@ import warnings from importlib.metadata import PackageNotFoundError, version -from ._typed_dict import TypedDict +from typing_extensions import TypedDict __all__ = ("__version__", "VersionInfo", "version_info") diff --git a/discord/types/activity.py b/discord/types/activity.py index 3c610e3138..c19e9b18c1 100644 --- a/discord/types/activity.py +++ b/discord/types/activity.py @@ -27,7 +27,8 @@ from typing import Literal -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from .snowflake import Snowflake from .user import PartialUser diff --git a/discord/types/appinfo.py b/discord/types/appinfo.py index 8d891acbed..c22f665745 100644 --- a/discord/types/appinfo.py +++ b/discord/types/appinfo.py @@ -25,7 +25,8 @@ from __future__ import annotations -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from .snowflake import Snowflake from .team import Team from .user import User diff --git a/discord/types/application_role_connection.py b/discord/types/application_role_connection.py index 40bcae1014..cf797b8efa 100644 --- a/discord/types/application_role_connection.py +++ b/discord/types/application_role_connection.py @@ -26,7 +26,7 @@ from typing import Literal -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict ApplicationRoleConnectionMetadataType = Literal[1, 2, 3, 4, 5, 6, 7, 8] diff --git a/discord/types/audit_log.py b/discord/types/audit_log.py index d543f9e3b7..0575457e7a 100644 --- a/discord/types/audit_log.py +++ b/discord/types/audit_log.py @@ -27,7 +27,8 @@ from typing import Literal, Union -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from .automod import AutoModRule from .channel import ChannelType, PermissionOverwrite, VideoQualityMode from .guild import ( diff --git a/discord/types/automod.py b/discord/types/automod.py index 4f13b46ae0..0417e78497 100644 --- a/discord/types/automod.py +++ b/discord/types/automod.py @@ -24,7 +24,8 @@ from typing import Literal -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from .snowflake import Snowflake AutoModTriggerType = Literal[1, 2, 3, 4, 5] diff --git a/discord/types/channel.py b/discord/types/channel.py index 1b7fb1fe5e..385b082cc3 100644 --- a/discord/types/channel.py +++ b/discord/types/channel.py @@ -27,7 +27,8 @@ from typing import Literal, Union -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from ..enums import SortOrder from ..flags import ChannelFlags from .snowflake import Snowflake diff --git a/discord/types/components.py b/discord/types/components.py index 4c0ce30ad4..7b05f8bf08 100644 --- a/discord/types/components.py +++ b/discord/types/components.py @@ -27,7 +27,8 @@ from typing import Literal, Union -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from .channel import ChannelType from .emoji import PartialEmoji from .snowflake import Snowflake diff --git a/discord/types/embed.py b/discord/types/embed.py index dbfcb14c87..33f5f0d942 100644 --- a/discord/types/embed.py +++ b/discord/types/embed.py @@ -27,7 +27,7 @@ from typing import Literal -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict class EmbedFooter(TypedDict): diff --git a/discord/types/guild.py b/discord/types/guild.py index cac645b272..9ada5e194e 100644 --- a/discord/types/guild.py +++ b/discord/types/guild.py @@ -27,7 +27,8 @@ from typing import Literal -from .._typed_dict import NotRequired, Required, TypedDict +from typing_extensions import NotRequired, Required, TypedDict + from .activity import PartialPresenceUpdate from .channel import GuildChannel from .emoji import Emoji diff --git a/discord/types/integration.py b/discord/types/integration.py index 219992d225..1a6c8b70f1 100644 --- a/discord/types/integration.py +++ b/discord/types/integration.py @@ -27,7 +27,8 @@ from typing import Literal, Union -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from .snowflake import Snowflake from .user import User diff --git a/discord/types/interactions.py b/discord/types/interactions.py index 2c7fd520ab..37904a580a 100644 --- a/discord/types/interactions.py +++ b/discord/types/interactions.py @@ -42,7 +42,7 @@ from .message import AllowedMentions, Message from ..interactions import InteractionChannel -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict ApplicationCommandType = Literal[1, 2, 3] diff --git a/discord/types/invite.py b/discord/types/invite.py index 7f1e23b96e..796d27ccb4 100644 --- a/discord/types/invite.py +++ b/discord/types/invite.py @@ -27,7 +27,8 @@ from typing import Literal, Union -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from .appinfo import PartialAppInfo from .channel import PartialChannel from .guild import InviteGuild, _GuildPreviewUnique diff --git a/discord/types/message.py b/discord/types/message.py index f138609d1b..20a54204bf 100644 --- a/discord/types/message.py +++ b/discord/types/message.py @@ -41,7 +41,7 @@ if TYPE_CHECKING: from .interactions import InteractionMetadata, MessageInteraction -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict class ChannelMention(TypedDict): diff --git a/discord/types/monetization.py b/discord/types/monetization.py index 8b186c83e0..a12ee5dfea 100644 --- a/discord/types/monetization.py +++ b/discord/types/monetization.py @@ -27,7 +27,8 @@ from typing import Literal -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from .snowflake import Snowflake SKUType = Literal[5, 6] diff --git a/discord/types/onboarding.py b/discord/types/onboarding.py index 7bfa44dc13..31dda34ca8 100644 --- a/discord/types/onboarding.py +++ b/discord/types/onboarding.py @@ -26,7 +26,8 @@ from typing import Literal, TypedDict -from .._typed_dict import NotRequired +from typing_extensions import NotRequired + from .emoji import Emoji from .snowflake import Snowflake, SnowflakeList diff --git a/discord/types/poll.py b/discord/types/poll.py index 21e54431e6..ed747f93da 100644 --- a/discord/types/poll.py +++ b/discord/types/poll.py @@ -26,7 +26,8 @@ from typing import Literal, TypedDict -from .._typed_dict import NotRequired +from typing_extensions import NotRequired + from .emoji import Emoji PollLayoutType = Literal[1] diff --git a/discord/types/raw_models.py b/discord/types/raw_models.py index 2d0698eca3..1a7feee059 100644 --- a/discord/types/raw_models.py +++ b/discord/types/raw_models.py @@ -25,7 +25,8 @@ from __future__ import annotations -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from .automod import AutoModAction, AutoModTriggerType from .emoji import PartialEmoji from .member import Member diff --git a/discord/types/role.py b/discord/types/role.py index d387d38b77..c1354f1f0f 100644 --- a/discord/types/role.py +++ b/discord/types/role.py @@ -25,7 +25,8 @@ from __future__ import annotations -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from .snowflake import Snowflake diff --git a/discord/types/sticker.py b/discord/types/sticker.py index 129b14cc46..95945462e6 100644 --- a/discord/types/sticker.py +++ b/discord/types/sticker.py @@ -27,7 +27,8 @@ from typing import Literal, Union -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from .snowflake import Snowflake from .user import User diff --git a/discord/types/threads.py b/discord/types/threads.py index aab6d95794..447027183b 100644 --- a/discord/types/threads.py +++ b/discord/types/threads.py @@ -27,7 +27,8 @@ from typing import Literal -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from ..flags import ChannelFlags from .snowflake import Snowflake diff --git a/discord/types/voice.py b/discord/types/voice.py index 4dc485cbf7..732f9826d7 100644 --- a/discord/types/voice.py +++ b/discord/types/voice.py @@ -27,7 +27,8 @@ from typing import Literal -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from .member import MemberWithUser from .snowflake import Snowflake diff --git a/discord/types/webhook.py b/discord/types/webhook.py index 20fa0e900e..a312b30a41 100644 --- a/discord/types/webhook.py +++ b/discord/types/webhook.py @@ -27,7 +27,8 @@ from typing import Literal -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from .channel import PartialChannel from .snowflake import Snowflake from .user import User diff --git a/discord/types/widget.py b/discord/types/widget.py index 1ebeb959a3..d327fa58fb 100644 --- a/discord/types/widget.py +++ b/discord/types/widget.py @@ -25,7 +25,8 @@ from __future__ import annotations -from .._typed_dict import NotRequired, TypedDict +from typing_extensions import NotRequired, TypedDict + from .activity import Activity from .snowflake import Snowflake from .user import User diff --git a/requirements/_.txt b/requirements/_.txt index 5305a96bd1..e8dfe84d1e 100644 --- a/requirements/_.txt +++ b/requirements/_.txt @@ -1,2 +1,2 @@ aiohttp>=3.6.0,<4.0 -typing_extensions>=4,<5; python_version < "3.11" +typing_extensions>=4,<5