From 19a4f748f57d76bc484115699113be1f34c4d38a Mon Sep 17 00:00:00 2001 From: past-hypothesis <129170254+past-hypothesis@users.noreply.github.com> Date: Tue, 28 Jan 2025 22:42:37 +0700 Subject: [PATCH] functools.py: add a dummy lru_cache() implementation --- python-stdlib/functools/functools.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/python-stdlib/functools/functools.py b/python-stdlib/functools/functools.py index b3c368e8a..1b2271d8d 100644 --- a/python-stdlib/functools/functools.py +++ b/python-stdlib/functools/functools.py @@ -17,6 +17,15 @@ def wraps(wrapped, assigned=None, updated=None): return lambda x: x +def lru_cache(*args, **kwargs): + def lru_cache_impl(func): + return func + if len(args) == 1 and callable(args[0]): + return lru_cache_impl(args[0]) + else: + return lru_cache_impl + + def reduce(function, iterable, initializer=None): it = iter(iterable) if initializer is None: