Skip to content

Commit 076b58c

Browse files
committed
Fix build docs
1 parent 8bcd42d commit 076b58c

File tree

2 files changed

+9
-6
lines changed

2 files changed

+9
-6
lines changed

docs/supported-types.rst

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -603,9 +603,9 @@ numbers by creating a ``Encoder`` and specifying ``decimal_format='number'``.
603603
b'1.2345'
604604
605605
You may also optionally specify a target precision for rounding
606-
Decimal values before encoding using the decimal_quantize parameter.
607-
If provided, all decimal.Decimal values will be quantized (rounded)
608-
to the same scale as this value using the Decimal.quantize() method.
606+
Decimal values before encoding using the ``decimal_quantize`` parameter.
607+
If provided, all `decimal.Decimal`` values will be quantized (rounded)
608+
to the same scale as this value using the `Decimal.quantize()` method.
609609
This is useful for ensuring consistent precision of decimal values
610610
during serialization, particularly in financial or monetary contexts.
611611

@@ -618,11 +618,11 @@ during serialization, particularly in financial or monetary contexts.
618618
>>> encoder.encode(decimal.Decimal("1.23456789"))
619619
b'"1.23"'
620620
621-
The optional decimal_rounding parameter allows you to specify
621+
The optional ``decimal_rounding`` parameter allows you to specify
622622
the rounding mode to use when quantizing Decimal values. It accepts
623623
one of the standard rounding mode strings from Python's decimal module,
624-
such as 'ROUND_DOWN' , 'ROUND_HALF_UP' , etc. If not specified,
625-
the default rounding mode is used ('ROUND_HALF_EVEN').
624+
such as ``'ROUND_DOWN'`` , ``'ROUND_HALF_UP'`` , etc. If not specified,
625+
the default rounding mode is used (``'ROUND_HALF_EVEN'``).
626626

627627
.. code-block:: python
628628
@@ -635,6 +635,7 @@ the default rounding mode is used ('ROUND_HALF_EVEN').
635635
b'"1.24"'
636636
637637
.. note::
638+
638639
This parameter has no effect unless ``decimal_quantize`` is also specified.
639640

640641
This setting is not yet supported for YAML or TOML - if this option is

src/msgspec/_core.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12659,6 +12659,7 @@ PyDoc_STRVAR(Encoder__doc__,
1265912659
" - `'sorted'`: Like `'deterministic'`, but *all* object-like types (structs,\n"
1266012660
" dataclasses, ...) are also sorted by field name before encoding. This is\n"
1266112661
" slower than `'deterministic'`, but may produce more human-readable output.\n"
12662+
"\n"
1266212663
"decimal_quantize : decimal.Decimal, optional\n"
1266312664
" An optional Decimal value specifying the quantize target for rounding\n"
1266412665
" Decimal numbers before encoding. If provided, all Decimal values will be\n"
@@ -13891,6 +13892,7 @@ PyDoc_STRVAR(JSONEncoder__doc__,
1389113892
" - `'sorted'`: Like `'deterministic'`, but *all* object-like types (structs,\n"
1389213893
" dataclasses, ...) are also sorted by field name before encoding. This is\n"
1389313894
" slower than `'deterministic'`, but may produce more human-readable output."
13895+
"\n"
1389413896
"decimal_quantize : decimal.Decimal, optional\n"
1389513897
" An optional Decimal value specifying the quantize target for rounding\n"
1389613898
" Decimal numbers before encoding. If provided, all Decimal values will be\n"

0 commit comments

Comments
 (0)