Fix some import errors

This commit is contained in:
Lonami Exo 2021-09-11 13:43:20 +02:00
parent d6326abacb
commit 34e7b7cc9f
2 changed files with 16 additions and 32 deletions

View File

@ -1,25 +1,4 @@
""" """
This package defines clients as subclasses of others, and then a single This package defines the main `telethon._client.telegramclient.TelegramClient` instance
`telethon.client.telegramclient.TelegramClient` which is subclass of them which delegates the work to free-standing functions defined in the rest of files.
all to provide the final unified interface while the methods can live in
different subclasses to be more maintainable.
The ABC is `telethon.client.telegrambaseclient.TelegramBaseClient` and the
first implementor is `telethon.client.users.UserMethods`, since calling
requests require them to be resolved first, and that requires accessing
entities (users).
""" """
from .telegrambaseclient import TelegramBaseClient
from .users import UserMethods # Required for everything
from .messageparse import MessageParseMethods # Required for messages
from .uploads import UploadMethods # Required for messages to send files
from .updates import UpdateMethods # Required for buttons (register callbacks)
from .buttons import ButtonMethods # Required for messages to use buttons
from .messages import MessageMethods
from .chats import ChatMethods
from .dialogs import DialogMethods
from .downloads import DownloadMethods
from .account import AccountMethods
from .auth import AuthMethods
from .bots import BotMethods
from .telegramclient import TelegramClient

View File

@ -1,12 +1,17 @@
import asyncio
import functools import functools
import inspect import inspect
import typing import typing
import logging
from . import ( from . import (
account, auth, bots, buttons, chats, dialogs, downloads, messageparse, messages, account, auth, bots, buttons, chats, dialogs, downloads, messageparse, messages,
telegrambaseclient, updates, uploads, users telegrambaseclient, updates, uploads, users
) )
from .. import helpers from .. import helpers, version
from ..tl import types, custom
from ..network import ConnectionTcpFull
from ..events.common import EventBuilder, EventCommon
class TelegramClient: class TelegramClient:
@ -721,7 +726,7 @@ class TelegramClient:
*, *,
search: str = '', search: str = '',
filter: 'types.TypeChannelParticipantsFilter' = None, filter: 'types.TypeChannelParticipantsFilter' = None,
aggressive: bool = False) -> _ParticipantsIter: aggressive: bool = False) -> chats._ParticipantsIter:
""" """
Iterator over the participants belonging to the specified chat. Iterator over the participants belonging to the specified chat.
@ -830,7 +835,7 @@ class TelegramClient:
pinned: bool = None, pinned: bool = None,
edit: bool = None, edit: bool = None,
delete: bool = None, delete: bool = None,
group_call: bool = None) -> _AdminLogIter: group_call: bool = None) -> chats._AdminLogIter:
""" """
Iterator over the admin log for the specified channel. Iterator over the admin log for the specified channel.
@ -958,7 +963,7 @@ class TelegramClient:
limit: int = None, limit: int = None,
*, *,
offset: int = 0, offset: int = 0,
max_id: int = 0) -> _ProfilePhotoIter: max_id: int = 0) -> chats._ProfilePhotoIter:
""" """
Iterator over a user's profile photos or a chat's photos. Iterator over a user's profile photos or a chat's photos.
@ -1452,7 +1457,7 @@ class TelegramClient:
ignore_migrated: bool = False, ignore_migrated: bool = False,
folder: int = None, folder: int = None,
archived: bool = None archived: bool = None
) -> _DialogsIter: ) -> dialogs._DialogsIter:
""" """
Iterator over the dialogs (open conversations/subscribed channels). Iterator over the dialogs (open conversations/subscribed channels).
@ -1549,7 +1554,7 @@ class TelegramClient:
def iter_drafts( def iter_drafts(
self: 'TelegramClient', self: 'TelegramClient',
entity: 'hints.EntitiesLike' = None entity: 'hints.EntitiesLike' = None
) -> _DraftsIter: ) -> dialogs._DraftsIter:
""" """
Iterator over draft messages. Iterator over draft messages.
@ -2023,7 +2028,7 @@ class TelegramClient:
stride: int = None, stride: int = None,
limit: int = None, limit: int = None,
chunk_size: int = None, chunk_size: int = None,
request_size: int = MAX_CHUNK_SIZE, request_size: int = downloads.MAX_CHUNK_SIZE,
file_size: int = None, file_size: int = None,
dc_id: int = None dc_id: int = None
): ):
@ -3180,7 +3185,7 @@ class TelegramClient:
def add_event_handler( def add_event_handler(
self: 'TelegramClient', self: 'TelegramClient',
callback: Callback, callback: updates.Callback,
event: EventBuilder = None): event: EventBuilder = None):
""" """
Registers a new event handler callback. Registers a new event handler callback.
@ -3218,7 +3223,7 @@ class TelegramClient:
def remove_event_handler( def remove_event_handler(
self: 'TelegramClient', self: 'TelegramClient',
callback: Callback, callback: updates.Callback,
event: EventBuilder = None) -> int: event: EventBuilder = None) -> int:
""" """
Inverse operation of `add_event_handler()`. Inverse operation of `add_event_handler()`.