From 92c0bced2aba814b0ccc7e7068bfba2f50449f6e Mon Sep 17 00:00:00 2001 From: almaz amanzholuly Date: Sun, 24 Mar 2024 05:22:23 +0500 Subject: [PATCH] clean-up --- django/core/cache/backends/filebased.py | 11 ++++++----- django/core/checks/caches.py | 12 +++++++----- 2 files changed, 13 insertions(+), 10 deletions(-) diff --git a/django/core/cache/backends/filebased.py b/django/core/cache/backends/filebased.py index 41ee2689c0..a2624cc906 100644 --- a/django/core/cache/backends/filebased.py +++ b/django/core/cache/backends/filebased.py @@ -172,7 +172,7 @@ class FileBasedCache(BaseCache): ] @classmethod - def check(cls, cache, paths, name, alias_name='default'): + def check(cls, cache, paths, name, alias_name="default"): cache_path = pathlib.Path(cache._dir).resolve() if any(path == cache_path for path in paths): relation = "matches" @@ -184,7 +184,8 @@ class FileBasedCache(BaseCache): return None return Warning( - f"Your '{alias_name}' cache configuration might expose your cache " - f"or lead to corruption of your data because its LOCATION " - f"{relation} {name}.", id="caches.W002", - ) + f"Your '{alias_name}' cache configuration might expose your cache " + f"or lead to corruption of your data because its LOCATION " + f"{relation} {name}.", + id="caches.W002", + ) diff --git a/django/core/checks/caches.py b/django/core/checks/caches.py index 857f8bf401..bd28ec5076 100644 --- a/django/core/checks/caches.py +++ b/django/core/checks/caches.py @@ -22,9 +22,9 @@ def check_default_cache_is_configured(app_configs, **kwargs): @register(Tags.caches, deploy=True) def check_cache_location_not_exposed(app_configs, **kwargs): cache = None - alias_name = '' + alias_name = "" for alias, config in settings.CACHES.items(): - if config.get('BACKEND').endswith("FileBasedCache"): + if config.get("BACKEND").endswith("FileBasedCache"): cache = caches[alias] alias_name = alias @@ -56,12 +56,14 @@ def check_file_based_cache_is_absolute(app_configs, **kwargs): alias_name = None location = None for alias, config in settings.CACHES.items(): - if config.get('BACKEND').endswith("FileBasedCache"): + if config.get("BACKEND").endswith("FileBasedCache"): alias_name = alias location = config - if (alias_name is not None and - not pathlib.Path(location.get("LOCATION")).is_absolute()): + if ( + alias_name is not None + and not pathlib.Path(location.get("LOCATION")).is_absolute() + ): return Warning( f"Your '{alias_name}' cache LOCATION path is relative. Use an " f"absolute path instead.",