From ac7964a7b451a438f73e87a234dfadfd3fe65fe4 Mon Sep 17 00:00:00 2001 From: Ivan Habunek Date: Tue, 5 Dec 2023 12:00:45 +0100 Subject: [PATCH] Use cached fn to get settings --- toot/cli/base.py | 4 ++-- toot/settings.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/toot/cli/base.py b/toot/cli/base.py index b16cb34..630c8a5 100644 --- a/toot/cli/base.py +++ b/toot/cli/base.py @@ -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} diff --git a/toot/settings.py b/toot/settings.py index 90d4443..3862c8f 100644 --- a/toot/settings.py +++ b/toot/settings.py @@ -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")