Correct use of lru_cache for helpers (#189)

This commit is contained in:
Joel Challis
2024-11-15 06:51:59 +00:00
committed by GitHub
parent 1e98a2e459
commit 75dcb0e475
2 changed files with 5 additions and 3 deletions
+4 -2
View File
@@ -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.
@@ -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.
"""
@@ -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.
"""
@@ -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.
"""
+1 -1
View File
@@ -13,7 +13,7 @@ from traceback import print_exc
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}'