summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMariusz Felisiak <felisiak.mariusz@gmail.com>2025-03-30 17:54:15 +0200
committerMariusz Felisiak <felisiak.mariusz@gmail.com>2025-03-30 17:56:41 +0200
commit9bf66655106bb8970a4db743d9f7a550270b855e (patch)
treedb4a3175d1fc013f64ff3c57d0a7a47345153118
parentda8fed601625466889849bd6383a2a78d1c17809 (diff)
[5.2.x] Fixed warnings per flake8 7.2.0.
https://github.com/PyCQA/flake8/releases/tag/7.2.0 Backport of 281910ff8e9ae98fa78ee5d26ae3f0b713ccf418 from main
-rw-r--r--django/contrib/gis/db/models/fields.py2
-rw-r--r--django/db/backends/base/base.py1
-rw-r--r--django/utils/autoreload.py1
-rw-r--r--django/utils/translation/trans_real.py1
-rw-r--r--tests/asgi/tests.py2
5 files changed, 1 insertions, 6 deletions
diff --git a/django/contrib/gis/db/models/fields.py b/django/contrib/gis/db/models/fields.py
index 889c1cfe84..812029de49 100644
--- a/django/contrib/gis/db/models/fields.py
+++ b/django/contrib/gis/db/models/fields.py
@@ -37,8 +37,6 @@ def get_srid_info(srid, connection):
"""
from django.contrib.gis.gdal import SpatialReference
- global _srid_cache
-
try:
# The SpatialRefSys model for the spatial backend.
SpatialRefSys = connection.ops.spatial_ref_sys()
diff --git a/django/db/backends/base/base.py b/django/db/backends/base/base.py
index e6e0325d07..aa9cdb5748 100644
--- a/django/db/backends/base/base.py
+++ b/django/db/backends/base/base.py
@@ -221,7 +221,6 @@ class BaseDatabaseWrapper:
def init_connection_state(self):
"""Initialize the database connection settings."""
- global RAN_DB_VERSION_CHECK
if self.alias not in RAN_DB_VERSION_CHECK:
self.check_database_version_supported()
RAN_DB_VERSION_CHECK.add(self.alias)
diff --git a/django/utils/autoreload.py b/django/utils/autoreload.py
index 31a6dfa99d..7ffc61fc92 100644
--- a/django/utils/autoreload.py
+++ b/django/utils/autoreload.py
@@ -82,7 +82,6 @@ def check_errors(fn):
def raise_last_exception():
- global _exception
if _exception is not None:
raise _exception[1]
diff --git a/django/utils/translation/trans_real.py b/django/utils/translation/trans_real.py
index 1b163aab81..86fe823bf7 100644
--- a/django/utils/translation/trans_real.py
+++ b/django/utils/translation/trans_real.py
@@ -287,7 +287,6 @@ def translation(language):
"""
Return a translation object in the default 'django' domain.
"""
- global _translations
if language not in _translations:
_translations[language] = DjangoTranslation(language)
return _translations[language]
diff --git a/tests/asgi/tests.py b/tests/asgi/tests.py
index 66ec4369d9..0b1d3cd608 100644
--- a/tests/asgi/tests.py
+++ b/tests/asgi/tests.py
@@ -487,7 +487,7 @@ class ASGITest(SimpleTestCase):
# A view that will listen for the cancelled error.
async def view(request):
- nonlocal view_started, view_did_cancel
+ nonlocal view_did_cancel
view_started.set()
try:
await asyncio.sleep(0.1)