Fix cyclic imports on Python 3.4 by moving Session one level up

This commit is contained in:
Lonami Exo 2018-01-19 22:55:28 +01:00
parent 519c113b58
commit 4d4e81e609
3 changed files with 6 additions and 8 deletions

View File

@ -9,9 +9,10 @@ from enum import Enum
from os.path import isfile as file_exists
from threading import Lock
from .. import utils
from ..tl import TLObject
from ..tl.types import (
from . import utils
from .crypto import AuthKey
from .tl import TLObject
from .tl.types import (
PeerUser, PeerChat, PeerChannel,
InputPeerUser, InputPeerChat, InputPeerChannel,
InputPhoto, InputDocument
@ -118,7 +119,6 @@ class Session:
tuple_ = c.fetchone()
if tuple_:
self._dc_id, self._server_address, self._port, key, = tuple_
from ..crypto import AuthKey
self._auth_key = AuthKey(data=key)
c.close()
@ -173,7 +173,6 @@ class Session:
self._server_address = \
data.get('server_address', self._server_address)
from ..crypto import AuthKey
if data.get('auth_key_data', None) is not None:
key = b64decode(data['auth_key_data'])
self._auth_key = AuthKey(data=key)
@ -228,7 +227,6 @@ class Session:
c.execute('select auth_key from sessions')
tuple_ = c.fetchone()
if tuple_:
from ..crypto import AuthKey
self._auth_key = AuthKey(data=tuple_[0])
else:
self._auth_key = None

View File

@ -15,7 +15,8 @@ from .errors import (
PhoneMigrateError, NetworkMigrateError, UserMigrateError
)
from .network import authenticator, MtProtoSender, Connection, ConnectionMode
from .tl import TLObject, Session
from .session import Session
from .tl import TLObject
from .tl.all_tlobjects import LAYER
from .tl.functions import (
InitConnectionRequest, InvokeWithLayerRequest, PingRequest

View File

@ -1,5 +1,4 @@
from .tlobject import TLObject
from .session import Session
from .gzip_packed import GzipPacked
from .tl_message import TLMessage
from .message_container import MessageContainer