Fix some modules were public when they should not have been

This commit is contained in:
Lonami Exo 2021-09-26 19:58:42 +02:00
parent a9e1a574ae
commit 197a1ca996
19 changed files with 41 additions and 31 deletions

View File

@ -341,6 +341,9 @@ In ``tlobject.to_dict()``, the special ``_`` key is now also contains the module
actually distinguish between equally-named classes). If you want the old behaviour, use
``tlobject.__class__.__name__` instead (and add ``Request`` for functions).
Because the string representation of an object used ``tlobject.to_dict()``, it is now also
affected by these changes.
// TODO this definitely generated files mapping from the original name to this new one...
// TODO what's the alternative to update._entities? and update._client??

View File

@ -1,10 +1,10 @@
# Note: the import order matters
from ._misc import helpers # no dependencies
from ._misc import helpers as _ # no dependencies
from . import _tl # no dependencies
from ._misc import utils # depends on helpers and _tl
from ._misc import hints # depends on types/custom
from ._misc import utils as _ # depends on helpers and _tl
from ._misc import hints as _ # depends on types/custom
from ._client.telegramclient import TelegramClient
from . import version, events, utils, errors, enums
from . import version, events, errors, enums
__version__ = version.__version__

View File

@ -3,7 +3,8 @@ import inspect
import typing
from .users import _NOT_A_REQUEST
from .. import helpers, utils, _tl
from .._misc import helpers, utils
from .. import _tl
if typing.TYPE_CHECKING:
from .telegramclient import TelegramClient

View File

@ -1,7 +1,8 @@
import typing
from .. import hints, _tl
from ..types import _custom
from .._misc import hints
from .. import _tl
if typing.TYPE_CHECKING:
from .telegramclient import TelegramClient

View File

@ -4,8 +4,8 @@ import itertools
import string
import typing
from .. import hints, errors, _tl
from .._misc import helpers, utils, requestiter, tlobject, enums
from .. import errors, _tl
from .._misc import helpers, utils, requestiter, tlobject, enums, hints
from ..types import _custom
if typing.TYPE_CHECKING:

View File

@ -3,8 +3,8 @@ import inspect
import itertools
import typing
from .. import hints, errors, _tl
from .._misc import helpers, utils, requestiter
from .. import errors, _tl
from .._misc import helpers, utils, requestiter, hints
from ..types import _custom
_MAX_CHUNK_SIZE = 100

View File

@ -7,8 +7,8 @@ import inspect
import asyncio
from .._crypto import AES
from .._misc import utils, helpers, requestiter, tlobject
from .. import errors, hints, _tl
from .._misc import utils, helpers, requestiter, tlobject, hints
from .. import errors, _tl
try:
import aiohttp

View File

@ -2,8 +2,9 @@ import itertools
import re
import typing
from .. import helpers, utils, _tl
from .._misc import helpers, utils
from ..types import _custom
from .. import _tl
if typing.TYPE_CHECKING:
from .telegramclient import TelegramClient

View File

@ -3,9 +3,9 @@ import itertools
import typing
import warnings
from .. import errors, hints, _tl
from .._misc import helpers, utils, requestiter
from .._misc import helpers, utils, requestiter, hints
from ..types import _custom
from .. import errors, _tl
_MAX_CHUNK_SIZE = 100

View File

@ -8,9 +8,9 @@ import time
import typing
import ipaddress
from .. import version, helpers, __name__ as __base_name__, _tl
from .. import version, __name__ as __base_name__, _tl
from .._crypto import rsa
from .._misc import markdown, entitycache, statecache, enums
from .._misc import markdown, entitycache, statecache, enums, helpers
from .._network import MTProtoSender, Connection, ConnectionTcpFull, connection as conns
from .._sessions import Session, SQLiteSession, MemorySession
from .._sessions.types import DataCenter, SessionState

View File

@ -8,7 +8,7 @@ from . import (
account, auth, bots, chats, dialogs, downloads, messageparse, messages,
telegrambaseclient, updates, uploads, users
)
from .. import helpers, version, _tl
from .. import version, _tl
from ..types import _custom
from .._network import ConnectionTcpFull
from .._events.common import EventBuilder, EventCommon

View File

@ -8,11 +8,12 @@ import traceback
import typing
import logging
from .. import utils, _tl
from ..errors._rpcbase import RpcError
from .._events.common import EventBuilder, EventCommon
from .._events.raw import Raw
from .._events.base import StopPropagation, _get_handlers
from .._misc import utils
from .. import _tl
if typing.TYPE_CHECKING:
from .telegramclient import TelegramClient

View File

@ -9,9 +9,9 @@ from io import BytesIO
from .._crypto import AES
from .._misc import utils, helpers
from .. import hints, _tl
from .._misc import utils, helpers, hints
from ..types import _custom
from .. import _tl
try:
import PIL

View File

@ -6,9 +6,9 @@ import typing
from ..errors._custom import MultiError
from ..errors._rpcbase import RpcError, ServerError, FloodError, InvalidDcError, UnauthorizedError
from .. import errors, hints, _tl
from .._misc import helpers, utils
from .._misc import helpers, utils, hints
from .._sessions.types import Entity
from .. import errors, _tl
_NOT_A_REQUEST = lambda: TypeError('You can only invoke requests, not types!')

View File

@ -7,7 +7,8 @@ from html import escape
from html.parser import HTMLParser
from typing import Iterable, Optional, Tuple, List
from .. import helpers, _tl
from .._misc import helpers
from .. import _tl
# Helpers from markdown.py

View File

@ -6,7 +6,8 @@ import os
import time
from hashlib import sha1
from .. import helpers, _tl
from .. import _tl
from .._misc import helpers
from .._crypto import AES, AuthKey, Factorization, rsa
from ..errors._custom import SecurityError
from .._misc.binaryreader import BinaryReader

View File

@ -14,7 +14,7 @@ except ImportError:
python_socks = None
from ...errors._custom import InvalidChecksumError
from ... import helpers
from ..._misc import helpers
class Connection(abc.ABC):

View File

@ -8,7 +8,6 @@ from ..errors._rpcbase import _mk_error_type
from .mtprotoplainsender import MTProtoPlainSender
from .requeststate import RequestState
from .mtprotostate import MTProtoState
from .. import helpers, utils, _tl
from ..errors import (
BadMessageError, InvalidBufferError, SecurityError,
TypeNotFoundError, rpc_message_to_error
@ -17,7 +16,8 @@ from .._misc.binaryreader import BinaryReader
from .._misc.tlobject import TLRequest
from ..types._core import RpcResult, MessageContainer, GzipPacked
from .._crypto import AuthKey
from .._misc.helpers import retry_range
from .._misc import helpers, utils
from .. import _tl
class MTProtoSender:
@ -214,7 +214,7 @@ class MTProtoSender:
connected = False
for attempt in retry_range(self._retries):
for attempt in helpers.retry_range(self._retries):
if not connected:
connected = await self._try_connect(attempt)
if not connected:
@ -351,7 +351,7 @@ class MTProtoSender:
attempt = 0
ok = True
# We're already "retrying" to connect, so we don't want to force retries
for attempt in retry_range(retries, force_retry=False):
for attempt in helpers.retry_range(retries, force_retry=False):
try:
await self._connect()
except (IOError, asyncio.TimeoutError) as e:

View File

@ -1,6 +1,7 @@
import abc
from ... import errors, utils, _tl
from ..._misc import utils
from ... import errors, _tl
class ChatGetter(abc.ABC):