From bfcdfdcfc1cd71177d44a0617902d8195c067731 Mon Sep 17 00:00:00 2001 From: Yohan Boniface Date: Tue, 5 Mar 2024 17:23:19 +0100 Subject: [PATCH] chore: bump ruff --- pyproject.toml | 2 +- umap/settings/base.py | 1 + umap/settings/dev.py | 1 + umap/tests/integration/test_statics.py | 6 +++--- umap/tests/integration/test_tilelayer.py | 6 +++--- umap/tests/settings.py | 6 +++--- umap/views.py | 12 ++++++------ umap/wsgi.py | 1 + 8 files changed, 19 insertions(+), 16 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 55f13225..25d1a5bf 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -44,7 +44,7 @@ dependencies = [ [project.optional-dependencies] dev = [ "hatch==1.9.3", - "ruff==0.2.2", + "ruff==0.3.0", "djlint==1.34.1", "mkdocs==1.5.3", "mkdocs-material==9.5.12", diff --git a/umap/settings/base.py b/umap/settings/base.py index d29d08eb..dbccaea9 100644 --- a/umap/settings/base.py +++ b/umap/settings/base.py @@ -1,4 +1,5 @@ """Base settings shared by all environments""" + # Import global settings to make it easier to extend settings. from email.utils import parseaddr diff --git a/umap/settings/dev.py b/umap/settings/dev.py index 47fd35c0..30013fc3 100644 --- a/umap/settings/dev.py +++ b/umap/settings/dev.py @@ -1,4 +1,5 @@ """Settings for Development Server""" + from umap.settings.base import * # pylint: disable=W0614,W0401 DEBUG = True diff --git a/umap/tests/integration/test_statics.py b/umap/tests/integration/test_statics.py index 7f2a0679..f1aa9306 100644 --- a/umap/tests/integration/test_statics.py +++ b/umap/tests/integration/test_statics.py @@ -15,9 +15,9 @@ def staticfiles(settings): settings.STATIC_ROOT = static_root # Make sure settings are properly reset after the test settings.STORAGES = deepcopy(settings.STORAGES) - settings.STORAGES["staticfiles"][ - "BACKEND" - ] = "umap.storage.UmapManifestStaticFilesStorage" + settings.STORAGES["staticfiles"]["BACKEND"] = ( + "umap.storage.UmapManifestStaticFilesStorage" + ) try: call_command("collectstatic", "--noinput") yield diff --git a/umap/tests/integration/test_tilelayer.py b/umap/tests/integration/test_tilelayer.py index b2922b6f..c6897935 100644 --- a/umap/tests/integration/test_tilelayer.py +++ b/umap/tests/integration/test_tilelayer.py @@ -101,9 +101,9 @@ def test_map_should_display_custom_tilelayer(map, live_server, tilelayers, page) url_pattern = re.compile( r"https://[abc]{1}.basemaps.cartocdn.com/rastertiles/voyager/\d+/\d+/\d+.png" ) - map.settings["properties"]["tilelayer"][ - "url_template" - ] = "https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png" + map.settings["properties"]["tilelayer"]["url_template"] = ( + "https://{s}.basemaps.cartocdn.com/rastertiles/voyager/{z}/{x}/{y}{r}.png" + ) map.settings["properties"]["tilelayersControl"] = True map.save() page.goto(f"{live_server.url}{map.get_absolute_url()}") diff --git a/umap/tests/settings.py b/umap/tests/settings.py index bdc4d546..479737a9 100644 --- a/umap/tests/settings.py +++ b/umap/tests/settings.py @@ -5,9 +5,9 @@ from umap.settings.base import * # pylint: disable=W0614,W0401 SECRET_KEY = "justfortests" DEFAULT_FROM_EMAIL = "test@test.org" EMAIL_BACKEND = "django.core.mail.backends.locmem.EmailBackend" -STORAGES["staticfiles"][ - "BACKEND" -] = "django.contrib.staticfiles.storage.StaticFilesStorage" +STORAGES["staticfiles"]["BACKEND"] = ( + "django.contrib.staticfiles.storage.StaticFilesStorage" +) if os.environ.get("GITHUB_ACTIONS", False) == "true": DATABASES = { diff --git a/umap/views.py b/umap/views.py index 8bbc936b..377432ff 100644 --- a/umap/views.py +++ b/umap/views.py @@ -320,9 +320,9 @@ class UserDownload(DetailView, SearchMixin): zip_file.writestr(file_name, geojson_file.getvalue()) response = HttpResponse(zip_buffer.getvalue(), content_type="application/zip") - response[ - "Content-Disposition" - ] = 'attachment; filename="umap_backup_complete.zip"' + response["Content-Disposition"] = ( + 'attachment; filename="umap_backup_complete.zip"' + ) return response @@ -666,9 +666,9 @@ class MapDownload(DetailView): def render_to_response(self, context, *args, **kwargs): umapjson = self.object.generate_umapjson(self.request) response = simple_json_response(**umapjson) - response[ - "Content-Disposition" - ] = f'attachment; filename="umap_backup_{self.object.slug}.umap"' + response["Content-Disposition"] = ( + f'attachment; filename="umap_backup_{self.object.slug}.umap"' + ) return response diff --git a/umap/wsgi.py b/umap/wsgi.py index ea292782..8e367aa5 100644 --- a/umap/wsgi.py +++ b/umap/wsgi.py @@ -13,6 +13,7 @@ middleware here, or combine a Django application with an application of another framework. """ + import os os.environ.setdefault("DJANGO_SETTINGS_MODULE", "umap.settings")