From 8bd9dd66abe29a4413b1edf6b2037b7171c7f93b Mon Sep 17 00:00:00 2001 From: Lonami Exo Date: Tue, 7 May 2019 10:47:25 +0200 Subject: [PATCH] Re-export the main modules and types from sync For convenience. People can now easily replace: from telethon import TelegramClient, events with from telethon.sync import TelegramClient, events --- telethon/__init__.py | 8 ++++++-- telethon/sync.py | 12 +++++++++++- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/telethon/__init__.py b/telethon/__init__.py index d97912a5..2df62135 100644 --- a/telethon/__init__.py +++ b/telethon/__init__.py @@ -1,9 +1,13 @@ from .client.telegramclient import TelegramClient from .network import connection from .tl import types, functions, custom +from .tl.custom import Button from . import version, events, utils, errors __version__ = version.__version__ -__all__ = ['TelegramClient', 'types', 'functions', 'custom', - 'events', 'utils', 'errors'] +__all__ = [ + 'TelegramClient', 'Button', + 'types', 'functions', 'custom', 'errors', + 'events', 'utils', 'connection' +] diff --git a/telethon/sync.py b/telethon/sync.py index 8f227de2..79058c95 100644 --- a/telethon/sync.py +++ b/telethon/sync.py @@ -14,10 +14,13 @@ import asyncio import functools import inspect +from . import connection from .client.account import _TakeoutClient from .client.telegramclient import TelegramClient +from .tl import types, functions, custom from .tl.custom import ( - Draft, Dialog, MessageButton, Forward, Message, InlineResult, Conversation + Draft, Dialog, MessageButton, Forward, Button, + Message, InlineResult, Conversation ) from .tl.custom.chatgetter import ChatGetter from .tl.custom.sendergetter import SenderGetter @@ -58,3 +61,10 @@ def syncify(*types): syncify(TelegramClient, _TakeoutClient, Draft, Dialog, MessageButton, ChatGetter, SenderGetter, Forward, Message, InlineResult, Conversation) + + +__all__ = [ + 'TelegramClient', 'Button', + 'types', 'functions', 'custom', 'errors', + 'events', 'utils', 'connection' +]