Skip to content

Commit 61af847

Browse files
hugovkkoyuki7w
andauthored
[3.13] gh-101100: Fix Sphinx warnings in library/decimal.rst (GH-134303) (#134339)
Co-authored-by: Yuki Kobayashi <[email protected]>
1 parent eca8ff1 commit 61af847

File tree

3 files changed

+42
-32
lines changed

3 files changed

+42
-32
lines changed

Doc/conf.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,6 @@
300300
('py:attr', '__annotations__'),
301301
('py:meth', '__missing__'),
302302
('py:attr', '__wrapped__'),
303-
('py:attr', 'decimal.Context.clamp'),
304303
('py:meth', 'index'), # list.index, tuple.index, etc.
305304
]
306305

Doc/library/decimal.rst

Lines changed: 42 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
=====================================================================
33

44
.. module:: decimal
5-
:synopsis: Implementation of the General Decimal Arithmetic Specification.
5+
:synopsis: Implementation of the General Decimal Arithmetic Specification.
66

77
.. moduleauthor:: Eric Price <eprice at tjhsst.edu>
88
.. moduleauthor:: Facundo Batista <facundo at taniquetil.com.ar>
@@ -121,7 +121,7 @@ reset them before monitoring a calculation.
121121
122122
.. _decimal-tutorial:
123123

124-
Quick-start Tutorial
124+
Quick-start tutorial
125125
--------------------
126126

127127
The usual start to using decimals is importing the module, viewing the current
@@ -1071,40 +1071,52 @@ In addition to the three supplied contexts, new contexts can be created with the
10711071
default values are copied from the :const:`DefaultContext`. If the *flags*
10721072
field is not specified or is :const:`None`, all flags are cleared.
10731073

1074-
*prec* is an integer in the range [``1``, :const:`MAX_PREC`] that sets
1075-
the precision for arithmetic operations in the context.
1074+
.. attribute:: prec
10761075

1077-
The *rounding* option is one of the constants listed in the section
1078-
`Rounding Modes`_.
1076+
An integer in the range [``1``, :const:`MAX_PREC`] that sets
1077+
the precision for arithmetic operations in the context.
10791078

1080-
The *traps* and *flags* fields list any signals to be set. Generally, new
1081-
contexts should only set traps and leave the flags clear.
1079+
.. attribute:: rounding
10821080

1083-
The *Emin* and *Emax* fields are integers specifying the outer limits allowable
1084-
for exponents. *Emin* must be in the range [:const:`MIN_EMIN`, ``0``],
1085-
*Emax* in the range [``0``, :const:`MAX_EMAX`].
1081+
One of the constants listed in the section `Rounding Modes`_.
10861082

1087-
The *capitals* field is either ``0`` or ``1`` (the default). If set to
1088-
``1``, exponents are printed with a capital ``E``; otherwise, a
1089-
lowercase ``e`` is used: ``Decimal('6.02e+23')``.
1083+
.. attribute:: traps
1084+
flags
10901085

1091-
The *clamp* field is either ``0`` (the default) or ``1``.
1092-
If set to ``1``, the exponent ``e`` of a :class:`Decimal`
1093-
instance representable in this context is strictly limited to the
1094-
range ``Emin - prec + 1 <= e <= Emax - prec + 1``. If *clamp* is
1095-
``0`` then a weaker condition holds: the adjusted exponent of
1096-
the :class:`Decimal` instance is at most :attr:`~Context.Emax`. When *clamp* is
1097-
``1``, a large normal number will, where possible, have its
1098-
exponent reduced and a corresponding number of zeros added to its
1099-
coefficient, in order to fit the exponent constraints; this
1100-
preserves the value of the number but loses information about
1101-
significant trailing zeros. For example::
1086+
Lists of any signals to be set. Generally, new contexts should only set
1087+
traps and leave the flags clear.
11021088

1103-
>>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')
1104-
Decimal('1.23000E+999')
1089+
.. attribute:: Emin
1090+
Emax
11051091

1106-
A *clamp* value of ``1`` allows compatibility with the
1107-
fixed-width decimal interchange formats specified in IEEE 754.
1092+
Integers specifying the outer limits allowable for exponents. *Emin* must
1093+
be in the range [:const:`MIN_EMIN`, ``0``], *Emax* in the range
1094+
[``0``, :const:`MAX_EMAX`].
1095+
1096+
.. attribute:: capitals
1097+
1098+
Either ``0`` or ``1`` (the default). If set to
1099+
``1``, exponents are printed with a capital ``E``; otherwise, a
1100+
lowercase ``e`` is used: ``Decimal('6.02e+23')``.
1101+
1102+
.. attribute:: clamp
1103+
1104+
Either ``0`` (the default) or ``1``. If set to ``1``, the exponent ``e``
1105+
of a :class:`Decimal` instance representable in this context is strictly
1106+
limited to the range ``Emin - prec + 1 <= e <= Emax - prec + 1``.
1107+
If *clamp* is ``0`` then a weaker condition holds: the adjusted exponent of
1108+
the :class:`Decimal` instance is at most :attr:`~Context.Emax`. When *clamp* is
1109+
``1``, a large normal number will, where possible, have its
1110+
exponent reduced and a corresponding number of zeros added to its
1111+
coefficient, in order to fit the exponent constraints; this
1112+
preserves the value of the number but loses information about
1113+
significant trailing zeros. For example::
1114+
1115+
>>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')
1116+
Decimal('1.23000E+999')
1117+
1118+
A *clamp* value of ``1`` allows compatibility with the
1119+
fixed-width decimal interchange formats specified in IEEE 754.
11081120

11091121
The :class:`Context` class defines several general purpose methods as well as
11101122
a large number of methods for doing arithmetic directly in a given context.
@@ -1743,7 +1755,7 @@ The following table summarizes the hierarchy of signals::
17431755
17441756
.. _decimal-notes:
17451757

1746-
Floating-Point Notes
1758+
Floating-point notes
17471759
--------------------
17481760

17491761

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@ Doc/extending/extending.rst
1515
Doc/library/ast.rst
1616
Doc/library/asyncio-extending.rst
1717
Doc/library/asyncio-policy.rst
18-
Doc/library/decimal.rst
1918
Doc/library/email.charset.rst
2019
Doc/library/email.compat32-message.rst
2120
Doc/library/email.parser.rst

0 commit comments

Comments
 (0)