Skip to content

Commit

Permalink
ruff 0.1.7
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalik committed Dec 7, 2023
1 parent 91bd780 commit f4b48d7
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 30 deletions.
42 changes: 19 additions & 23 deletions ninja/openapi/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,23 +36,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 @@ -237,12 +235,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
3 changes: 3 additions & 0 deletions ninja/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ def _convert_result(self, result: Any) -> Any:

return result

def __repr__(self) -> str:
return f"<DjangoGetter: {repr(self._obj)}>"


class Resolver:
__slots__ = ("_func", "_static", "_takes_context")
Expand Down
10 changes: 4 additions & 6 deletions ninja/testing/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,10 @@ def _build_request(
request.META = request_params.pop("META", {})
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
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ test = [
"pytest-asyncio",
"psycopg2-binary",
"mypy==1.7.1",
"ruff==0.1.6",
"ruff==0.1.7",
"django-stubs",
]
doc = ["mkdocs", "mkdocs-material", "markdown-include", "mkdocstrings"]
Expand Down

0 comments on commit f4b48d7

Please sign in to comment.