Use cached fn to get settings

This commit is contained in:
Ivan Habunek 2023-12-05 12:00:45 +01:00
parent bbb5658781
commit ac7964a7b4
No known key found for this signature in database
GPG Key ID: F5F0623FF5EBCB3D
2 changed files with 4 additions and 4 deletions

View File

@ -7,7 +7,7 @@ import typing as t
from click.testing import Result
from functools import wraps
from toot import App, User, config, __version__
from toot.settings import load_settings
from toot.settings import get_settings
if t.TYPE_CHECKING:
import typing_extensions as te
@ -33,7 +33,7 @@ def get_default_visibility() -> str:
def get_default_map():
settings = load_settings()
settings = get_settings()
common = settings.get("common", {})
commands = settings.get("commands", {})
return {**common, **commands}

View File

@ -17,7 +17,7 @@ def get_settings_path():
return join(get_config_dir(), TOOT_SETTINGS_FILE_NAME)
def load_settings() -> dict:
def _load_settings() -> dict:
# Used for testing without config file
if DISABLE_SETTINGS:
return {}
@ -33,7 +33,7 @@ def load_settings() -> dict:
@lru_cache(maxsize=None)
def get_settings():
return load_settings()
return _load_settings()
T = TypeVar("T")