Skip to content

Commit

Permalink
♻️ Use typing_extensions instead of _typed_dict
Browse files Browse the repository at this point in the history
  • Loading branch information
Paillat-dev committed Oct 24, 2024
1 parent 9a6cbff commit cf9d859
Show file tree
Hide file tree
Showing 26 changed files with 44 additions and 63 deletions.
38 changes: 0 additions & 38 deletions discord/_typed_dict.py

This file was deleted.

2 changes: 1 addition & 1 deletion discord/_version.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down
3 changes: 2 additions & 1 deletion discord/types/activity.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion discord/types/appinfo.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion discord/types/application_role_connection.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
3 changes: 2 additions & 1 deletion discord/types/audit_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down
3 changes: 2 additions & 1 deletion discord/types/automod.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion discord/types/channel.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion discord/types/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion discord/types/embed.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

from typing import Literal

from .._typed_dict import NotRequired, TypedDict
from typing_extensions import NotRequired, TypedDict


class EmbedFooter(TypedDict):
Expand Down
3 changes: 2 additions & 1 deletion discord/types/guild.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion discord/types/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
2 changes: 1 addition & 1 deletion discord/types/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]

Expand Down
3 changes: 2 additions & 1 deletion discord/types/invite.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion discord/types/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
3 changes: 2 additions & 1 deletion discord/types/monetization.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion discord/types/onboarding.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion discord/types/poll.py
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
3 changes: 2 additions & 1 deletion discord/types/raw_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion discord/types/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@

from __future__ import annotations

from .._typed_dict import NotRequired, TypedDict
from typing_extensions import NotRequired, TypedDict

from .snowflake import Snowflake


Expand Down
3 changes: 2 additions & 1 deletion discord/types/sticker.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion discord/types/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion discord/types/voice.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
3 changes: 2 additions & 1 deletion discord/types/webhook.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
3 changes: 2 additions & 1 deletion discord/types/widget.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion requirements/_.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
aiohttp>=3.6.0,<4.0
typing_extensions>=4,<5; python_version < "3.11"
typing_extensions>=4,<5

0 comments on commit cf9d859

Please sign in to comment.