Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct use of @lru_cache for helpers #189

Merged
merged 1 commit into from
Nov 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions qmk_cli/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def is_qmk_firmware(qmk_firmware):
return True


@lru_cache(maxsize=2)
@lru_cache(maxsize=1)
def find_qmk_firmware():
"""Look for qmk_firmware in the usual places.

Expand All @@ -47,6 +47,7 @@ def find_qmk_firmware():
return Path.home() / 'qmk_firmware'


@lru_cache(maxsize=1)
def in_qmk_firmware():
"""Returns the path to the qmk_firmware we are currently in, or None if we are not inside qmk_firmware.
"""
Expand All @@ -73,7 +74,7 @@ def is_qmk_userspace(qmk_userspace):
return False


@lru_cache(maxsize=2)
@lru_cache(maxsize=1)
def find_qmk_userspace():
"""Look for qmk_userspace in the usual places.
"""
Expand All @@ -92,6 +93,7 @@ def find_qmk_userspace():
return Path.home() / 'qmk_userspace'


@lru_cache(maxsize=1)
def in_qmk_userspace():
"""Returns the path to the qmk_userspace we are currently in, or None if we are not inside qmk_userspace.
"""
Expand Down
2 changes: 1 addition & 1 deletion qmk_cli/script_qmk.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import milc

from . import __version__
from .helpers import find_qmk_firmware, is_qmk_firmware, find_qmk_userspace, is_qmk_userspace
from .helpers import find_qmk_firmware, is_qmk_firmware, find_qmk_userspace

milc.cli.milc_options(version=__version__)
milc.EMOJI_LOGLEVELS['INFO'] = '{fg_blue}Ψ{style_reset_all}'
Expand Down