From 52649a0beb4d1c1533c33eb238fb3eb08a56aa57 Mon Sep 17 00:00:00 2001 From: Bartosz Karwacki Date: Sun, 23 Jan 2022 19:07:02 +0100 Subject: [PATCH] Lint --- backend/backend/urls.py | 2 +- backend/cars/admin.py | 1 + backend/cars/fuzzy_logic.py | 4 ++-- backend/cars/serializers.py | 1 + backend/cars/urls.py | 3 ++- backend/cars/views.py | 24 +++++++++++++----------- 6 files changed, 20 insertions(+), 15 deletions(-) diff --git a/backend/backend/urls.py b/backend/backend/urls.py index 3175ef0..b14be72 100644 --- a/backend/backend/urls.py +++ b/backend/backend/urls.py @@ -14,6 +14,6 @@ Including another URLconf 2. Add a URL to urlpatterns: path('blog/', include('blog.urls')) """ from django.contrib import admin -from django.urls import path, include +from django.urls import include, path urlpatterns = [path("admin/", admin.site.urls), path("", include("cars.urls"))] diff --git a/backend/cars/admin.py b/backend/cars/admin.py index 208e0de..0d220fa 100644 --- a/backend/cars/admin.py +++ b/backend/cars/admin.py @@ -1,4 +1,5 @@ from django.contrib import admin + from .models import Car admin.site.register(Car) diff --git a/backend/cars/fuzzy_logic.py b/backend/cars/fuzzy_logic.py index 4f089d0..5b7c6ad 100644 --- a/backend/cars/fuzzy_logic.py +++ b/backend/cars/fuzzy_logic.py @@ -1,7 +1,7 @@ import numpy as np import skfuzzy as fuzz -from skfuzzy import control as ctrl from django.conf import settings +from skfuzzy import control as ctrl def get_fuzzy_response(request_params, objects_list): @@ -79,5 +79,5 @@ def get_fuzzy_response(request_params, objects_list): ) if comparator and min(comparator) > settings.COMPARATOR: end_object_list.append(car) - + return end_object_list diff --git a/backend/cars/serializers.py b/backend/cars/serializers.py index b22d4e7..cbea55a 100644 --- a/backend/cars/serializers.py +++ b/backend/cars/serializers.py @@ -1,4 +1,5 @@ from rest_framework import serializers + from .models import Car diff --git a/backend/cars/urls.py b/backend/cars/urls.py index 3269575..8c7c579 100644 --- a/backend/cars/urls.py +++ b/backend/cars/urls.py @@ -1,4 +1,5 @@ -from django.urls import path, include +from django.urls import include, path + from .views import CarList, SettingsAPIView # The API URLs are now determined automatically by the router. diff --git a/backend/cars/views.py b/backend/cars/views.py index d84c540..88dc8c8 100644 --- a/backend/cars/views.py +++ b/backend/cars/views.py @@ -1,7 +1,8 @@ -from rest_framework import generics -from rest_framework.views import APIView -from rest_framework.response import Response from django.conf import settings +from rest_framework import generics +from rest_framework.response import Response +from rest_framework.views import APIView + from .fuzzy_logic import get_fuzzy_response from .models import Car from .serializers import CarSerializer @@ -25,11 +26,12 @@ class SettingsAPIView(APIView): return Response("Settings changed") def get(self, request, *args, **kwargs): - return Response({ - 'production_year':settings.PRODUCTION_YEAR, - 'mileage':settings.MILEAGE, - 'engine_capacity':settings.ENGINE_CAPACITY, - 'combustion':settings.COMBUSTION, - 'comparator':settings.COMPARATOR, - - }) \ No newline at end of file + return Response( + { + "production_year": settings.PRODUCTION_YEAR, + "mileage": settings.MILEAGE, + "engine_capacity": settings.ENGINE_CAPACITY, + "combustion": settings.COMBUSTION, + "comparator": settings.COMPARATOR, + } + )