From 3eccbede9f5dbf19c5fd21f2b67b8ae10a28015a Mon Sep 17 00:00:00 2001 From: Jahongir Qurbonov <=> Date: Wed, 21 Aug 2024 22:15:15 +0500 Subject: [PATCH] Fix type annotation for inline button type --- client/src/telethon/_impl/client/types/keyboard.py | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/client/src/telethon/_impl/client/types/keyboard.py b/client/src/telethon/_impl/client/types/keyboard.py index 26ced13e..016fdacb 100644 --- a/client/src/telethon/_impl/client/types/keyboard.py +++ b/client/src/telethon/_impl/client/types/keyboard.py @@ -1,9 +1,10 @@ from typing import Generic, Optional, TypeAlias, TypeVar from ...tl import abcs, types -from .buttons.button import Button +from .buttons import Button, InlineButton AnyButton = TypeVar("AnyButton", bound=Button) +AnyInlineButton = TypeVar("AnyInlineButton", bound=InlineButton) def _build_keyboard_rows( @@ -45,10 +46,12 @@ class Keyboard(Generic[AnyButton]): ) -class InlineKeyboard(Generic[AnyButton]): +class InlineKeyboard(Generic[AnyInlineButton]): __slots__ = ("_raw",) - def __init__(self, buttons: list[AnyButton] | list[list[AnyButton]]) -> None: + def __init__( + self, buttons: list[AnyInlineButton] | list[list[AnyInlineButton]] + ) -> None: self._raw = types.ReplyInlineMarkup(rows=_build_keyboard_rows(buttons))