2626import tempfile
2727import threading
2828import time
29- import warnings
3029from configparser import ConfigParser
3130from hashlib import sha256 , md5
3231from importlib import import_module
3332from pathlib import Path
3433from signal import signal , SIGINT , SIGTERM , SIGABRT
3534from threading import Thread
36- from typing import Union , List , Type
35+ from typing import Union , List
3736
3837from pyrogram .api import functions , types
3938from pyrogram .api .core import TLObject
@@ -205,24 +204,9 @@ def __init__(
205204 no_updates : bool = None ,
206205 takeout : bool = None
207206 ):
207+ super ().__init__ ()
208208
209- if isinstance (session_name , str ):
210- if session_name == ':memory:' :
211- session_storage = MemorySessionStorage (self )
212- elif session_name .startswith (':' ):
213- session_storage = StringSessionStorage (self , session_name )
214- else :
215- session_storage = SQLiteSessionStorage (self , session_name )
216- elif isinstance (session_name , SessionStorage ):
217- session_storage = session_name
218- else :
219- raise RuntimeError ('Wrong session_name passed, expected str or SessionConfig subclass' )
220-
221- super ().__init__ (session_storage )
222-
223- super ().__init__ (session_storage )
224-
225- self .session_name = str (session_name ) # TODO: build correct session name
209+ self .session_name = session_name
226210 self .api_id = int (api_id ) if api_id else None
227211 self .api_hash = api_hash
228212 self .app_version = app_version
@@ -232,7 +216,7 @@ def __init__(
232216 self .ipv6 = ipv6
233217 # TODO: Make code consistent, use underscore for private/protected fields
234218 self ._proxy = proxy
235- self .session_storage . test_mode = test_mode
219+ self .test_mode = test_mode
236220 self .bot_token = bot_token
237221 self .phone_number = phone_number
238222 self .phone_code = phone_code
0 commit comments