mirror of
https://github.com/Rapptz/discord.py.git
synced 2025-08-19 09:30:38 +00:00
Don't recreate ItemCallbackType
This commit is contained in:
parent
439bd71c0d
commit
8c1886799d
@ -41,7 +41,7 @@ from typing import (
|
||||
overload,
|
||||
)
|
||||
|
||||
from .item import I, Item
|
||||
from .item import Item, ContainedItemCallbackType as ItemCallbackType
|
||||
from .button import Button, button as _button
|
||||
from .select import select as _select, Select, UserSelect, RoleSelect, ChannelSelect, MentionableSelect
|
||||
from ..components import ActionRow as ActionRowComponent
|
||||
@ -66,7 +66,6 @@ if TYPE_CHECKING:
|
||||
from ..components import SelectOption
|
||||
from ..interactions import Interaction
|
||||
|
||||
ItemCallbackType = Callable[['S', Interaction[Any], I], Coroutine[Any, Any, Any]]
|
||||
SelectCallbackDecorator = Callable[[ItemCallbackType['S', BaseSelectT]], BaseSelectT]
|
||||
|
||||
S = TypeVar('S', bound='ActionRow', covariant=True)
|
||||
|
@ -25,12 +25,12 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
import copy
|
||||
from typing import Any, Callable, Coroutine, Literal, Optional, TYPE_CHECKING, Tuple, TypeVar, Union
|
||||
from typing import Callable, Literal, Optional, TYPE_CHECKING, Tuple, TypeVar, Union
|
||||
import inspect
|
||||
import os
|
||||
|
||||
|
||||
from .item import Item, I
|
||||
from .item import Item, ContainedItemCallbackType as ItemCallbackType
|
||||
from ..enums import ButtonStyle, ComponentType
|
||||
from ..partial_emoji import PartialEmoji, _EmojiTag
|
||||
from ..components import Button as ButtonComponent
|
||||
@ -46,11 +46,8 @@ if TYPE_CHECKING:
|
||||
from .view import BaseView
|
||||
from .action_row import ActionRow
|
||||
from ..emoji import Emoji
|
||||
from ..interactions import Interaction
|
||||
from ..types.components import ButtonComponent as ButtonComponentPayload
|
||||
|
||||
ItemCallbackType = Callable[['S', Interaction[Any], I], Coroutine[Any, Any, Any]]
|
||||
|
||||
S = TypeVar('S', bound='Union[BaseView, ActionRow]', covariant=True)
|
||||
V = TypeVar('V', bound='BaseView', covariant=True)
|
||||
|
||||
|
@ -21,13 +21,13 @@ 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.
|
||||
"""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import copy
|
||||
from typing import (
|
||||
TYPE_CHECKING,
|
||||
Any,
|
||||
Callable,
|
||||
ClassVar,
|
||||
Coroutine,
|
||||
Dict,
|
||||
@ -39,7 +39,7 @@ from typing import (
|
||||
Union,
|
||||
)
|
||||
|
||||
from .item import Item, I
|
||||
from .item import Item, ContainedItemCallbackType as ItemCallbackType
|
||||
from .view import _component_to_item, LayoutView
|
||||
from ..enums import ComponentType
|
||||
from ..utils import get as _utils_get
|
||||
@ -51,8 +51,6 @@ if TYPE_CHECKING:
|
||||
from ..components import Container as ContainerComponent
|
||||
from ..interactions import Interaction
|
||||
|
||||
ItemCallbackType = Callable[['S', Interaction[Any], I], Coroutine[Any, Any, Any]]
|
||||
|
||||
S = TypeVar('S', bound='Container', covariant=True)
|
||||
V = TypeVar('V', bound='LayoutView', covariant=True)
|
||||
|
||||
|
@ -25,7 +25,7 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
|
||||
import copy
|
||||
from typing import Any, Callable, Coroutine, Dict, Generic, Optional, TYPE_CHECKING, Tuple, Type, TypeVar
|
||||
from typing import Any, Callable, Coroutine, Dict, Generic, Optional, TYPE_CHECKING, Union, Tuple, Type, TypeVar
|
||||
|
||||
from ..interactions import Interaction
|
||||
from .._types import ClientT
|
||||
@ -42,10 +42,15 @@ if TYPE_CHECKING:
|
||||
from ..enums import ComponentType
|
||||
from .view import BaseView
|
||||
from ..components import Component
|
||||
from .action_row import ActionRow
|
||||
from .container import Container
|
||||
|
||||
I = TypeVar('I', bound='Item[Any]')
|
||||
V = TypeVar('V', bound='BaseView', covariant=True)
|
||||
ContainerType = Union['BaseView', 'ActionRow', 'Container']
|
||||
C = TypeVar('C', bound=ContainerType, covariant=True)
|
||||
ItemCallbackType = Callable[[V, Interaction[Any], I], Coroutine[Any, Any, Any]]
|
||||
ContainedItemCallbackType = Callable[[C, Interaction[Any], I], Coroutine[Any, Any, Any]]
|
||||
|
||||
|
||||
class Item(Generic[V]):
|
||||
|
@ -25,7 +25,6 @@ DEALINGS IN THE SOFTWARE.
|
||||
from __future__ import annotations
|
||||
from typing import (
|
||||
Any,
|
||||
Coroutine,
|
||||
List,
|
||||
Literal,
|
||||
Optional,
|
||||
@ -43,7 +42,7 @@ from contextvars import ContextVar
|
||||
import inspect
|
||||
import os
|
||||
|
||||
from .item import Item, I
|
||||
from .item import Item, ContainedItemCallbackType as ItemCallbackType
|
||||
from ..enums import ChannelType, ComponentType, SelectDefaultValueType
|
||||
from ..partial_emoji import PartialEmoji
|
||||
from ..emoji import Emoji
|
||||
@ -103,8 +102,6 @@ if TYPE_CHECKING:
|
||||
Thread,
|
||||
]
|
||||
|
||||
ItemCallbackType = Callable[['S', Interaction[Any], I], Coroutine[Any, Any, Any]]
|
||||
|
||||
S = TypeVar('S', bound='Union[BaseView, ActionRow]', covariant=True)
|
||||
V = TypeVar('V', bound='BaseView', covariant=True)
|
||||
BaseSelectT = TypeVar('BaseSelectT', bound='BaseSelect[Any]')
|
||||
|
Loading…
x
Reference in New Issue
Block a user