From 45bca018b559404334a6e8a4fbbfedd14d42147f Mon Sep 17 00:00:00 2001 From: Aleksandr Meshchriakov Date: Mon, 23 Mar 2026 13:27:58 +0100 Subject: [PATCH] fix pre-commit --- .gitignore | 1 + src/apps/exchange/serializers.py | 10 ++++------ src/apps/parsers/views.py | 5 ++++- src/apps/user/views.py | 8 ++++---- tests/apps/exchange/test_serializers.py | 8 ++++++-- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/.gitignore b/.gitignore index 7ff4075..b70dc6d 100644 --- a/.gitignore +++ b/.gitignore @@ -45,3 +45,4 @@ data/ .env.prod tmp/ _tmp/ +input/fns/processed/*.xlsx diff --git a/src/apps/exchange/serializers.py b/src/apps/exchange/serializers.py index c50bf09..02001c6 100644 --- a/src/apps/exchange/serializers.py +++ b/src/apps/exchange/serializers.py @@ -164,7 +164,9 @@ class ExchangePeriodicTaskSerializer(serializers.ModelSerializer): return int(value) if str(value).isdigit() else None def get_crontab_minute(self, obj: PeriodicTask) -> int | None: - return self._coerce_crontab_number(obj.crontab.minute) if obj.crontab_id else None + return ( + self._coerce_crontab_number(obj.crontab.minute) if obj.crontab_id else None + ) def get_crontab_hour(self, obj: PeriodicTask) -> int | None: return self._coerce_crontab_number(obj.crontab.hour) if obj.crontab_id else None @@ -216,11 +218,7 @@ class ExchangePeriodicTaskUpsertSerializer(serializers.Serializer): schedule_type = str(attrs["schedule_type"]).strip().lower() if schedule_type not in {"interval", "daily"}: raise serializers.ValidationError( - { - "schedule_type": ( - "Допустимые значения: interval или daily." - ) - } + {"schedule_type": ("Допустимые значения: interval или daily.")} ) return schedule_type diff --git a/src/apps/parsers/views.py b/src/apps/parsers/views.py index 28134b8..9b65da6 100644 --- a/src/apps/parsers/views.py +++ b/src/apps/parsers/views.py @@ -901,7 +901,10 @@ class SourceCardRefreshView(APIView): ) output = SourceCardRefreshResponseSerializer(payload).data tasks = output.get("tasks", []) - response_payload = {"task_id": tasks[0]["task_id"] if tasks else None, "status": "accepted"} + response_payload = { + "task_id": tasks[0]["task_id"] if tasks else None, + "status": "accepted", + } return Response( response_payload, status=status.HTTP_202_ACCEPTED, diff --git a/src/apps/user/views.py b/src/apps/user/views.py index 00faf10..2db2ce0 100644 --- a/src/apps/user/views.py +++ b/src/apps/user/views.py @@ -115,7 +115,9 @@ ADMIN_USER_LIST_RESPONSE = openapi.Response( type=openapi.TYPE_OBJECT, properties={ "count": openapi.Schema(type=openapi.TYPE_INTEGER), - "next": openapi.Schema(type=openapi.TYPE_STRING, format="uri", nullable=True), + "next": openapi.Schema( + type=openapi.TYPE_STRING, format="uri", nullable=True + ), "previous": openapi.Schema( type=openapi.TYPE_STRING, format="uri", nullable=True ), @@ -372,9 +374,7 @@ class AdminUserListCreateView(APIView): ordering=request.query_params.get("ordering", ""), ) paginated = _paginate_user_queryset(request, queryset) - serializer = FrontendUserWithProfileSerializer( - paginated["results"], many=True - ) + serializer = FrontendUserWithProfileSerializer(paginated["results"], many=True) return Response( { "count": paginated["count"], diff --git a/tests/apps/exchange/test_serializers.py b/tests/apps/exchange/test_serializers.py index 5a75049..c0a62c8 100644 --- a/tests/apps/exchange/test_serializers.py +++ b/tests/apps/exchange/test_serializers.py @@ -36,14 +36,18 @@ class ExchangeCopyRequestSerializerTest(SimpleTestCase): class ExchangePeriodicTaskUpsertSerializerTest(SimpleTestCase): def test_interval_schedule_requires_fields(self): - serializer = ExchangePeriodicTaskUpsertSerializer(data={"schedule_type": "interval"}) + serializer = ExchangePeriodicTaskUpsertSerializer( + data={"schedule_type": "interval"} + ) self.assertFalse(serializer.is_valid()) self.assertIn("interval_every", serializer.errors) self.assertIn("interval_period", serializer.errors) def test_daily_schedule_requires_fields(self): - serializer = ExchangePeriodicTaskUpsertSerializer(data={"schedule_type": "daily"}) + serializer = ExchangePeriodicTaskUpsertSerializer( + data={"schedule_type": "daily"} + ) self.assertFalse(serializer.is_valid()) self.assertIn("crontab_minute", serializer.errors)