From 113ee78b55369852b4d1d393d6caf9d4c7b31c88 Mon Sep 17 00:00:00 2001 From: c4ffein Date: Wed, 21 Aug 2024 22:31:05 +0200 Subject: [PATCH 1/3] Just ran ruff format --preview ninja tests --- ninja/openapi/schema.py | 42 +++++++++++++++++++---------------------- ninja/testing/client.py | 10 ++++------ 2 files changed, 23 insertions(+), 29 deletions(-) diff --git a/ninja/openapi/schema.py b/ninja/openapi/schema.py index 494e4e1d..584b52cf 100644 --- a/ninja/openapi/schema.py +++ b/ninja/openapi/schema.py @@ -40,23 +40,21 @@ def __init__(self, api: "NinjaAPI", path_prefix: str) -> None: self.securitySchemes: DictStrAny = {} self.all_operation_ids: Set = set() extra_info = api.openapi_extra.get("info", {}) - super().__init__( - [ - ("openapi", "3.1.0"), - ( - "info", - { - "title": api.title, - "version": api.version, - "description": api.description, - **extra_info, - }, - ), - ("paths", self.get_paths()), - ("components", self.get_components()), - ("servers", api.servers), - ] - ) + super().__init__([ + ("openapi", "3.1.0"), + ( + "info", + { + "title": api.title, + "version": api.version, + "description": api.description, + **extra_info, + }, + ), + ("paths", self.get_paths()), + ("components", self.get_components()), + ("servers", api.servers), + ]) for k, v in api.openapi_extra.items(): if k not in self: self[k] = v @@ -242,12 +240,10 @@ def _create_multipart_schema_from_models( content_type = BODY_CONTENT_TYPES["file"] # get the various schemas - result = merge_schemas( - [ - self._create_schema_from_model(model, remove_level=False)[0] - for model in models - ] - ) + result = merge_schemas([ + self._create_schema_from_model(model, remove_level=False)[0] + for model in models + ]) result["title"] = "MultiPartBodyParams" return result, content_type diff --git a/ninja/testing/client.py b/ninja/testing/client.py index 8a3cbcd7..b95a65df 100644 --- a/ninja/testing/client.py +++ b/ninja/testing/client.py @@ -138,12 +138,10 @@ def _build_request( request.META = request_params.pop("META", {"REMOTE_ADDR": "127.0.0.1"}) request.FILES = request_params.pop("FILES", {}) - request.META.update( - { - f"HTTP_{k.replace('-', '_')}": v - for k, v in request_params.pop("headers", {}).items() - } - ) + request.META.update({ + f"HTTP_{k.replace('-', '_')}": v + for k, v in request_params.pop("headers", {}).items() + }) request.headers = HttpHeaders(request.META) From f46aae2fe54b9c06160a91ab75981e5720988a0e Mon Sep 17 00:00:00 2001 From: c4ffein Date: Wed, 21 Aug 2024 22:39:58 +0200 Subject: [PATCH 2/3] removed non-existing export --- ninja/params/__init__.py | 1 - 1 file changed, 1 deletion(-) diff --git a/ninja/params/__init__.py b/ninja/params/__init__.py index fd553e5b..4c87760c 100644 --- a/ninja/params/__init__.py +++ b/ninja/params/__init__.py @@ -19,7 +19,6 @@ "HeaderEx", "PathEx", "QueryEx", - "Router", "P", ] From f397e834330c2380a69ed0ada5e7332462d45ecd Mon Sep 17 00:00:00 2001 From: c4ffein Date: Wed, 21 Aug 2024 22:50:08 +0200 Subject: [PATCH 3/3] made github use ruff preview --- .github/workflows/test_full.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test_full.yml b/.github/workflows/test_full.yml index e177c7a7..446b443e 100644 --- a/.github/workflows/test_full.yml +++ b/.github/workflows/test_full.yml @@ -67,8 +67,8 @@ jobs: - name: Install Dependencies run: flit install --symlink - name: Ruff format - run: ruff format --check ninja tests + run: ruff format --preview --check ninja tests - name: Ruff lint - run: ruff check ninja tests + run: ruff check --preview ninja tests - name: mypy run: mypy ninja tests/mypy_test.py