Beispiel #1
0
    def validate(cls, v: Any) -> decimal.Decimal:
        if isinstance(v, decimal.Decimal):
            return v
        elif isinstance(v, bson.decimal128.Decimal128):
            return cast(decimal.Decimal, v.to_decimal())

        a = decimal_validator(v)
        return a
Beispiel #2
0
 def validate(cls, v: Any) -> bson.decimal128.Decimal128:
     if isinstance(v, bson.decimal128.Decimal128):
         return v
     a = decimal_validator(v)
     return bson.decimal128.Decimal128(a)