Skip to content

Commit

Permalink
Correct use of lru_cache for helpers (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
zvecr authored Nov 15, 2024
1 parent 1e98a2e commit 75dcb0e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
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

0 comments on commit 75dcb0e

Please sign in to comment.