Source code for pymyinstall.installhelper.install_memoize
"""
Caching functions
:githublink:`%|py|5`
"""
[docs]def install_memoize(f):
"""
cache a downloaded page
:githublink:`%|py|10`
"""
memo = {}
def helper(x):
if x not in memo:
memo[x] = f(x)
return memo[x]
return helper
[docs]def install_memoize2(f):
"""
cache a downloaded page
:githublink:`%|py|23`
"""
memo = {}
def helper(x, is406=False):
if x not in memo:
memo[x] = f(x, is406)
return memo[x]
return helper