Skip to content

Commit 6ca07fd

Browse files
committed
Add linting results
1 parent d2ddf79 commit 6ca07fd

6 files changed

Lines changed: 33 additions & 19 deletions

File tree

opendrift_leeway_webgui/core/asgi.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,7 @@
99

1010
from django.core.asgi import get_asgi_application
1111

12-
os.environ.setdefault(
13-
"DJANGO_SETTINGS_MODULE", "opendrift_leeway_webgui.core.settings"
14-
)
12+
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "opendrift_leeway_webgui.core.settings")
1513

1614
# Read config from config file
1715
config = configparser.ConfigParser(interpolation=None)

opendrift_leeway_webgui/core/settings.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,7 @@
5252
x.strip() for x in os.environ.get("LEEWAY_ALLOWED_HOSTS", "").split(",") if x
5353
]
5454

55-
CSRF_TRUSTED_ORIGINS = [
56-
f"https://{host}" for host in ALLOWED_HOSTS
57-
]
55+
CSRF_TRUSTED_ORIGINS = [f"https://{host}" for host in ALLOWED_HOSTS]
5856

5957
#: Enabled applications (see :setting:`django:INSTALLED_APPS`)
6058
INSTALLED_APPS = [
@@ -374,5 +372,9 @@
374372
#: (see :setting:`django:EMAIL_USE_SSL`)
375373
EMAIL_USE_SSL = bool(strtobool(os.environ.get("LEEWAY_EMAIL_USE_SSL", "False")))
376374

377-
COPERNICUSMARINE_SERVICE_USERNAME = os.environ.get("LEEWAY_COPERNICUSMARINE_SERVICE_USERNAME")
378-
COPERNICUSMARINE_SERVICE_PASSWORD = os.environ.get("LEEWAY_COPERNICUSMARINE_SERVICE_PASSWORD")
375+
COPERNICUSMARINE_SERVICE_USERNAME = os.environ.get(
376+
"LEEWAY_COPERNICUSMARINE_SERVICE_USERNAME"
377+
)
378+
COPERNICUSMARINE_SERVICE_PASSWORD = os.environ.get(
379+
"LEEWAY_COPERNICUSMARINE_SERVICE_PASSWORD"
380+
)

opendrift_leeway_webgui/leeway/urls.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,9 @@
4949
]
5050

5151
urlpatterns += [
52-
path("simulation-files/<path:path>", SimulationFileView.as_view(), name="simulation_file"),
52+
path(
53+
"simulation-files/<path:path>",
54+
SimulationFileView.as_view(),
55+
name="simulation_file",
56+
)
5357
]

opendrift_leeway_webgui/leeway/views.py

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,12 @@
44
from django.conf import settings
55
from django.contrib import messages
66
from django.contrib.auth.mixins import LoginRequiredMixin
7-
from django.http import FileResponse, Http404, HttpResponseForbidden, HttpResponseRedirect
7+
from django.http import (
8+
FileResponse,
9+
Http404,
10+
HttpResponseForbidden,
11+
HttpResponseRedirect,
12+
)
813
from django.urls import reverse_lazy
914
from django.views.generic import TemplateView
1015
from django.views.generic.base import RedirectView, View
@@ -152,7 +157,12 @@ def get(self, request, path):
152157
raise Http404
153158

154159
if simulation.user != request.user:
155-
return HttpResponseForbidden("You do not have permission to access this file.")
160+
return HttpResponseForbidden(
161+
"You do not have permission to access this file."
162+
)
156163

157164
content_type, _ = mimetypes.guess_type(str(file_path))
158-
return FileResponse(file_path.open("rb"), content_type=content_type or "application/octet-stream")
165+
return FileResponse(
166+
file_path.open("rb"),
167+
content_type=content_type or "application/octet-stream",
168+
)

opendrift_leeway_webgui/simulation.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,17 +16,15 @@
1616

1717
# pylint: disable=import-error
1818
import cartopy.crs as ccrs
19+
# pylint: disable=import-error, disable=no-name-in-module
20+
import copernicusmarine
1921
import matplotlib.pyplot as plt
2022
import numpy as np
21-
2223
# pylint: disable=import-error
2324
from cartopy.mpl import gridliner
2425
from matplotlib import ticker
2526
from matplotlib.collections import LineCollection
2627
from matplotlib.colors import ListedColormap
27-
28-
# pylint: disable=import-error, disable=no-name-in-module
29-
import copernicusmarine
3028
from opendrift.models.leeway import Leeway
3129
from opendrift.readers import reader_global_landmask
3230
from opendrift.readers.reader_netCDF_CF_generic import Reader
@@ -108,7 +106,9 @@ def main():
108106
readers = []
109107
for dataset_id in cmems_dataset_ids:
110108
try:
111-
ds = copernicusmarine.open_dataset(dataset_id=dataset_id, chunk_size_limit=0)
109+
ds = copernicusmarine.open_dataset(
110+
dataset_id=dataset_id, chunk_size_limit=0
111+
)
112112
print(f"Opened {dataset_id}:")
113113
print(ds)
114114
except Exception as exc:
@@ -117,7 +117,7 @@ def main():
117117
readers.append(Reader(ds, name=dataset_id))
118118
simulation.add_reader(readers)
119119
sources = [
120-
"https://pae-paha.pacioos.hawaii.edu/thredds/dodsC/ncep_global/NCEP_Global_Atmospheric_Model_best.ncd",
120+
"https://pae-paha.pacioos.hawaii.edu/thredds/dodsC/ncep_global/NCEP_Global_Atmospheric_Model_best.ncd"
121121
]
122122
simulation.add_readers_from_list(sources, lazy=False)
123123

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env python3
2-
""" Setup.py """
2+
"""Setup.py"""
33
from setuptools import setup
44

55
setup()

0 commit comments

Comments
 (0)