- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for custom_encoder (0.14 sec)
-
fastapi/encoders.py
[FastAPI docs for JSON Compatible Encoder](https://fastapi.tiangolo.com/tutorial/encoder/). """ custom_encoder = custom_encoder or {} if custom_encoder: if type(obj) in custom_encoder: return custom_encoder[type(obj)](obj) else: for encoder_type, encoder_instance in custom_encoder.items(): if isinstance(obj, encoder_type): return encoder_instance(obj)
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 21:56:59 UTC 2024 - 10.8K bytes - Viewed (0) -
tests/test_jsonable_encoder.py
pass class MyModel(BaseModel): dt_field: safe_datetime instance = MyModel(dt_field=safe_datetime.now()) encoded_instance = jsonable_encoder( instance, custom_encoder={safe_datetime: lambda o: o.isoformat()} ) assert encoded_instance["dt_field"] == instance.dt_field.isoformat() def test_custom_enum_encoders(): def custom_enum_encoder(v: Enum):
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Thu Apr 18 21:56:59 UTC 2024 - 9K bytes - Viewed (0) -
docs/en/docs/release-notes.md
Registered: Sun Nov 03 07:19:11 UTC 2024 - Last Modified: Fri Nov 01 11:25:57 UTC 2024 - 460.3K bytes - Viewed (0)