File size: 531 Bytes
360d274 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
from app_settings import AppSettings
from typing import Optional
class _AppState:
_instance: Optional["_AppState"] = None
settings: Optional[AppSettings] = None
def get_state() -> _AppState:
if _AppState._instance is None:
_AppState._instance = _AppState()
return _AppState._instance
def get_settings(skip_file: bool = False) -> AppSettings:
state = get_state()
if state.settings is None:
state.settings = AppSettings()
state.settings.load(skip_file)
return state.settings
|