mirror of
https://github.com/ihabunek/toot.git
synced 2024-09-29 04:35:54 -04:00
Use cached fn to get settings
This commit is contained in:
parent
bbb5658781
commit
ac7964a7b4
@ -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}
|
||||
|
@ -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")
|
||||
|
Loading…
Reference in New Issue
Block a user