Slightly reorganise the project structure

This commit is contained in:
Lonami Exo 2017-06-09 16:13:39 +02:00
parent ba5bfa105f
commit 7adb4f09d6
16 changed files with 25 additions and 18 deletions

View File

@ -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:

View File

@ -1,7 +1,7 @@
import os
from hashlib import sha1
from ..utils import BinaryWriter
from ..extensions import BinaryWriter
class RSAServerKey:

View 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

View File

@ -1,3 +1,4 @@
"""Various helpers not related to the Telegram API itself"""
from hashlib import sha1, sha256
import os

View File

@ -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

View File

@ -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):

View File

@ -1,7 +1,7 @@
import random
import time
from ..utils import BinaryReader, BinaryWriter
from ..extensions import BinaryReader, BinaryWriter
class MtProtoPlainSender:

View File

@ -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())

View File

@ -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:

View File

@ -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)

View File

@ -1,3 +0,0 @@
from .binary_writer import BinaryWriter
from .binary_reader import BinaryReader
from .tl_utils import *

View File

@ -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):

View File

@ -1,6 +1,6 @@
import os
import unittest
from telethon.utils import BinaryReader, BinaryWriter
from telethon.extensions import BinaryReader, BinaryWriter
class UtilsTests(unittest.TestCase):