Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update code with make fmt and the pipeline to use the same --preview option of Ruff #1274

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/test_full.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
42 changes: 19 additions & 23 deletions ninja/openapi/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
1 change: 0 additions & 1 deletion ninja/params/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"HeaderEx",
"PathEx",
"QueryEx",
"Router",
"P",
]

Expand Down
10 changes: 4 additions & 6 deletions ninja/testing/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
Loading