Skip to content

Commit f3acbb7

Browse files
authored
gh-101100: Fix Sphinx warnings in library/decimal.rst (#134303)
1 parent 5ab66a8 commit f3acbb7

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
@@ -308,7 +308,6 @@
308308
('py:attr', '__annotations__'),
309309
('py:meth', '__missing__'),
310310
('py:attr', '__wrapped__'),
311-
('py:attr', 'decimal.Context.clamp'),
312311
('py:meth', 'index'), # list.index, tuple.index, etc.
313312
]
314313

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
@@ -1096,40 +1096,52 @@ In addition to the three supplied contexts, new contexts can be created with the
10961096
default values are copied from the :const:`DefaultContext`. If the *flags*
10971097
field is not specified or is :const:`None`, all flags are cleared.
10981098

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

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

1105-
The *traps* and *flags* fields list any signals to be set. Generally, new
1106-
contexts should only set traps and leave the flags clear.
1104+
.. attribute:: rounding
11071105

1108-
The *Emin* and *Emax* fields are integers specifying the outer limits allowable
1109-
for exponents. *Emin* must be in the range [:const:`MIN_EMIN`, ``0``],
1110-
*Emax* in the range [``0``, :const:`MAX_EMAX`].
1106+
One of the constants listed in the section `Rounding Modes`_.
11111107

1112-
The *capitals* field is either ``0`` or ``1`` (the default). If set to
1113-
``1``, exponents are printed with a capital ``E``; otherwise, a
1114-
lowercase ``e`` is used: ``Decimal('6.02e+23')``.
1108+
.. attribute:: traps
1109+
flags
11151110

1116-
The *clamp* field is either ``0`` (the default) or ``1``.
1117-
If set to ``1``, the exponent ``e`` of a :class:`Decimal`
1118-
instance representable in this context is strictly limited to the
1119-
range ``Emin - prec + 1 <= e <= Emax - prec + 1``. If *clamp* is
1120-
``0`` then a weaker condition holds: the adjusted exponent of
1121-
the :class:`Decimal` instance is at most :attr:`~Context.Emax`. When *clamp* is
1122-
``1``, a large normal number will, where possible, have its
1123-
exponent reduced and a corresponding number of zeros added to its
1124-
coefficient, in order to fit the exponent constraints; this
1125-
preserves the value of the number but loses information about
1126-
significant trailing zeros. For example::
1111+
Lists of any signals to be set. Generally, new contexts should only set
1112+
traps and leave the flags clear.
11271113

1128-
>>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')
1129-
Decimal('1.23000E+999')
1114+
.. attribute:: Emin
1115+
Emax
11301116

1131-
A *clamp* value of ``1`` allows compatibility with the
1132-
fixed-width decimal interchange formats specified in IEEE 754.
1117+
Integers specifying the outer limits allowable for exponents. *Emin* must
1118+
be in the range [:const:`MIN_EMIN`, ``0``], *Emax* in the range
1119+
[``0``, :const:`MAX_EMAX`].
1120+
1121+
.. attribute:: capitals
1122+
1123+
Either ``0`` or ``1`` (the default). If set to
1124+
``1``, exponents are printed with a capital ``E``; otherwise, a
1125+
lowercase ``e`` is used: ``Decimal('6.02e+23')``.
1126+
1127+
.. attribute:: clamp
1128+
1129+
Either ``0`` (the default) or ``1``. If set to ``1``, the exponent ``e``
1130+
of a :class:`Decimal` instance representable in this context is strictly
1131+
limited to the range ``Emin - prec + 1 <= e <= Emax - prec + 1``.
1132+
If *clamp* is ``0`` then a weaker condition holds: the adjusted exponent of
1133+
the :class:`Decimal` instance is at most :attr:`~Context.Emax`. When *clamp* is
1134+
``1``, a large normal number will, where possible, have its
1135+
exponent reduced and a corresponding number of zeros added to its
1136+
coefficient, in order to fit the exponent constraints; this
1137+
preserves the value of the number but loses information about
1138+
significant trailing zeros. For example::
1139+
1140+
>>> Context(prec=6, Emax=999, clamp=1).create_decimal('1.23e999')
1141+
Decimal('1.23000E+999')
1142+
1143+
A *clamp* value of ``1`` allows compatibility with the
1144+
fixed-width decimal interchange formats specified in IEEE 754.
11331145

11341146
The :class:`Context` class defines several general purpose methods as well as
11351147
a large number of methods for doing arithmetic directly in a given context.
@@ -1769,7 +1781,7 @@ The following table summarizes the hierarchy of signals::
17691781
17701782
.. _decimal-notes:
17711783

1772-
Floating-Point Notes
1784+
Floating-point notes
17731785
--------------------
17741786

17751787

Doc/tools/.nitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ Doc/c-api/typeobj.rst
1414
Doc/extending/extending.rst
1515
Doc/library/ast.rst
1616
Doc/library/asyncio-extending.rst
17-
Doc/library/decimal.rst
1817
Doc/library/email.charset.rst
1918
Doc/library/email.compat32-message.rst
2019
Doc/library/email.parser.rst

0 commit comments

Comments
 (0)