mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-13 01:22:21 +03:00
Fix imports
This commit is contained in:
parent
01061e0719
commit
5fd2a017b2
|
@ -2,8 +2,7 @@
|
||||||
from ._misc import helpers # no dependencies
|
from ._misc import helpers # no dependencies
|
||||||
from . import _tl # no dependencies
|
from . import _tl # no dependencies
|
||||||
from ._misc import utils # depends on helpers and _tl
|
from ._misc import utils # depends on helpers and _tl
|
||||||
from ._tl import custom # depends on utils
|
from ._misc import hints # depends on types/custom
|
||||||
from ._misc import hints # depends on custom
|
|
||||||
|
|
||||||
from ._client.telegramclient import TelegramClient
|
from ._client.telegramclient import TelegramClient
|
||||||
from ._network import connection
|
from ._network import connection
|
||||||
|
|
|
@ -4,7 +4,7 @@ This module holds the AuthKey class.
|
||||||
import struct
|
import struct
|
||||||
from hashlib import sha1
|
from hashlib import sha1
|
||||||
|
|
||||||
from .._misc import BinaryReader
|
from .._misc.binaryreader import BinaryReader
|
||||||
|
|
||||||
|
|
||||||
class AuthKey:
|
class AuthKey:
|
||||||
|
|
|
@ -3,4 +3,3 @@ Several extensions Python is missing, such as a proper class to handle a TCP
|
||||||
communication with support for cancelling the operation, and a utility class
|
communication with support for cancelling the operation, and a utility class
|
||||||
to read arbitrary binary data in a more comfortable way, with int/strings/etc.
|
to read arbitrary binary data in a more comfortable way, with int/strings/etc.
|
||||||
"""
|
"""
|
||||||
from .binaryreader import BinaryReader
|
|
||||||
|
|
|
@ -10,7 +10,7 @@ from struct import unpack
|
||||||
from ..errors import TypeNotFoundError
|
from ..errors import TypeNotFoundError
|
||||||
from .. import _tl
|
from .. import _tl
|
||||||
from .._tl.alltlobjects import tlobjects
|
from .._tl.alltlobjects import tlobjects
|
||||||
from .._tl import core
|
from ..types import core
|
||||||
|
|
||||||
_EPOCH_NAIVE = datetime(*time.gmtime(0)[:6])
|
_EPOCH_NAIVE = datetime(*time.gmtime(0)[:6])
|
||||||
_EPOCH = _EPOCH_NAIVE.replace(tzinfo=timezone.utc)
|
_EPOCH = _EPOCH_NAIVE.replace(tzinfo=timezone.utc)
|
||||||
|
|
|
@ -3,7 +3,7 @@ import typing
|
||||||
|
|
||||||
from . import helpers
|
from . import helpers
|
||||||
from .. import _tl
|
from .. import _tl
|
||||||
from .._tl import custom
|
from ..types import _custom
|
||||||
|
|
||||||
Phone = str
|
Phone = str
|
||||||
Username = str
|
Username = str
|
||||||
|
@ -22,7 +22,7 @@ EntityLike = typing.Union[
|
||||||
]
|
]
|
||||||
EntitiesLike = typing.Union[EntityLike, typing.Sequence[EntityLike]]
|
EntitiesLike = typing.Union[EntityLike, typing.Sequence[EntityLike]]
|
||||||
|
|
||||||
ButtonLike = typing.Union[_tl.TypeKeyboardButton, custom.Button]
|
ButtonLike = typing.Union[_tl.TypeKeyboardButton, _custom.Button]
|
||||||
MarkupLike = typing.Union[
|
MarkupLike = typing.Union[
|
||||||
_tl.TypeReplyMarkup,
|
_tl.TypeReplyMarkup,
|
||||||
ButtonLike,
|
ButtonLike,
|
||||||
|
|
16
telethon/types/__init__.py
Normal file
16
telethon/types/__init__.py
Normal file
|
@ -0,0 +1,16 @@
|
||||||
|
from .._misc.tlobject import TLObject, TLRequest
|
||||||
|
from ._custom import (
|
||||||
|
AdminLogEvent,
|
||||||
|
Draft,
|
||||||
|
Dialog,
|
||||||
|
InputSizedFile,
|
||||||
|
MessageButton,
|
||||||
|
Forward,
|
||||||
|
Message,
|
||||||
|
Button,
|
||||||
|
InlineBuilder,
|
||||||
|
InlineResult,
|
||||||
|
InlineResults,
|
||||||
|
QRLogin,
|
||||||
|
ParticipantPermissions,
|
||||||
|
)
|
|
@ -9,7 +9,7 @@ from pathlib import Path
|
||||||
|
|
||||||
from ..docswriter import DocsWriter
|
from ..docswriter import DocsWriter
|
||||||
from ..parsers import TLObject, Usability
|
from ..parsers import TLObject, Usability
|
||||||
from .._misc.utils import snake_to_camel_case
|
from ..utils import snake_to_camel_case
|
||||||
|
|
||||||
CORE_TYPES = {
|
CORE_TYPES = {
|
||||||
'int', 'long', 'int128', 'int256', 'double',
|
'int', 'long', 'int128', 'int256', 'double',
|
||||||
|
|
|
@ -7,7 +7,7 @@ from collections import defaultdict
|
||||||
from zlib import crc32
|
from zlib import crc32
|
||||||
|
|
||||||
from ..sourcebuilder import SourceBuilder
|
from ..sourcebuilder import SourceBuilder
|
||||||
from .._misc.utils import snake_to_camel_case
|
from ..utils import snake_to_camel_case
|
||||||
|
|
||||||
AUTO_GEN_NOTICE = \
|
AUTO_GEN_NOTICE = \
|
||||||
'"""File generated by TLObjects\' generator. All changes will be ERASED"""'
|
'"""File generated by TLObjects\' generator. All changes will be ERASED"""'
|
||||||
|
@ -61,10 +61,10 @@ def _write_modules(
|
||||||
builder.writeln(AUTO_GEN_NOTICE)
|
builder.writeln(AUTO_GEN_NOTICE)
|
||||||
|
|
||||||
if kind == 'TLObject':
|
if kind == 'TLObject':
|
||||||
builder.writeln('from .tlobject import TLObject, TLRequest')
|
builder.writeln('from .._misc.tlobject import TLObject, TLRequest')
|
||||||
builder.writeln('from . import fn')
|
builder.writeln('from . import fn')
|
||||||
else:
|
else:
|
||||||
builder.writeln('from .. import TLObject, TLRequest')
|
builder.writeln('from ..._misc.tlobject import TLObject, TLRequest')
|
||||||
|
|
||||||
builder.writeln('from typing import Optional, List, '
|
builder.writeln('from typing import Optional, List, '
|
||||||
'Union, TYPE_CHECKING')
|
'Union, TYPE_CHECKING')
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
import csv
|
import csv
|
||||||
import re
|
import re
|
||||||
|
|
||||||
from .._misc.utils import snake_to_camel_case
|
from ..utils import snake_to_camel_case
|
||||||
|
|
||||||
# Core base classes depending on the integer error code
|
# Core base classes depending on the integer error code
|
||||||
KNOWN_BASE_CLASSES = {
|
KNOWN_BASE_CLASSES = {
|
||||||
|
|
|
@ -2,7 +2,7 @@ import re
|
||||||
import struct
|
import struct
|
||||||
import zlib
|
import zlib
|
||||||
|
|
||||||
from ..._misc.utils import snake_to_camel_case
|
from ...utils import snake_to_camel_case
|
||||||
|
|
||||||
# https://github.com/telegramdesktop/tdesktop/blob/4bf66cb6e93f3965b40084771b595e93d0b11bcd/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py#L57-L62
|
# https://github.com/telegramdesktop/tdesktop/blob/4bf66cb6e93f3965b40084771b595e93d0b11bcd/Telegram/SourceFiles/codegen/scheme/codegen_scheme.py#L57-L62
|
||||||
WHITELISTED_MISMATCHING_IDS = {
|
WHITELISTED_MISMATCHING_IDS = {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user