Removed django.utils.functional.memoize per deprecation timeline.

refs #21351.
This commit is contained in:
Tim Graham 2014-11-24 08:36:10 -05:00
parent 9ce36512fa
commit 61ad1ea92b
3 changed files with 1 additions and 47 deletions

View file

@ -2,10 +2,8 @@ import copy
import operator
from functools import wraps
import sys
import warnings
from django.utils import six
from django.utils.deprecation import RemovedInDjango19Warning
from django.utils.six.moves import copyreg
@ -18,29 +16,6 @@ def curry(_curried_func, *args, **kwargs):
return _curried
def memoize(func, cache, num_args):
"""
Wrap a function so that results for any argument tuple are stored in
'cache'. Note that the args to the function must be usable as dictionary
keys.
Only the first num_args are considered when creating the key.
"""
warnings.warn("memoize wrapper is deprecated and will be removed in "
"Django 1.9. Use django.utils.lru_cache instead.",
RemovedInDjango19Warning, stacklevel=2)
@wraps(func)
def wrapper(*args):
mem_args = args[:num_args]
if mem_args in cache:
return cache[mem_args]
result = func(*args)
cache[mem_args] = result
return result
return wrapper
class cached_property(object):
"""
Decorator that converts a method with a single self argument into a