Fix errors reported by tools/check

This commit is contained in:
Lonami Exo 2024-10-19 23:04:15 +02:00
parent 4a591cee8a
commit edf3e06bd0
7 changed files with 36 additions and 8 deletions

View File

@ -102,6 +102,16 @@ Private definitions
Generic parameter used by :class:`AsyncList`. Generic parameter used by :class:`AsyncList`.
.. currentmodule:: telethon._impl.client.types.keyboard
.. class:: AnyButton
Generic parameter used by :class:`Keyboard`.
.. class:: AnyInlineButton
Generic parameter used by :class:`InlineKeyboard`.
.. currentmodule:: telethon._impl.client.events.filters.combinators .. currentmodule:: telethon._impl.client.events.filters.combinators
.. autoclass:: Combinable .. autoclass:: Combinable

View File

@ -253,9 +253,9 @@ class Client:
self._message_box = MessageBox(base_logger=base_logger) self._message_box = MessageBox(base_logger=base_logger)
self._chat_hashes = ChatHashCache(None) self._chat_hashes = ChatHashCache(None)
self._last_update_limit_warn: Optional[float] = None self._last_update_limit_warn: Optional[float] = None
self._updates: asyncio.Queue[tuple[abcs.Update, dict[int, Peer]]] = ( self._updates: asyncio.Queue[
asyncio.Queue(maxsize=self._config.update_queue_limit or 0) tuple[abcs.Update, dict[int, Peer]]
) ] = asyncio.Queue(maxsize=self._config.update_queue_limit or 0)
self._dispatcher: Optional[asyncio.Task[None]] = None self._dispatcher: Optional[asyncio.Task[None]] = None
self._handlers: dict[ self._handlers: dict[
Type[Event], Type[Event],

View File

@ -14,7 +14,13 @@ from .file import (
try_get_url_path, try_get_url_path,
) )
from .inline_result import InlineResult from .inline_result import InlineResult
from .keyboard import InlineKeyboard, Keyboard, KeyboardType from .keyboard import (
ForcedReplyKeyboard,
HiddenKeyboard,
InlineKeyboard,
Keyboard,
KeyboardType,
)
from .login_token import LoginToken from .login_token import LoginToken
from .message import ( from .message import (
Message, Message,
@ -61,7 +67,9 @@ __all__ = [
"Participant", "Participant",
"PasswordToken", "PasswordToken",
"RecentAction", "RecentAction",
"Keyboard", "ForcedReplyKeyboard",
"HiddenKeyboard",
"InlineKeyboard", "InlineKeyboard",
"Keyboard",
"KeyboardType", "KeyboardType",
] ]

View File

@ -18,7 +18,7 @@ try:
) )
except ImportError: except ImportError:
import pyaes # type: ignore [import-untyped] import pyaes
def ige_encrypt( def ige_encrypt(
plaintext: bytes | bytearray | memoryview, key: bytes, iv: bytes plaintext: bytes | bytearray | memoryview, key: bytes, iv: bytes

View File

@ -9,7 +9,8 @@ if TYPE_CHECKING:
from .serializable import Serializable from .serializable import Serializable
class Buffer(Protocol): class Buffer(Protocol):
def __buffer__(self, flags: int, /) -> memoryview: ... def __buffer__(self, flags: int, /) -> memoryview:
...
AnySerializable = TypeVar("AnySerializable", bound="Serializable") AnySerializable = TypeVar("AnySerializable", bound="Serializable")

View File

@ -12,7 +12,9 @@ from .._impl.client.types import (
Dialog, Dialog,
Draft, Draft,
File, File,
ForcedReplyKeyboard,
Group, Group,
HiddenKeyboard,
InlineKeyboard, InlineKeyboard,
InlineResult, InlineResult,
Keyboard, Keyboard,
@ -38,7 +40,9 @@ __all__ = [
"Dialog", "Dialog",
"Draft", "Draft",
"File", "File",
"ForcedReplyKeyboard",
"Group", "Group",
"HiddenKeyboard",
"InlineKeyboard", "InlineKeyboard",
"InlineResult", "InlineResult",
"Keyboard", "Keyboard",

View File

@ -123,7 +123,12 @@ def main() -> None:
generated = ast.unparse( generated = ast.unparse(
ast.ClassDef( ast.ClassDef(
name="Client", bases=[], keywords=[], body=class_body, decorator_list=[] name="Client",
bases=[],
keywords=[],
body=class_body,
decorator_list=[],
type_params=[],
) )
)[len("class Client:") :].strip() )[len("class Client:") :].strip()