mirror of https://github.com/tiangolo/fastapi.git
⬆ [pre-commit.ci] pre-commit autoupdate (#5709)
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Sebastián Ramírez <tiangolo@gmail.com>
This commit is contained in:
parent
253d58bc5c
commit
f04b61bd16
|
|
@ -4,7 +4,7 @@ default_language_version:
|
||||||
python: python3.10
|
python: python3.10
|
||||||
repos:
|
repos:
|
||||||
- repo: https://github.com/pre-commit/pre-commit-hooks
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
rev: v4.3.0
|
rev: v4.4.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: check-added-large-files
|
- id: check-added-large-files
|
||||||
- id: check-toml
|
- id: check-toml
|
||||||
|
|
@ -14,14 +14,14 @@ repos:
|
||||||
- id: end-of-file-fixer
|
- id: end-of-file-fixer
|
||||||
- id: trailing-whitespace
|
- id: trailing-whitespace
|
||||||
- repo: https://github.com/asottile/pyupgrade
|
- repo: https://github.com/asottile/pyupgrade
|
||||||
rev: v3.2.2
|
rev: v3.3.1
|
||||||
hooks:
|
hooks:
|
||||||
- id: pyupgrade
|
- id: pyupgrade
|
||||||
args:
|
args:
|
||||||
- --py3-plus
|
- --py3-plus
|
||||||
- --keep-runtime-typing
|
- --keep-runtime-typing
|
||||||
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
- repo: https://github.com/charliermarsh/ruff-pre-commit
|
||||||
rev: v0.0.138
|
rev: v0.0.254
|
||||||
hooks:
|
hooks:
|
||||||
- id: ruff
|
- id: ruff
|
||||||
args:
|
args:
|
||||||
|
|
@ -38,7 +38,7 @@ repos:
|
||||||
name: isort (pyi)
|
name: isort (pyi)
|
||||||
types: [pyi]
|
types: [pyi]
|
||||||
- repo: https://github.com/psf/black
|
- repo: https://github.com/psf/black
|
||||||
rev: 22.10.0
|
rev: 23.1.0
|
||||||
hooks:
|
hooks:
|
||||||
- id: black
|
- id: black
|
||||||
ci:
|
ci:
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ async def update_item(
|
||||||
item: Item,
|
item: Item,
|
||||||
user: User,
|
user: User,
|
||||||
importance: int = Body(gt=0),
|
importance: int = Body(gt=0),
|
||||||
q: Union[str, None] = None
|
q: Union[str, None] = None,
|
||||||
):
|
):
|
||||||
results = {"item_id": item_id, "item": item, "user": user, "importance": importance}
|
results = {"item_id": item_id, "item": item, "user": user, "importance": importance}
|
||||||
if q:
|
if q:
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ async def update_item(
|
||||||
item: Item,
|
item: Item,
|
||||||
user: User,
|
user: User,
|
||||||
importance: int = Body(gt=0),
|
importance: int = Body(gt=0),
|
||||||
q: str | None = None
|
q: str | None = None,
|
||||||
):
|
):
|
||||||
results = {"item_id": item_id, "item": item, "user": user, "importance": importance}
|
results = {"item_id": item_id, "item": item, "user": user, "importance": importance}
|
||||||
if q:
|
if q:
|
||||||
|
|
|
||||||
|
|
@ -8,7 +8,7 @@ async def read_items(
|
||||||
*,
|
*,
|
||||||
item_id: int = Path(title="The ID of the item to get", ge=0, le=1000),
|
item_id: int = Path(title="The ID of the item to get", ge=0, le=1000),
|
||||||
q: str,
|
q: str,
|
||||||
size: float = Query(gt=0, lt=10.5)
|
size: float = Query(gt=0, lt=10.5),
|
||||||
):
|
):
|
||||||
results = {"item_id": item_id}
|
results = {"item_id": item_id}
|
||||||
if q:
|
if q:
|
||||||
|
|
|
||||||
|
|
@ -696,7 +696,7 @@ async def request_body_to_args(
|
||||||
fn: Callable[[], Coroutine[Any, Any, Any]]
|
fn: Callable[[], Coroutine[Any, Any, Any]]
|
||||||
) -> None:
|
) -> None:
|
||||||
result = await fn()
|
result = await fn()
|
||||||
results.append(result)
|
results.append(result) # noqa: B023
|
||||||
|
|
||||||
async with anyio.create_task_group() as tg:
|
async with anyio.create_task_group() as tg:
|
||||||
for sub_value in value:
|
for sub_value in value:
|
||||||
|
|
|
||||||
|
|
@ -1250,7 +1250,6 @@ class APIRouter(routing.Router):
|
||||||
generate_unique_id
|
generate_unique_id
|
||||||
),
|
),
|
||||||
) -> Callable[[DecoratedCallable], DecoratedCallable]:
|
) -> Callable[[DecoratedCallable], DecoratedCallable]:
|
||||||
|
|
||||||
return self.api_route(
|
return self.api_route(
|
||||||
path=path,
|
path=path,
|
||||||
response_model=response_model,
|
response_model=response_model,
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,7 @@ class APIKeyQuery(APIKeyBase):
|
||||||
name: str,
|
name: str,
|
||||||
scheme_name: Optional[str] = None,
|
scheme_name: Optional[str] = None,
|
||||||
description: Optional[str] = None,
|
description: Optional[str] = None,
|
||||||
auto_error: bool = True
|
auto_error: bool = True,
|
||||||
):
|
):
|
||||||
self.model: APIKey = APIKey(
|
self.model: APIKey = APIKey(
|
||||||
**{"in": APIKeyIn.query}, name=name, description=description
|
**{"in": APIKeyIn.query}, name=name, description=description
|
||||||
|
|
@ -45,7 +45,7 @@ class APIKeyHeader(APIKeyBase):
|
||||||
name: str,
|
name: str,
|
||||||
scheme_name: Optional[str] = None,
|
scheme_name: Optional[str] = None,
|
||||||
description: Optional[str] = None,
|
description: Optional[str] = None,
|
||||||
auto_error: bool = True
|
auto_error: bool = True,
|
||||||
):
|
):
|
||||||
self.model: APIKey = APIKey(
|
self.model: APIKey = APIKey(
|
||||||
**{"in": APIKeyIn.header}, name=name, description=description
|
**{"in": APIKeyIn.header}, name=name, description=description
|
||||||
|
|
@ -72,7 +72,7 @@ class APIKeyCookie(APIKeyBase):
|
||||||
name: str,
|
name: str,
|
||||||
scheme_name: Optional[str] = None,
|
scheme_name: Optional[str] = None,
|
||||||
description: Optional[str] = None,
|
description: Optional[str] = None,
|
||||||
auto_error: bool = True
|
auto_error: bool = True,
|
||||||
):
|
):
|
||||||
self.model: APIKey = APIKey(
|
self.model: APIKey = APIKey(
|
||||||
**{"in": APIKeyIn.cookie}, name=name, description=description
|
**{"in": APIKeyIn.cookie}, name=name, description=description
|
||||||
|
|
|
||||||
|
|
@ -119,7 +119,7 @@ class OAuth2(SecurityBase):
|
||||||
flows: Union[OAuthFlowsModel, Dict[str, Dict[str, Any]]] = OAuthFlowsModel(),
|
flows: Union[OAuthFlowsModel, Dict[str, Dict[str, Any]]] = OAuthFlowsModel(),
|
||||||
scheme_name: Optional[str] = None,
|
scheme_name: Optional[str] = None,
|
||||||
description: Optional[str] = None,
|
description: Optional[str] = None,
|
||||||
auto_error: bool = True
|
auto_error: bool = True,
|
||||||
):
|
):
|
||||||
self.model = OAuth2Model(flows=flows, description=description)
|
self.model = OAuth2Model(flows=flows, description=description)
|
||||||
self.scheme_name = scheme_name or self.__class__.__name__
|
self.scheme_name = scheme_name or self.__class__.__name__
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class OpenIdConnect(SecurityBase):
|
||||||
openIdConnectUrl: str,
|
openIdConnectUrl: str,
|
||||||
scheme_name: Optional[str] = None,
|
scheme_name: Optional[str] = None,
|
||||||
description: Optional[str] = None,
|
description: Optional[str] = None,
|
||||||
auto_error: bool = True
|
auto_error: bool = True,
|
||||||
):
|
):
|
||||||
self.model = OpenIdConnectModel(
|
self.model = OpenIdConnectModel(
|
||||||
openIdConnectUrl=openIdConnectUrl, description=description
|
openIdConnectUrl=openIdConnectUrl, description=description
|
||||||
|
|
|
||||||
|
|
@ -150,7 +150,6 @@ def get_app():
|
||||||
|
|
||||||
@pytest.fixture(name="client")
|
@pytest.fixture(name="client")
|
||||||
def get_client(app: FastAPI):
|
def get_client(app: FastAPI):
|
||||||
|
|
||||||
client = TestClient(app)
|
client = TestClient(app)
|
||||||
return client
|
return client
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -152,7 +152,6 @@ def get_app():
|
||||||
|
|
||||||
@pytest.fixture(name="client")
|
@pytest.fixture(name="client")
|
||||||
def get_client(app: FastAPI):
|
def get_client(app: FastAPI):
|
||||||
|
|
||||||
client = TestClient(app)
|
client = TestClient(app)
|
||||||
return client
|
return client
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue