Fix imports

This commit is contained in:
Lonami Exo 2021-09-12 16:23:55 +02:00
parent 01061e0719
commit 5fd2a017b2
11 changed files with 27 additions and 13 deletions

View File

@ -2,8 +2,7 @@
from ._misc import helpers # no dependencies
from . import _tl # no dependencies
from ._misc import utils # depends on helpers and _tl
from ._tl import custom # depends on utils
from ._misc import hints # depends on custom
from ._misc import hints # depends on types/custom
from ._client.telegramclient import TelegramClient
from ._network import connection

View File

@ -4,7 +4,7 @@ This module holds the AuthKey class.
import struct
from hashlib import sha1
from .._misc import BinaryReader
from .._misc.binaryreader import BinaryReader
class AuthKey:

View File

@ -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
to read arbitrary binary data in a more comfortable way, with int/strings/etc.
"""
from .binaryreader import BinaryReader

View File

@ -10,7 +10,7 @@ from struct import unpack
from ..errors import TypeNotFoundError
from .. import _tl
from .._tl.alltlobjects import tlobjects
from .._tl import core
from ..types import core
_EPOCH_NAIVE = datetime(*time.gmtime(0)[:6])
_EPOCH = _EPOCH_NAIVE.replace(tzinfo=timezone.utc)

View File

@ -3,7 +3,7 @@ import typing
from . import helpers
from .. import _tl
from .._tl import custom
from ..types import _custom
Phone = str
Username = str
@ -22,7 +22,7 @@ EntityLike = typing.Union[
]
EntitiesLike = typing.Union[EntityLike, typing.Sequence[EntityLike]]
ButtonLike = typing.Union[_tl.TypeKeyboardButton, custom.Button]
ButtonLike = typing.Union[_tl.TypeKeyboardButton, _custom.Button]
MarkupLike = typing.Union[
_tl.TypeReplyMarkup,
ButtonLike,

View 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,
)

View File

@ -9,7 +9,7 @@ from pathlib import Path
from ..docswriter import DocsWriter
from ..parsers import TLObject, Usability
from .._misc.utils import snake_to_camel_case
from ..utils import snake_to_camel_case
CORE_TYPES = {
'int', 'long', 'int128', 'int256', 'double',

View File

@ -7,7 +7,7 @@ from collections import defaultdict
from zlib import crc32
from ..sourcebuilder import SourceBuilder
from .._misc.utils import snake_to_camel_case
from ..utils import snake_to_camel_case
AUTO_GEN_NOTICE = \
'"""File generated by TLObjects\' generator. All changes will be ERASED"""'
@ -61,10 +61,10 @@ def _write_modules(
builder.writeln(AUTO_GEN_NOTICE)
if kind == 'TLObject':
builder.writeln('from .tlobject import TLObject, TLRequest')
builder.writeln('from .._misc.tlobject import TLObject, TLRequest')
builder.writeln('from . import fn')
else:
builder.writeln('from .. import TLObject, TLRequest')
builder.writeln('from ..._misc.tlobject import TLObject, TLRequest')
builder.writeln('from typing import Optional, List, '
'Union, TYPE_CHECKING')

View File

@ -1,7 +1,7 @@
import csv
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
KNOWN_BASE_CLASSES = {

View File

@ -2,7 +2,7 @@ import re
import struct
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
WHITELISTED_MISMATCHING_IDS = {