mirror of https://github.com/tiangolo/fastapi.git
Refactor code style and improve readability in utils and test files
- Removed unnecessary blank lines and improved formatting for better readability in `fastapi/utils.py`. - Consolidated return statements in test cases to a single line for consistency in `tests/test_ast_inference.py`. - Enhanced the structure of dictionary returns in endpoint functions for clarity.
This commit is contained in:
parent
6201559a1c
commit
0ecef0ce71
|
|
@ -545,15 +545,16 @@ class APIRoute(routing.Route):
|
|||
response_model = None
|
||||
else:
|
||||
response_model = return_annotation
|
||||
|
||||
if (
|
||||
response_model is not None
|
||||
and not lenient_issubclass(response_model, BaseModel)
|
||||
and not dataclasses.is_dataclass(response_model)
|
||||
):
|
||||
inferred = infer_response_model_from_ast(endpoint)
|
||||
if inferred:
|
||||
response_model = inferred
|
||||
if (
|
||||
response_model is None
|
||||
or (
|
||||
not lenient_issubclass(response_model, BaseModel)
|
||||
and not dataclasses.is_dataclass(response_model)
|
||||
)
|
||||
):
|
||||
inferred = infer_response_model_from_ast(endpoint)
|
||||
if inferred:
|
||||
response_model = inferred
|
||||
|
||||
self.response_model = response_model
|
||||
self.summary = summary
|
||||
|
|
|
|||
Loading…
Reference in New Issue