Skip to content

Commit 121e502

Browse files
committed
Remove lru_cache in favor of cache param
This makes it easier to read
1 parent a96ebfe commit 121e502

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/scyjava/__init__.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
_MODULE_PROPERTIES: Dict[str, Callable] = {}
2424

2525

26-
def module_property(func: Callable[[], Any]) -> Callable[[], Any]:
26+
def module_property(func: Callable[[], Any], cache=True) -> Callable[[], Any]:
2727
"""
2828
Turns a function into a property of this module
2929
Functions decorated with this property must have a
@@ -37,6 +37,8 @@ def module_property(func: Callable[[], Any]) -> Callable[[], Any]:
3737
to become a module property!"""
3838
)
3939
name = func.__name__[1:]
40+
if cache:
41+
func = (lru_cache(maxsize=None))(func)
4042
_MODULE_PROPERTIES[name] = func
4143
return func
4244

@@ -53,7 +55,6 @@ def __getattr__(name):
5355

5456

5557
@module_property
56-
@lru_cache(maxsize=None)
5758
def ___version__():
5859
# First pass: use the version output by setuptools_scm
5960
try:

0 commit comments

Comments
 (0)