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`.
.. 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
.. autoclass:: Combinable

View File

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

View File

@ -14,7 +14,13 @@ from .file import (
try_get_url_path,
)
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 .message import (
Message,
@ -61,7 +67,9 @@ __all__ = [
"Participant",
"PasswordToken",
"RecentAction",
"Keyboard",
"ForcedReplyKeyboard",
"HiddenKeyboard",
"InlineKeyboard",
"Keyboard",
"KeyboardType",
]

View File

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

View File

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

View File

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

View File

@ -123,7 +123,12 @@ def main() -> None:
generated = ast.unparse(
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()