☰
Debian Codegraph
@
2.2.0-1
2.1.0-1
/
/
beanie
/
odm
/
custom_types
/
decimal.py
☽
☼
beanie/odm/custom_types/decimal.py
code
plain
raw
Apache-2.0
2022-2026 Roman Right <
[email protected]
>
debian/copyright
1
import decimal
2
from typing import Annotated
3
4
import bson
5
import pydantic
6
7
DecimalAnnotation = Annotated[
8
decimal.Decimal,
9
pydantic.BeforeValidator(
10
lambda v: v.to_decimal() if isinstance(v, bson.Decimal128) else v
11
),
12
]