mirror of
https://github.com/ynput/ayon-core.git
synced 2025-12-24 21:04:40 +01:00
16 lines
284 B
Python
16 lines
284 B
Python
from functools import wraps
|
|
|
|
|
|
def memoize(function):
|
|
memo = {}
|
|
|
|
@wraps(function)
|
|
def wrapper(*args):
|
|
try:
|
|
return memo[args]
|
|
except KeyError:
|
|
rv = function(*args)
|
|
memo[args] = rv
|
|
return rv
|
|
|
|
return wrapper
|