[3.13] gh-101100: Fix Sphinx warnings in library/decimal.rst (GH-134303) (#134339)

Co-authored-by: Yuki Kobayashi <drsuaimqjgar@gmail.com>
This commit is contained in:
Hugo van Kemenade 2025-05-20 17:55:23 +03:00 committed by GitHub
parent eca8ff1ae2
commit 61af847d41
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 42 additions and 32 deletions

View file

@ -300,7 +300,6 @@ nitpick_ignore += [
('py:attr', '__annotations__'), ('py:attr', '__annotations__'),
('py:meth', '__missing__'), ('py:meth', '__missing__'),
('py:attr', '__wrapped__'), ('py:attr', '__wrapped__'),
('py:attr', 'decimal.Context.clamp'),
('py:meth', 'index'), # list.index, tuple.index, etc. ('py:meth', 'index'), # list.index, tuple.index, etc.
] ]

View file

@ -121,7 +121,7 @@ reset them before monitoring a calculation.
.. _decimal-tutorial: .. _decimal-tutorial:
Quick-start Tutorial Quick-start tutorial
-------------------- --------------------
The usual start to using decimals is importing the module, viewing the current The usual start to using decimals is importing the module, viewing the current
@ -1071,28 +1071,40 @@ In addition to the three supplied contexts, new contexts can be created with the
default values are copied from the :const:`DefaultContext`. If the *flags* default values are copied from the :const:`DefaultContext`. If the *flags*
field is not specified or is :const:`None`, all flags are cleared. field is not specified or is :const:`None`, all flags are cleared.
*prec* is an integer in the range [``1``, :const:`MAX_PREC`] that sets .. attribute:: prec
An integer in the range [``1``, :const:`MAX_PREC`] that sets
the precision for arithmetic operations in the context. the precision for arithmetic operations in the context.
The *rounding* option is one of the constants listed in the section .. attribute:: rounding
`Rounding Modes`_.
The *traps* and *flags* fields list any signals to be set. Generally, new One of the constants listed in the section `Rounding Modes`_.
contexts should only set traps and leave the flags clear.
The *Emin* and *Emax* fields are integers specifying the outer limits allowable .. attribute:: traps
for exponents. *Emin* must be in the range [:const:`MIN_EMIN`, ``0``], flags
*Emax* in the range [``0``, :const:`MAX_EMAX`].
The *capitals* field is either ``0`` or ``1`` (the default). If set to Lists of any signals to be set. Generally, new contexts should only set
traps and leave the flags clear.
.. attribute:: Emin
Emax
Integers specifying the outer limits allowable for exponents. *Emin* must
be in the range [:const:`MIN_EMIN`, ``0``], *Emax* in the range
[``0``, :const:`MAX_EMAX`].
.. attribute:: capitals
Either ``0`` or ``1`` (the default). If set to
``1``, exponents are printed with a capital ``E``; otherwise, a ``1``, exponents are printed with a capital ``E``; otherwise, a
lowercase ``e`` is used: ``Decimal('6.02e+23')``. lowercase ``e`` is used: ``Decimal('6.02e+23')``.
The *clamp* field is either ``0`` (the default) or ``1``. .. attribute:: clamp
If set to ``1``, the exponent ``e`` of a :class:`Decimal`
instance representable in this context is strictly limited to the Either ``0`` (the default) or ``1``. If set to ``1``, the exponent ``e``
range ``Emin - prec + 1 <= e <= Emax - prec + 1``. If *clamp* is of a :class:`Decimal` instance representable in this context is strictly
``0`` then a weaker condition holds: the adjusted exponent of limited to the range ``Emin - prec + 1 <= e <= Emax - prec + 1``.
If *clamp* is ``0`` then a weaker condition holds: the adjusted exponent of
the :class:`Decimal` instance is at most :attr:`~Context.Emax`. When *clamp* is the :class:`Decimal` instance is at most :attr:`~Context.Emax`. When *clamp* is
``1``, a large normal number will, where possible, have its ``1``, a large normal number will, where possible, have its
exponent reduced and a corresponding number of zeros added to its exponent reduced and a corresponding number of zeros added to its
@ -1743,7 +1755,7 @@ The following table summarizes the hierarchy of signals::
.. _decimal-notes: .. _decimal-notes:
Floating-Point Notes Floating-point notes
-------------------- --------------------

View file

@ -15,7 +15,6 @@ Doc/extending/extending.rst
Doc/library/ast.rst Doc/library/ast.rst
Doc/library/asyncio-extending.rst Doc/library/asyncio-extending.rst
Doc/library/asyncio-policy.rst Doc/library/asyncio-policy.rst
Doc/library/decimal.rst
Doc/library/email.charset.rst Doc/library/email.charset.rst
Doc/library/email.compat32-message.rst Doc/library/email.compat32-message.rst
Doc/library/email.parser.rst Doc/library/email.parser.rst