mirror of
				https://github.com/LonamiWebs/Telethon.git
				synced 2025-11-04 01:47:27 +03:00 
			
		
		
		
	Fix cyclic imports on Python 3.4 by moving Session one level up
This commit is contained in:
		
							parent
							
								
									519c113b58
								
							
						
					
					
						commit
						4d4e81e609
					
				| 
						 | 
					@ -9,9 +9,10 @@ from enum import Enum
 | 
				
			||||||
from os.path import isfile as file_exists
 | 
					from os.path import isfile as file_exists
 | 
				
			||||||
from threading import Lock
 | 
					from threading import Lock
 | 
				
			||||||
 | 
					
 | 
				
			||||||
from .. import utils
 | 
					from . import utils
 | 
				
			||||||
from ..tl import TLObject
 | 
					from .crypto import AuthKey
 | 
				
			||||||
from ..tl.types import (
 | 
					from .tl import TLObject
 | 
				
			||||||
 | 
					from .tl.types import (
 | 
				
			||||||
    PeerUser, PeerChat, PeerChannel,
 | 
					    PeerUser, PeerChat, PeerChannel,
 | 
				
			||||||
    InputPeerUser, InputPeerChat, InputPeerChannel,
 | 
					    InputPeerUser, InputPeerChat, InputPeerChannel,
 | 
				
			||||||
    InputPhoto, InputDocument
 | 
					    InputPhoto, InputDocument
 | 
				
			||||||
| 
						 | 
					@ -118,7 +119,6 @@ class Session:
 | 
				
			||||||
            tuple_ = c.fetchone()
 | 
					            tuple_ = c.fetchone()
 | 
				
			||||||
            if tuple_:
 | 
					            if tuple_:
 | 
				
			||||||
                self._dc_id, self._server_address, self._port, key, = tuple_
 | 
					                self._dc_id, self._server_address, self._port, key, = tuple_
 | 
				
			||||||
                from ..crypto import AuthKey
 | 
					 | 
				
			||||||
                self._auth_key = AuthKey(data=key)
 | 
					                self._auth_key = AuthKey(data=key)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            c.close()
 | 
					            c.close()
 | 
				
			||||||
| 
						 | 
					@ -173,7 +173,6 @@ class Session:
 | 
				
			||||||
                self._server_address = \
 | 
					                self._server_address = \
 | 
				
			||||||
                    data.get('server_address', self._server_address)
 | 
					                    data.get('server_address', self._server_address)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
                from ..crypto import AuthKey
 | 
					 | 
				
			||||||
                if data.get('auth_key_data', None) is not None:
 | 
					                if data.get('auth_key_data', None) is not None:
 | 
				
			||||||
                    key = b64decode(data['auth_key_data'])
 | 
					                    key = b64decode(data['auth_key_data'])
 | 
				
			||||||
                    self._auth_key = AuthKey(data=key)
 | 
					                    self._auth_key = AuthKey(data=key)
 | 
				
			||||||
| 
						 | 
					@ -228,7 +227,6 @@ class Session:
 | 
				
			||||||
        c.execute('select auth_key from sessions')
 | 
					        c.execute('select auth_key from sessions')
 | 
				
			||||||
        tuple_ = c.fetchone()
 | 
					        tuple_ = c.fetchone()
 | 
				
			||||||
        if tuple_:
 | 
					        if tuple_:
 | 
				
			||||||
            from ..crypto import AuthKey
 | 
					 | 
				
			||||||
            self._auth_key = AuthKey(data=tuple_[0])
 | 
					            self._auth_key = AuthKey(data=tuple_[0])
 | 
				
			||||||
        else:
 | 
					        else:
 | 
				
			||||||
            self._auth_key = None
 | 
					            self._auth_key = None
 | 
				
			||||||
| 
						 | 
					@ -15,7 +15,8 @@ from .errors import (
 | 
				
			||||||
    PhoneMigrateError, NetworkMigrateError, UserMigrateError
 | 
					    PhoneMigrateError, NetworkMigrateError, UserMigrateError
 | 
				
			||||||
)
 | 
					)
 | 
				
			||||||
from .network import authenticator, MtProtoSender, Connection, ConnectionMode
 | 
					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.all_tlobjects import LAYER
 | 
				
			||||||
from .tl.functions import (
 | 
					from .tl.functions import (
 | 
				
			||||||
    InitConnectionRequest, InvokeWithLayerRequest, PingRequest
 | 
					    InitConnectionRequest, InvokeWithLayerRequest, PingRequest
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1,5 +1,4 @@
 | 
				
			||||||
from .tlobject import TLObject
 | 
					from .tlobject import TLObject
 | 
				
			||||||
from .session import Session
 | 
					 | 
				
			||||||
from .gzip_packed import GzipPacked
 | 
					from .gzip_packed import GzipPacked
 | 
				
			||||||
from .tl_message import TLMessage
 | 
					from .tl_message import TLMessage
 | 
				
			||||||
from .message_container import MessageContainer
 | 
					from .message_container import MessageContainer
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue
	
	Block a user