summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2021-09-27 09:10:58 +0200
committerGitHub <noreply@github.com>2021-09-27 09:10:58 +0200
commit5bac1719a2fcbee5cb8b9e22c3480e3a24ed6c4c (patch)
tree52fa4da11d16e934345efbbac1b8dde9b85ff876
parent840ad06300ac38e0e0e18ea36d6969cc03c875a9 (diff)
Refs #32355 -- Used @functools.lru_cache as a straight decorator.
-rw-r--r--django/contrib/auth/hashers.py4
-rw-r--r--django/contrib/postgres/signals.py4
-rw-r--r--django/db/models/utils.py4
-rw-r--r--django/forms/renderers.py2
-rw-r--r--django/template/engine.py2
-rw-r--r--django/template/utils.py2
-rw-r--r--django/utils/autoreload.py2
-rw-r--r--django/utils/formats.py2
-rw-r--r--django/utils/timezone.py2
-rw-r--r--django/utils/translation/trans_real.py2
-rw-r--r--django/utils/version.py2
-rw-r--r--django/views/debug.py2
12 files changed, 15 insertions, 15 deletions
diff --git a/django/contrib/auth/hashers.py b/django/contrib/auth/hashers.py
index 619f61ee3b..be42cae3c0 100644
--- a/django/contrib/auth/hashers.py
+++ b/django/contrib/auth/hashers.py
@@ -83,7 +83,7 @@ def make_password(password, salt=None, hasher='default'):
return hasher.encode(password, salt)
-@functools.lru_cache()
+@functools.lru_cache
def get_hashers():
hashers = []
for hasher_path in settings.PASSWORD_HASHERS:
@@ -96,7 +96,7 @@ def get_hashers():
return hashers
-@functools.lru_cache()
+@functools.lru_cache
def get_hashers_by_algorithm():
return {hasher.algorithm: hasher for hasher in get_hashers()}
diff --git a/django/contrib/postgres/signals.py b/django/contrib/postgres/signals.py
index abfd89005d..420b5f6033 100644
--- a/django/contrib/postgres/signals.py
+++ b/django/contrib/postgres/signals.py
@@ -8,7 +8,7 @@ from django.db import connections
from django.db.backends.base.base import NO_DB_ALIAS
-@functools.lru_cache()
+@functools.lru_cache
def get_hstore_oids(connection_alias):
"""Return hstore and hstore array OIDs."""
with connections[connection_alias].cursor() as cursor:
@@ -26,7 +26,7 @@ def get_hstore_oids(connection_alias):
return tuple(oids), tuple(array_oids)
-@functools.lru_cache()
+@functools.lru_cache
def get_citext_oids(connection_alias):
"""Return citext array OIDs."""
with connections[connection_alias].cursor() as cursor:
diff --git a/django/db/models/utils.py b/django/db/models/utils.py
index a8bd20fba7..949c528469 100644
--- a/django/db/models/utils.py
+++ b/django/db/models/utils.py
@@ -38,9 +38,9 @@ def unpickle_named_row(names, values):
return create_namedtuple_class(*names)(*values)
-@functools.lru_cache()
+@functools.lru_cache
def create_namedtuple_class(*names):
- # Cache type() with @lru_cache() since it's too slow to be called for every
+ # Cache type() with @lru_cache since it's too slow to be called for every
# QuerySet evaluation.
def __reduce__(self):
return unpickle_named_row, (names, tuple(self))
diff --git a/django/forms/renderers.py b/django/forms/renderers.py
index ce3b7097e6..ffb61600c2 100644
--- a/django/forms/renderers.py
+++ b/django/forms/renderers.py
@@ -8,7 +8,7 @@ from django.utils.functional import cached_property
from django.utils.module_loading import import_string
-@functools.lru_cache()
+@functools.lru_cache
def get_default_renderer():
renderer_class = import_string(settings.FORM_RENDERER)
return renderer_class()
diff --git a/django/template/engine.py b/django/template/engine.py
index 0adc20cfb3..91e503f709 100644
--- a/django/template/engine.py
+++ b/django/template/engine.py
@@ -73,7 +73,7 @@ class Engine:
)
@staticmethod
- @functools.lru_cache()
+ @functools.lru_cache
def get_default():
"""
Return the first DjangoTemplates backend that's configured, or raise
diff --git a/django/template/utils.py b/django/template/utils.py
index 2d30e1637a..ad7baba2f3 100644
--- a/django/template/utils.py
+++ b/django/template/utils.py
@@ -90,7 +90,7 @@ class EngineHandler:
return [self[alias] for alias in self]
-@functools.lru_cache()
+@functools.lru_cache
def get_app_template_dirs(dirname):
"""
Return an iterable of paths of directories to load app templates from.
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
index 15df088c48..cc65c043ab 100644
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -441,7 +441,7 @@ class WatchmanReloader(BaseReloader):
logger.debug('Watchman watch-project result: %s', result)
return result['watch'], result.get('relative_path')
- @functools.lru_cache()
+ @functools.lru_cache
def _get_clock(self, root):
return self.client.query('clock', root)['clock']
diff --git a/django/utils/formats.py b/django/utils/formats.py
index 781d334a8e..3aef3bc23c 100644
--- a/django/utils/formats.py
+++ b/django/utils/formats.py
@@ -239,7 +239,7 @@ def localize_input(value, default=None):
return value
-@functools.lru_cache()
+@functools.lru_cache
def sanitize_strftime_format(fmt):
"""
Ensure that certain specifiers are correctly padded with leading zeros.
diff --git a/django/utils/timezone.py b/django/utils/timezone.py
index 0c23486c1f..9572c99bac 100644
--- a/django/utils/timezone.py
+++ b/django/utils/timezone.py
@@ -47,7 +47,7 @@ def get_fixed_timezone(offset):
# In order to avoid accessing settings at compile time,
# wrap the logic in a function and cache the result.
-@functools.lru_cache()
+@functools.lru_cache
def get_default_timezone():
"""
Return the default time zone as a tzinfo instance.
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
index 173ad08639..7dcc77b46c 100644
--- a/django/utils/translation/trans_real.py
+++ b/django/utils/translation/trans_real.py
@@ -452,7 +452,7 @@ def check_for_language(lang_code):
)
-@functools.lru_cache()
+@functools.lru_cache
def get_languages():
"""
Cache of settings.LANGUAGES in a dictionary for easy lookups by key.
diff --git a/django/utils/version.py b/django/utils/version.py
index 3ce6f465bd..7f4e9e3cce 100644
--- a/django/utils/version.py
+++ b/django/utils/version.py
@@ -70,7 +70,7 @@ def get_docs_version(version=None):
return '%d.%d' % version[:2]
-@functools.lru_cache()
+@functools.lru_cache
def get_git_changeset():
"""Return a numeric identifier of the latest git changeset.
diff --git a/django/views/debug.py b/django/views/debug.py
index 16c9ad7fc8..da9a17e60f 100644
--- a/django/views/debug.py
+++ b/django/views/debug.py
@@ -69,7 +69,7 @@ def technical_500_response(request, exc_type, exc_value, tb, status_code=500):
return HttpResponse(text, status=status_code, content_type='text/plain; charset=utf-8')
-@functools.lru_cache()
+@functools.lru_cache
def get_default_exception_reporter_filter():
# Instantiate the default filter for the first time and cache it.
return import_string(settings.DEFAULT_EXCEPTION_REPORTER_FILTER)()