3737CORE_TASK_SLEEP_SEC = 0.1
3838ACCOUNT_CLEANUP_DELAY = 10
3939SCHEMA_BACKUP_DELAY = 120
40- SHILL_LIST_BACKUP_PATH = Path ("objects.sbf" ) # sbf -> Schema Backup File
40+ DAF_PATH = Path .home ().joinpath ("daf" )
41+ SHILL_LIST_BACKUP_PATH = DAF_PATH .joinpath ("objects.sbf" ) # sbf -> Schema Backup File
4142# ---------------------------------------
4243
4344
@@ -79,6 +80,7 @@ async def schema_backup_task():
7980 loop .call_later (SCHEMA_BACKUP_DELAY , event .set )
8081 await event .wait ()
8182 event .clear ()
83+ DAF_PATH .mkdir (parents = True , exist_ok = True )
8284 tmp_path = str (SHILL_LIST_BACKUP_PATH ) + ".1"
8385 trace ("Saving objects to file." , TraceLEVELS .DEBUG )
8486 try :
@@ -118,7 +120,7 @@ async def schema_load_from_file() -> None:
118120async def initialize (user_callback : Optional [Union [Callable , Coroutine ]] = None ,
119121 debug : Optional [Union [TraceLEVELS , int , str ]] = TraceLEVELS .NORMAL ,
120122 logger : Optional [logging .LoggerBASE ] = None ,
121- accounts : List [client .ACCOUNT ] = [] ,
123+ accounts : List [client .ACCOUNT ] = None ,
122124 save_to_file : bool = False ) -> None :
123125 """
124126 The main initialization function.
@@ -132,6 +134,8 @@ async def initialize(user_callback: Optional[Union[Callable, Coroutine]] = None,
132134 Parameters are the same as in :func:`daf.core.run`.
133135 """
134136 loop = asyncio .get_event_loop ()
137+ if accounts is None :
138+ accounts = []
135139 # ------------------------------------------------------------
136140 # Initialize tracing
137141 # ------------------------------------------------------------
@@ -143,7 +147,7 @@ async def initialize(user_callback: Optional[Union[Callable, Coroutine]] = None,
143147 # Initialize logging
144148 # ------------------------------------------------------------
145149 if logger is None :
146- logger = logging .LoggerJSON (path = " History" )
150+ logger = logging .LoggerJSON (path = str ( Path . home (). joinpath ( "daf/ History")) )
147151
148152 await logging .initialize (logger )
149153 # ------------------------------------------------------------
@@ -401,7 +405,7 @@ def _shutdown_clean(loop: asyncio.AbstractEventLoop) -> None:
401405def run (user_callback : Optional [Union [Callable , Coroutine ]] = None ,
402406 debug : Optional [Union [TraceLEVELS , int , str , bool ]] = TraceLEVELS .NORMAL ,
403407 logger : Optional [logging .LoggerBASE ] = None ,
404- accounts : Optional [List [client .ACCOUNT ]] = [] ,
408+ accounts : Optional [List [client .ACCOUNT ]] = None ,
405409 save_to_file : bool = False ) -> None :
406410 """
407411 .. versionchanged:: 2.7
@@ -428,7 +432,7 @@ def run(user_callback: Optional[Union[Callable, Coroutine]] = None,
428432 The higher value this option is, the more will be displayed.
429433 logger: Optional[loggers.LoggerBASE]
430434 The logging class to use.
431- If this is not provided, JSON is automatically used.
435+ If this is not provided, JSON is automatically used with the ``path`` parameter set to /<user-home-dir>/daf/History
432436 accounts: Optional[List[client.ACCOUNT]]
433437 List of :class:`~daf.client.ACCOUNT` (Discord accounts) to use.
434438 .. versionadded:: v2.4
0 commit comments