mirror of
https://github.com/django/django.git
synced 2025-10-26 23:26:08 +00:00
Refs #23919 -- Stopped using django.utils.lru_cache().
This commit is contained in:
committed by
Tim Graham
parent
2b281cc35e
commit
3cc5f01d9b
@@ -1,3 +1,4 @@
|
||||
import functools
|
||||
import inspect
|
||||
from functools import partial
|
||||
|
||||
@@ -13,7 +14,6 @@ from django.db.models.query_utils import PathInfo
|
||||
from django.db.models.utils import make_model_tuple
|
||||
from django.utils.encoding import force_text
|
||||
from django.utils.functional import cached_property, curry
|
||||
from django.utils.lru_cache import lru_cache
|
||||
from django.utils.translation import ugettext_lazy as _
|
||||
|
||||
from . import Field
|
||||
@@ -710,7 +710,7 @@ class ForeignObject(RelatedField):
|
||||
return pathinfos
|
||||
|
||||
@classmethod
|
||||
@lru_cache(maxsize=None)
|
||||
@functools.lru_cache(maxsize=None)
|
||||
def get_lookups(cls):
|
||||
bases = inspect.getmro(cls)
|
||||
bases = bases[:bases.index(ForeignObject) + 1]
|
||||
|
||||
@@ -5,12 +5,12 @@ Factored out from django.db.models.query to avoid making the main module very
|
||||
large and/or so that they can be used by other modules without getting into
|
||||
circular import difficulties.
|
||||
"""
|
||||
import functools
|
||||
import inspect
|
||||
from collections import namedtuple
|
||||
|
||||
from django.db.models.constants import LOOKUP_SEP
|
||||
from django.utils import tree
|
||||
from django.utils.lru_cache import lru_cache
|
||||
|
||||
# PathInfo is used when converting lookups (fk__somecol). The contents
|
||||
# describe the relation in Model terms (model Options and Fields for both
|
||||
@@ -137,7 +137,7 @@ class RegisterLookupMixin(object):
|
||||
return cls.get_lookups().get(lookup_name, None)
|
||||
|
||||
@classmethod
|
||||
@lru_cache(maxsize=None)
|
||||
@functools.lru_cache(maxsize=None)
|
||||
def get_lookups(cls):
|
||||
class_lookups = [parent.__dict__.get('class_lookups', {}) for parent in inspect.getmro(cls)]
|
||||
return cls.merge_dicts(class_lookups)
|
||||
|
||||
Reference in New Issue
Block a user