mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Slightly reorganise the project structure
This commit is contained in:
parent
ba5bfa105f
commit
7adb4f09d6
|
@ -1,7 +1,7 @@
|
|||
from hashlib import sha1
|
||||
|
||||
from .. import helpers as utils
|
||||
from ..utils import BinaryReader, BinaryWriter
|
||||
from ..extensions import BinaryReader, BinaryWriter
|
||||
|
||||
|
||||
class AuthKey:
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import os
|
||||
from hashlib import sha1
|
||||
|
||||
from ..utils import BinaryWriter
|
||||
from ..extensions import BinaryWriter
|
||||
|
||||
|
||||
class RSAServerKey:
|
||||
|
|
9
telethon/extensions/__init__.py
Normal file
9
telethon/extensions/__init__.py
Normal file
|
@ -0,0 +1,9 @@
|
|||
"""
|
||||
Several extensions Python is missing, such as a proper class to handle a TCP
|
||||
communication with support for cancelling the operation, and an utility class
|
||||
to work with arbitrary binary data in a more comfortable way (writing ints,
|
||||
strings, bytes, etc.)
|
||||
"""
|
||||
from .binary_writer import BinaryWriter
|
||||
from .binary_reader import BinaryReader
|
||||
from .tcp_client import TcpClient
|
|
@ -1,3 +1,4 @@
|
|||
"""Various helpers not related to the Telegram API itself"""
|
||||
from hashlib import sha1, sha256
|
||||
import os
|
||||
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
from .mtproto_plain_sender import MtProtoPlainSender
|
||||
from .tcp_client import TcpClient
|
||||
from .authenticator import do_authentication
|
||||
from .mtproto_sender import MtProtoSender
|
||||
from .tcp_transport import TcpTransport
|
||||
|
|
|
@ -5,7 +5,7 @@ from hashlib import sha1
|
|||
from .. import helpers as utils
|
||||
from ..crypto import AES, RSA, AuthKey, Factorization
|
||||
from ..network import MtProtoPlainSender
|
||||
from ..utils import BinaryReader, BinaryWriter
|
||||
from ..extensions import BinaryReader, BinaryWriter
|
||||
|
||||
|
||||
def do_authentication(transport):
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import random
|
||||
import time
|
||||
|
||||
from ..utils import BinaryReader, BinaryWriter
|
||||
from ..extensions import BinaryReader, BinaryWriter
|
||||
|
||||
|
||||
class MtProtoPlainSender:
|
||||
|
|
|
@ -8,7 +8,7 @@ from ..errors import (BadMessageError, FloodWaitError,
|
|||
RPCError, InvalidDCError)
|
||||
from ..tl.all_tlobjects import tlobjects
|
||||
from ..tl.types import MsgsAck
|
||||
from ..utils import BinaryReader, BinaryWriter
|
||||
from ..extensions import BinaryReader, BinaryWriter
|
||||
|
||||
import logging
|
||||
logging.getLogger(__name__).addHandler(logging.NullHandler())
|
||||
|
|
|
@ -2,8 +2,8 @@ from binascii import crc32
|
|||
from datetime import timedelta
|
||||
|
||||
from ..errors import InvalidChecksumError
|
||||
from ..network import TcpClient
|
||||
from ..utils import BinaryWriter
|
||||
from ..extensions import TcpClient
|
||||
from ..extensions import BinaryWriter
|
||||
|
||||
|
||||
class TcpTransport:
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
"""Utilities for working with TLObjects.
|
||||
We have these because some TLObjects differ in very little things,
|
||||
for example, some may have an `user_id` attribute and other a `chat_id` but,
|
||||
after all, both are the same attribute, IDs."""
|
||||
"""
|
||||
Utilities for working with the Telegram API itself (such as handy methods
|
||||
to convert between an entity like an User, Chat, etc. into its Input version)
|
||||
"""
|
||||
from mimetypes import add_type, guess_extension
|
||||
|
||||
from ..tl.types import (
|
||||
from .tl.types import (
|
||||
Channel, Chat, ChatPhoto, InputPeerChannel, InputPeerChat, InputPeerUser,
|
||||
MessageMediaDocument, MessageMediaPhoto, PeerChannel, PeerChat, PeerUser,
|
||||
User, UserProfilePhoto)
|
|
@ -1,3 +0,0 @@
|
|||
from .binary_writer import BinaryWriter
|
||||
from .binary_reader import BinaryReader
|
||||
from .tl_utils import *
|
|
@ -4,7 +4,8 @@ import threading
|
|||
import unittest
|
||||
|
||||
import telethon.network.authenticator as authenticator
|
||||
from telethon.network import TcpClient, TcpTransport
|
||||
from telethon.extensions import TcpClient
|
||||
from telethon.network import TcpTransport
|
||||
|
||||
|
||||
def run_server_echo_thread(port):
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import os
|
||||
import unittest
|
||||
from telethon.utils import BinaryReader, BinaryWriter
|
||||
from telethon.extensions import BinaryReader, BinaryWriter
|
||||
|
||||
|
||||
class UtilsTests(unittest.TestCase):
|
||||
|
|
Loading…
Reference in New Issue
Block a user