diff --git a/src/ductile/controller/controller.py b/src/ductile/controller/controller.py index fcdf919..5ab9a25 100644 --- a/src/ductile/controller/controller.py +++ b/src/ductile/controller/controller.py @@ -3,13 +3,12 @@ import discord -from ductile import State -from ductile.internal import _InternalView - -from .type import ViewObjectDictWithAttachment, ViewObjectDictWithFiles +from ..internal import _InternalView # noqa: TID252 +from ..state import State # noqa: TID252 if TYPE_CHECKING: - from ductile import View, ViewObject + from ..view import View, ViewObject # noqa: TID252 + from .type import ViewObjectDictWithAttachment, ViewObjectDictWithFiles class ViewResult(NamedTuple): @@ -87,17 +86,17 @@ def _get_all_state_in_view(self) -> Generator[tuple[str, State[Any]], None, None yield k, v @overload - def _process_view_for_discord(self, mode: Literal["attachment"]) -> ViewObjectDictWithAttachment: + def _process_view_for_discord(self, mode: Literal["attachment"]) -> "ViewObjectDictWithAttachment": ... @overload - def _process_view_for_discord(self, mode: Literal["files"]) -> ViewObjectDictWithFiles: + def _process_view_for_discord(self, mode: Literal["files"]) -> "ViewObjectDictWithFiles": ... def _process_view_for_discord( self, mode: Literal["attachment", "files"], - ) -> ViewObjectDictWithAttachment | ViewObjectDictWithFiles: + ) -> "ViewObjectDictWithAttachment | ViewObjectDictWithFiles": """ _process_view_for_discord is a helper function to process the view for Discord. diff --git a/src/ductile/controller/interaction_controller.py b/src/ductile/controller/interaction_controller.py index 15a131f..bd022d3 100644 --- a/src/ductile/controller/interaction_controller.py +++ b/src/ductile/controller/interaction_controller.py @@ -5,7 +5,7 @@ from .controller import ViewController if TYPE_CHECKING: - from ductile import View + from ..view import View # noqa: TID252 class InteractionController(ViewController): diff --git a/src/ductile/controller/messageable_controller.py b/src/ductile/controller/messageable_controller.py index 7152cd0..16b8c43 100644 --- a/src/ductile/controller/messageable_controller.py +++ b/src/ductile/controller/messageable_controller.py @@ -5,7 +5,7 @@ from .controller import ViewController if TYPE_CHECKING: - from ductile import View + from ..view import View # noqa: TID252 class MessageableController(ViewController): diff --git a/src/ductile/internal/view.py b/src/ductile/internal/view.py index ffc5edf..a588d72 100644 --- a/src/ductile/internal/view.py +++ b/src/ductile/internal/view.py @@ -1,8 +1,11 @@ +from typing import TYPE_CHECKING + from discord import ui from discord.interactions import Interaction from discord.ui.item import Item -from ductile.types import ViewErrorHandler, ViewTimeoutHandler +if TYPE_CHECKING: + from ..types import ViewErrorHandler, ViewTimeoutHandler # noqa: TID252 __all__ = [ "_InternalView", @@ -14,8 +17,8 @@ def __init__( self, *, timeout: float | None = 180, - on_error: ViewErrorHandler | None = None, - on_timeout: ViewTimeoutHandler | None = None, + on_error: "ViewErrorHandler" | None = None, + on_timeout: "ViewTimeoutHandler" | None = None, ) -> None: super().__init__(timeout=timeout) self.__on_error = on_error diff --git a/src/ductile/ui/button.py b/src/ductile/ui/button.py index f524b74..66ea1c6 100644 --- a/src/ductile/ui/button.py +++ b/src/ductile/ui/button.py @@ -4,10 +4,10 @@ from discord import Emoji, PartialEmoji, ui from discord.interactions import Interaction -from ductile.utils import call_any_function +from ..utils import call_any_function # noqa: TID252 if TYPE_CHECKING: - from ductile.types import InteractionCallback + from ..types import InteractionCallback # noqa: TID252 class _ButtonStyleRequired(TypedDict): diff --git a/src/ductile/ui/modal.py b/src/ductile/ui/modal.py index e7f6f68..ba3ecff 100644 --- a/src/ductile/ui/modal.py +++ b/src/ductile/ui/modal.py @@ -3,7 +3,7 @@ from discord import Interaction, TextStyle, ui if TYPE_CHECKING: - from ductile.types import ModalCallback + from ..types import ModalCallback # noqa: TID252 class TextInputStyle(TypedDict, total=False): diff --git a/src/ductile/ui/select.py b/src/ductile/ui/select.py index 83207f8..125a67f 100644 --- a/src/ductile/ui/select.py +++ b/src/ductile/ui/select.py @@ -5,10 +5,10 @@ from discord.enums import ChannelType from pydantic import BaseModel, ConfigDict, Field -from ductile.utils import call_any_function +from ..utils import call_any_function # noqa: TID252 if TYPE_CHECKING: - from ductile.types import ( + from ..types import ( # noqa: TID252 ChannelSelectCallback, MentionableSelectCallback, RoleSelectCallback,