Browse Source

🎨 [pre-commit.ci] Auto format from pre-commit.com hooks

pull/14168/head
pre-commit-ci[bot] 10 months ago
parent
commit
1a9e9a18ac
  1. 1
      fastapi/_compat/v2.py
  2. 1
      fastapi/datastructures.py
  3. 2
      fastapi/encoders.py
  4. 1
      tests/test_pydantic_v1_v2_multifile/main.py

1
fastapi/_compat/v2.py

@ -372,6 +372,7 @@ def get_model_fields(model: Type[BaseModel]) -> List[ModelField]:
for name, field_info in model.model_fields.items() for name, field_info in model.model_fields.items()
] ]
# Duplicate of several schema functions from Pydantic v1 to make them compatible with # Duplicate of several schema functions from Pydantic v1 to make them compatible with
# Pydantic v2 and allow mixing the models # Pydantic v2 and allow mixing the models

1
fastapi/datastructures.py

@ -11,7 +11,6 @@ from typing import (
) )
from fastapi._compat import ( from fastapi._compat import (
PYDANTIC_V2,
CoreSchema, CoreSchema,
GetJsonSchemaHandler, GetJsonSchemaHandler,
JsonSchemaValue, JsonSchemaValue,

2
fastapi/encoders.py

@ -25,7 +25,7 @@ from pydantic.networks import AnyUrl, NameEmail
from pydantic.types import SecretBytes, SecretStr from pydantic.types import SecretBytes, SecretStr
from typing_extensions import Annotated, Doc from typing_extensions import Annotated, Doc
from ._compat import PYDANTIC_V2, Url, _is_undefined, _model_dump from ._compat import Url, _is_undefined, _model_dump
# Taken from Pydantic v1 as is # Taken from Pydantic v1 as is

1
tests/test_pydantic_v1_v2_multifile/main.py

@ -113,4 +113,3 @@ def handle_v2_list_to_v1_item(data: List[modelsv2.Item]) -> modelsv1.Item:
multi=[modelsv1.SubItem(name=s.new_sub_name) for s in item.new_multi], multi=[modelsv1.SubItem(name=s.new_sub_name) for s in item.new_multi],
) )
return modelsv1.Item(title="", size=0, sub=modelsv1.SubItem(name="")) return modelsv1.Item(title="", size=0, sub=modelsv1.SubItem(name=""))

Loading…
Cancel
Save