From 6485894157949338d76ca9a0da0b4c9cfef40e10 Mon Sep 17 00:00:00 2001
From: Aymeric Augustin <aymeric.augustin@m4x.org>
Date: Sun, 22 May 2022 08:20:29 +0200
Subject: [PATCH] Renamed wrapped functions to wrapper.

All these functions are wrapping another function. They're the wrapper,
while the function they're wrapping is the wrapped.
---
 django/contrib/auth/decorators.py       |  4 ++--
 django/core/management/base.py          |  4 ++--
 django/utils/decorators.py              |  4 ++--
 django/utils/deprecation.py             |  4 ++--
 django/utils/safestring.py              |  4 ++--
 django/views/decorators/cache.py        |  4 ++--
 django/views/decorators/clickjacking.py | 12 ++++++------
 django/views/decorators/common.py       |  6 +++---
 django/views/decorators/csrf.py         |  6 +++---
 tests/auth_tests/test_management.py     |  4 ++--
 tests/decorators/tests.py               |  4 ++--
 11 files changed, 28 insertions(+), 28 deletions(-)

diff --git a/django/contrib/auth/decorators.py b/django/contrib/auth/decorators.py
index a419068d496..cfcc4a2d3a1 100644
--- a/django/contrib/auth/decorators.py
+++ b/django/contrib/auth/decorators.py
@@ -18,7 +18,7 @@ def user_passes_test(
 
     def decorator(view_func):
         @wraps(view_func)
-        def _wrapped_view(request, *args, **kwargs):
+        def _wrapper_view(request, *args, **kwargs):
             if test_func(request.user):
                 return view_func(request, *args, **kwargs)
             path = request.build_absolute_uri()
@@ -35,7 +35,7 @@ def user_passes_test(
 
             return redirect_to_login(path, resolved_login_url, redirect_field_name)
 
-        return _wrapped_view
+        return _wrapper_view
 
     return decorator
 
diff --git a/django/core/management/base.py b/django/core/management/base.py
index f0e711ac762..d37d43d5c5d 100644
--- a/django/core/management/base.py
+++ b/django/core/management/base.py
@@ -87,7 +87,7 @@ def handle_default_options(options):
 def no_translations(handle_func):
     """Decorator that forces a command to run with translations deactivated."""
 
-    def wrapped(*args, **kwargs):
+    def wrapper(*args, **kwargs):
         from django.utils import translation
 
         saved_locale = translation.get_language()
@@ -99,7 +99,7 @@ def no_translations(handle_func):
                 translation.activate(saved_locale)
         return res
 
-    return wrapped
+    return wrapper
 
 
 class DjangoHelpFormatter(HelpFormatter):
diff --git a/django/utils/decorators.py b/django/utils/decorators.py
index e412bb15e13..650247a7bb8 100644
--- a/django/utils/decorators.py
+++ b/django/utils/decorators.py
@@ -120,7 +120,7 @@ def make_middleware_decorator(middleware_class):
             middleware = middleware_class(view_func, *m_args, **m_kwargs)
 
             @wraps(view_func)
-            def _wrapped_view(request, *args, **kwargs):
+            def _wrapper_view(request, *args, **kwargs):
                 if hasattr(middleware, "process_request"):
                     result = middleware.process_request(request)
                     if result is not None:
@@ -155,7 +155,7 @@ def make_middleware_decorator(middleware_class):
                         return middleware.process_response(request, response)
                 return response
 
-            return _wrapped_view
+            return _wrapper_view
 
         return _decorator
 
diff --git a/django/utils/deprecation.py b/django/utils/deprecation.py
index 10b47585870..caed5b25d4b 100644
--- a/django/utils/deprecation.py
+++ b/django/utils/deprecation.py
@@ -27,7 +27,7 @@ class warn_about_renamed_method:
         self.deprecation_warning = deprecation_warning
 
     def __call__(self, f):
-        def wrapped(*args, **kwargs):
+        def wrapper(*args, **kwargs):
             warnings.warn(
                 "`%s.%s` is deprecated, use `%s` instead."
                 % (self.class_name, self.old_method_name, self.new_method_name),
@@ -36,7 +36,7 @@ class warn_about_renamed_method:
             )
             return f(*args, **kwargs)
 
-        return wrapped
+        return wrapper
 
 
 class RenameMethodsBase(type):
diff --git a/django/utils/safestring.py b/django/utils/safestring.py
index c3eab584407..4eb0207a66a 100644
--- a/django/utils/safestring.py
+++ b/django/utils/safestring.py
@@ -49,10 +49,10 @@ SafeText = SafeString  # For backwards compatibility since Django 2.0.
 
 def _safety_decorator(safety_marker, func):
     @wraps(func)
-    def wrapped(*args, **kwargs):
+    def wrapper(*args, **kwargs):
         return safety_marker(func(*args, **kwargs))
 
-    return wrapped
+    return wrapper
 
 
 @keep_lazy(SafeString)
diff --git a/django/views/decorators/cache.py b/django/views/decorators/cache.py
index de61b6fe266..6004b2f138b 100644
--- a/django/views/decorators/cache.py
+++ b/django/views/decorators/cache.py
@@ -52,7 +52,7 @@ def never_cache(view_func):
     """
 
     @wraps(view_func)
-    def _wrapped_view_func(request, *args, **kwargs):
+    def _wrapper_view_func(request, *args, **kwargs):
         # Ensure argument looks like a request.
         if not hasattr(request, "META"):
             raise TypeError(
@@ -63,4 +63,4 @@ def never_cache(view_func):
         add_never_cache_headers(response)
         return response
 
-    return _wrapped_view_func
+    return _wrapper_view_func
diff --git a/django/views/decorators/clickjacking.py b/django/views/decorators/clickjacking.py
index c59f4f20985..005d942c760 100644
--- a/django/views/decorators/clickjacking.py
+++ b/django/views/decorators/clickjacking.py
@@ -12,13 +12,13 @@ def xframe_options_deny(view_func):
         ...
     """
 
-    def wrapped_view(*args, **kwargs):
+    def wrapper_view(*args, **kwargs):
         resp = view_func(*args, **kwargs)
         if resp.get("X-Frame-Options") is None:
             resp["X-Frame-Options"] = "DENY"
         return resp
 
-    return wraps(view_func)(wrapped_view)
+    return wraps(view_func)(wrapper_view)
 
 
 def xframe_options_sameorigin(view_func):
@@ -32,13 +32,13 @@ def xframe_options_sameorigin(view_func):
         ...
     """
 
-    def wrapped_view(*args, **kwargs):
+    def wrapper_view(*args, **kwargs):
         resp = view_func(*args, **kwargs)
         if resp.get("X-Frame-Options") is None:
             resp["X-Frame-Options"] = "SAMEORIGIN"
         return resp
 
-    return wraps(view_func)(wrapped_view)
+    return wraps(view_func)(wrapper_view)
 
 
 def xframe_options_exempt(view_func):
@@ -51,9 +51,9 @@ def xframe_options_exempt(view_func):
         ...
     """
 
-    def wrapped_view(*args, **kwargs):
+    def wrapper_view(*args, **kwargs):
         resp = view_func(*args, **kwargs)
         resp.xframe_options_exempt = True
         return resp
 
-    return wraps(view_func)(wrapped_view)
+    return wraps(view_func)(wrapper_view)
diff --git a/django/views/decorators/common.py b/django/views/decorators/common.py
index 8c846881229..a973389549c 100644
--- a/django/views/decorators/common.py
+++ b/django/views/decorators/common.py
@@ -8,8 +8,8 @@ def no_append_slash(view_func):
     """
     # view_func.should_append_slash = False would also work, but decorators are
     # nicer if they don't have side effects, so return a new function.
-    def wrapped_view(*args, **kwargs):
+    def wrapper_view(*args, **kwargs):
         return view_func(*args, **kwargs)
 
-    wrapped_view.should_append_slash = False
-    return wraps(view_func)(wrapped_view)
+    wrapper_view.should_append_slash = False
+    return wraps(view_func)(wrapper_view)
diff --git a/django/views/decorators/csrf.py b/django/views/decorators/csrf.py
index 4841089ca84..e6c9cb7660a 100644
--- a/django/views/decorators/csrf.py
+++ b/django/views/decorators/csrf.py
@@ -50,8 +50,8 @@ def csrf_exempt(view_func):
     """Mark a view function as being exempt from the CSRF view protection."""
     # view_func.csrf_exempt = True would also work, but decorators are nicer
     # if they don't have side effects, so return a new function.
-    def wrapped_view(*args, **kwargs):
+    def wrapper_view(*args, **kwargs):
         return view_func(*args, **kwargs)
 
-    wrapped_view.csrf_exempt = True
-    return wraps(view_func)(wrapped_view)
+    wrapper_view.csrf_exempt = True
+    return wraps(view_func)(wrapper_view)
diff --git a/tests/auth_tests/test_management.py b/tests/auth_tests/test_management.py
index 2e82c1bb144..5d695e42a65 100644
--- a/tests/auth_tests/test_management.py
+++ b/tests/auth_tests/test_management.py
@@ -49,7 +49,7 @@ def mock_inputs(inputs):
     """
 
     def inner(test_func):
-        def wrapped(*args):
+        def wrapper(*args):
             class mock_getpass:
                 @staticmethod
                 def getpass(prompt=b"Password: ", stream=None):
@@ -90,7 +90,7 @@ def mock_inputs(inputs):
                 createsuperuser.getpass = old_getpass
                 builtins.input = old_input
 
-        return wrapped
+        return wrapper
 
     return inner
 
diff --git a/tests/decorators/tests.py b/tests/decorators/tests.py
index a5bfeae7ead..38bf0c7ee14 100644
--- a/tests/decorators/tests.py
+++ b/tests/decorators/tests.py
@@ -196,10 +196,10 @@ class ClsDec:
         self.myattr = myattr
 
     def __call__(self, f):
-        def wrapped():
+        def wrapper():
             return f() and self.myattr
 
-        return update_wrapper(wrapped, f)
+        return update_wrapper(wrapper, f)
 
 
 class MethodDecoratorTests(SimpleTestCase):