in dcrpm/util.py [0:0]
def memoize(f):
# type: (t.Callable[..., t.TypeVar("RT")]) -> t.Callable[..., t.TypeVar("RT")]
cache = {} # type: t.Dict[str, t.TypeVar("RT")]
# pyre-ignore[2]: *args and **kwargs
def wrapper(*args, **kwargs):
# type: (t.Any, t.Any) -> t.TypeVar("RT")
key = str(args) + str(kwargs)
if key not in cache:
cache[key] = f(*args, **kwargs)
return cache[key]
return wrapper