Search Options

Results per page
Sort
Preferred Languages
Advance

Results 1 - 5 of 5 for Datetime (0.04 sec)

  1. tests/test_datetime_custom_encoder.py

    from datetime import datetime, timezone
    
    from fastapi import FastAPI
    from fastapi.testclient import TestClient
    from pydantic import BaseModel
    
    
    def test_pydanticv2():
        from pydantic import field_serializer
    
        class ModelWithDatetimeField(BaseModel):
            dt_field: datetime
    
            @field_serializer("dt_field")
            def serialize_datetime(self, dt_field: datetime):
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 817 bytes
    - Viewed (0)
  2. tests/test_jsonable_encoder.py

    import warnings
    from collections import deque
    from dataclasses import dataclass
    from datetime import datetime, timezone
    from decimal import Decimal
    from enum import Enum
    from math import isinf, isnan
    from pathlib import PurePath, PurePosixPath, PureWindowsPath
    from typing import Optional, TypedDict
    
    import pytest
    from fastapi._compat import Undefined
    from fastapi.encoders import jsonable_encoder
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 9.2K bytes
    - Viewed (0)
  3. fastapi/encoders.py

        else:
            return float(dec_value)
    
    
    ENCODERS_BY_TYPE: dict[type[Any], Callable[[Any], Any]] = {
        bytes: lambda o: o.decode(),
        Color: str,
        datetime.date: isoformat,
        datetime.datetime: isoformat,
        datetime.time: isoformat,
        datetime.timedelta: lambda td: td.total_seconds(),
        Decimal: decimal_encoder,
        Enum: lambda o: o.value,
        frozenset: list,
        deque: list,
        GeneratorType: list,
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 10.7K bytes
    - Viewed (0)
  4. tests/test_tutorial/test_extra_data_types/test_tutorial001.py

                                "start_datetime": {
                                    "title": "Start Datetime",
                                    "type": "string",
                                    "format": "date-time",
                                },
                                "end_datetime": {
                                    "title": "End Datetime",
                                    "type": "string",
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 18:19:10 UTC 2025
    - 6.3K bytes
    - Viewed (0)
  5. pyproject.toml

        # TODO: remove after upgrading SQLAlchemy to a version that includes the following changes
        # https://github.com/sqlalchemy/sqlalchemy/commit/59521abcc0676e936b31a523bd968fc157fef0c2
        'ignore:datetime\.datetime\.utcfromtimestamp\(\) is deprecated and scheduled for removal in a future version\..*:DeprecationWarning:sqlalchemy',
        # Trio 24.1.0 raises a warning from attrs
        # Ref: https://github.com/python-trio/trio/pull/3054
    Registered: Sun Dec 28 07:19:09 UTC 2025
    - Last Modified: Sat Dec 27 12:54:56 UTC 2025
    - 9.3K bytes
    - Viewed (0)
Back to top