pre-commit-ci-lite[bot]
4 months ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with
4 additions and
7 deletions
-
fastapi/encoders.py
-
tests/test_jsonable_encoder.py
|
|
|
@ -1,7 +1,7 @@ |
|
|
|
import dataclasses |
|
|
|
import datetime |
|
|
|
from collections import defaultdict, deque |
|
|
|
from collections.abc import Mapping, Sequence |
|
|
|
from collections.abc import Callable, Mapping, Sequence |
|
|
|
from decimal import Decimal |
|
|
|
from enum import Enum |
|
|
|
from ipaddress import ( |
|
|
|
@ -18,9 +18,6 @@ from types import GeneratorType |
|
|
|
from typing import ( |
|
|
|
Annotated, |
|
|
|
Any, |
|
|
|
Callable, |
|
|
|
Optional, |
|
|
|
Union, |
|
|
|
) |
|
|
|
from uuid import UUID |
|
|
|
|
|
|
|
|
|
|
|
@ -7,7 +7,7 @@ from decimal import Decimal |
|
|
|
from enum import Enum |
|
|
|
from math import isinf, isnan |
|
|
|
from pathlib import PurePath, PurePosixPath, PureWindowsPath |
|
|
|
from typing import NamedTuple, Optional, TypedDict, Union |
|
|
|
from typing import NamedTuple, TypedDict |
|
|
|
|
|
|
|
import pytest |
|
|
|
from fastapi._compat import Undefined |
|
|
|
@ -58,7 +58,7 @@ class RoleEnum(Enum): |
|
|
|
|
|
|
|
|
|
|
|
class ModelWithConfig(BaseModel): |
|
|
|
role: Optional[RoleEnum] = None |
|
|
|
role: RoleEnum | None = None |
|
|
|
|
|
|
|
model_config = {"use_enum_values": True} |
|
|
|
|
|
|
|
@ -319,7 +319,7 @@ def test_encode_sequence(): |
|
|
|
def __init__(self, items: list[str]): |
|
|
|
self._items = items |
|
|
|
|
|
|
|
def __getitem__(self, index: Union[int, slice]) -> Union[str, Sequence[str]]: |
|
|
|
def __getitem__(self, index: int | slice) -> str | Sequence[str]: |
|
|
|
return self._items[index] |
|
|
|
|
|
|
|
def __len__(self) -> int: |
|
|
|
|