From f5ced873ac659b1992bf0f3f9bd2e3b3b0b95099 Mon Sep 17 00:00:00 2001 From: Tom Hacohen Date: Wed, 23 Sep 2020 16:27:20 +0300 Subject: [PATCH] Lint: fix lint errors. --- django_etebase/serializers.py | 6 ++++-- django_etebase/views.py | 7 +++---- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/django_etebase/serializers.py b/django_etebase/serializers.py index d371f13..4518f58 100644 --- a/django_etebase/serializers.py +++ b/django_etebase/serializers.py @@ -220,7 +220,8 @@ class CollectionItemSerializer(BetterErrorsMixin, serializers.ModelSerializer): cur_etag = instance.etag if not created else None if validate_etag and cur_etag != etag: - raise EtebaseValidationError('wrong_etag', 'Wrong etag. Expected {} got {}'.format(cur_etag, etag), status_code=status.HTTP_409_CONFLICT) + raise EtebaseValidationError('wrong_etag', 'Wrong etag. Expected {} got {}'.format(cur_etag, etag), + status_code=status.HTTP_409_CONFLICT) if not created: # We don't have to use select_for_update here because the unique constraint on current guards against @@ -249,7 +250,8 @@ class CollectionItemDepSerializer(BetterErrorsMixin, serializers.ModelSerializer item = self.__class__.Meta.model.objects.get(uid=data['uid']) etag = data['etag'] if item.etag != etag: - raise EtebaseValidationError('wrong_etag', 'Wrong etag. Expected {} got {}'.format(item.etag, etag), status_code=status.HTTP_409_CONFLICT) + raise EtebaseValidationError('wrong_etag', 'Wrong etag. Expected {} got {}'.format(item.etag, etag), + status_code=status.HTTP_409_CONFLICT) return data diff --git a/django_etebase/views.py b/django_etebase/views.py index 0ba3b44..ec3b373 100644 --- a/django_etebase/views.py +++ b/django_etebase/views.py @@ -13,13 +13,12 @@ # along with this program. If not, see . import msgpack -from functools import reduce from django.conf import settings from django.contrib.auth import get_user_model, user_logged_in, user_logged_out from django.core.exceptions import PermissionDenied from django.db import transaction, IntegrityError -from django.db.models import Max, Q, F, Value as V +from django.db.models import Max, Value as V from django.db.models.functions import Coalesce, Greatest from django.http import HttpResponseBadRequest, HttpResponse, Http404 from django.shortcuts import get_object_or_404 @@ -663,7 +662,6 @@ class AuthenticationViewSet(viewsets.ViewSet): except User.DoesNotExist: raise AuthenticationFailed({'code': 'user_not_found', 'detail': 'User not found'}) - def validate_login_request(self, request, validated_data, response_raw, signature, expected_action): from datetime import datetime @@ -698,7 +696,8 @@ class AuthenticationViewSet(viewsets.ViewSet): try: verify_key.verify(response_raw, signature) except nacl.exceptions.BadSignatureError: - return Response({'code': 'login_bad_signature', 'detail': 'Wrong password for user.'}, status=status.HTTP_401_UNAUTHORIZED) + return Response({'code': 'login_bad_signature', 'detail': 'Wrong password for user.'}, + status=status.HTTP_401_UNAUTHORIZED) return None