Browse Source

run scripts/format.sh

pull/12066/head
Noah Klein 7 months ago
parent
commit
4cdc84db26
  1. 8
      fastapi/routing.py

8
fastapi/routing.py

@ -1,6 +1,7 @@
import asyncio import asyncio
import dataclasses import dataclasses
import email.message import email.message
import functools
import inspect import inspect
import json import json
from contextlib import AsyncExitStack, asynccontextmanager from contextlib import AsyncExitStack, asynccontextmanager
@ -20,10 +21,9 @@ from typing import (
Type, Type,
Union, Union,
) )
import anyio import anyio
from anyio import CapacityLimiter from anyio import CapacityLimiter
import functools
from fastapi import params from fastapi import params
from fastapi._compat import ( from fastapi._compat import (
ModelField, ModelField,
@ -169,7 +169,9 @@ async def serialize_response(
# Run without a capacity limit for similar reasons as marked in fastapi/concurrency.py # Run without a capacity limit for similar reasons as marked in fastapi/concurrency.py
exit_limiter = CapacityLimiter(1) exit_limiter = CapacityLimiter(1)
validate_func = functools.partial(field.validate, loc=("response",)) validate_func = functools.partial(field.validate, loc=("response",))
value, errors_ = await anyio.to_thread.run_sync(validate_func, response_content, {}, limiter=exit_limiter) value, errors_ = await anyio.to_thread.run_sync(
validate_func, response_content, {}, limiter=exit_limiter
)
if isinstance(errors_, list): if isinstance(errors_, list):
errors.extend(errors_) errors.extend(errors_)
elif errors_: elif errors_:

Loading…
Cancel
Save