- Sort Score
- Result 10 results
- Languages All
Results 1 - 3 of 3 for custom_encoder (0.17 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 Oct 27 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 Oct 27 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 Oct 27 07:19:11 UTC 2024 - Last Modified: Sat Oct 26 16:51:17 UTC 2024 - 449.4K bytes - Viewed (0)