Skip to content

Commit a4f7f0c

Browse files
committed
adjust docstrings after python#137624
1 parent 60e8d44 commit a4f7f0c

File tree

2 files changed

+125
-99
lines changed

2 files changed

+125
-99
lines changed

Modules/_decimal/_decimal.c

Lines changed: 68 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -3921,15 +3921,15 @@ _decimal.Decimal.to_integral_value
39213921
39223922
Round to the nearest integer without signaling Inexact or Rounded.
39233923
3924-
The rounding mode is determined by the rounding parameter if given, else by
3925-
the given context. If neither parameter is given, then the rounding mode of
3926-
the current default context is used.
3924+
The rounding mode is determined by the rounding parameter if given,
3925+
else by the given context. If neither parameter is given, then the
3926+
rounding mode of the current default context is used.
39273927
[clinic start generated code]*/
39283928

39293929
static PyObject *
39303930
_decimal_Decimal_to_integral_value_impl(PyObject *dec, PyObject *rounding,
39313931
PyObject *context)
3932-
/*[clinic end generated code: output=1517d948029dbecc input=0fd8dd3bc5248b21]*/
3932+
/*[clinic end generated code: output=1517d948029dbecc input=0afac3e278bdb511]*/
39333933
{
39343934
PyObject *result;
39353935
uint32_t status = 0;
@@ -3971,13 +3971,14 @@ _decimal.Decimal.to_integral
39713971
39723972
Identical to the to_integral_value() method.
39733973
3974-
The to_integral() name has been kept for compatibility with older versions.
3974+
The to_integral() name has been kept for compatibility with older
3975+
versions.
39753976
[clinic start generated code]*/
39763977

39773978
static PyObject *
39783979
_decimal_Decimal_to_integral_impl(PyObject *self, PyObject *rounding,
39793980
PyObject *context)
3980-
/*[clinic end generated code: output=a0c7188686ee7f5c input=a57d62d1d29aed1b]*/
3981+
/*[clinic end generated code: output=a0c7188686ee7f5c input=8eac6def038d13b9]*/
39813982
{
39823983
return _decimal_Decimal_to_integral_value_impl(self, rounding, context);
39833984
}
@@ -3991,16 +3992,16 @@ _decimal.Decimal.to_integral_exact
39913992
39923993
Round to the nearest integer.
39933994
3994-
Decimal.to_integral_exact() signals Inexact or Rounded as appropriate if
3995-
rounding occurs. The rounding mode is determined by the rounding parameter
3996-
if given, else by the given context. If neither parameter is given, then the
3997-
rounding mode of the current default context is used.
3995+
Decimal.to_integral_exact() signals Inexact or Rounded as appropriate
3996+
if rounding occurs. The rounding mode is determined by the rounding
3997+
parameter if given, else by the given context. If neither parameter is
3998+
given, then the rounding mode of the current default context is used.
39983999
[clinic start generated code]*/
39994000

40004001
static PyObject *
40014002
_decimal_Decimal_to_integral_exact_impl(PyObject *dec, PyObject *rounding,
40024003
PyObject *context)
4003-
/*[clinic end generated code: output=bfcd6d3ac47460d7 input=095a7cc7368dcfbb]*/
4004+
/*[clinic end generated code: output=bfcd6d3ac47460d7 input=8cb083bc2b4fb1c3]*/
40044005
{
40054006
PyObject *result;
40064007
uint32_t status = 0;
@@ -4612,12 +4613,12 @@ Dec_BoolFuncVA(mpd_issubnormal)
46124613
/*[clinic input]
46134614
_decimal.Decimal.adjusted
46144615
4615-
Return the adjusted exponent of the number. Defined as exp + digits - 1.
4616+
Return the adjusted exponent (exp + digits - 1) of the number.
46164617
[clinic start generated code]*/
46174618

46184619
static PyObject *
46194620
_decimal_Decimal_adjusted_impl(PyObject *self)
4620-
/*[clinic end generated code: output=21ea2c9f23994c52 input=775a14d44f31f787]*/
4621+
/*[clinic end generated code: output=21ea2c9f23994c52 input=8ba2029d8d906b18]*/
46214622
{
46224623
mpd_ssize_t retval;
46234624

@@ -4636,13 +4637,13 @@ _decimal.Decimal.canonical
46364637
46374638
Return the canonical encoding of the argument.
46384639
4639-
Currently, the encoding of a Decimal instance is always canonical, so this
4640-
operation returns its argument unchanged.
4640+
Currently, the encoding of a Decimal instance is always canonical,
4641+
so this operation returns its argument unchanged.
46414642
[clinic start generated code]*/
46424643

46434644
static PyObject *
46444645
_decimal_Decimal_canonical_impl(PyObject *self)
4645-
/*[clinic end generated code: output=3cbeb47d91e6da2d input=9089f031f530238e]*/
4646+
/*[clinic end generated code: output=3cbeb47d91e6da2d input=8a4719d14c52d521]*/
46464647
{
46474648
return Py_NewRef(self);
46484649
}
@@ -4696,13 +4697,13 @@ _decimal.Decimal.copy_abs
46964697
46974698
Return the absolute value of the argument.
46984699
4699-
This operation is unaffected by context and is quiet: no flags are changed and
4700-
no rounding is performed.
4700+
This operation is unaffected by context and is quiet: no flags are
4701+
changed and no rounding is performed.
47014702
[clinic start generated code]*/
47024703

47034704
static PyObject *
47044705
_decimal_Decimal_copy_abs_impl(PyObject *self)
4705-
/*[clinic end generated code: output=fff53742cca94d70 input=fa96ebbfd9191e72]*/
4706+
/*[clinic end generated code: output=fff53742cca94d70 input=a263c2e71d421f1b]*/
47064707
{
47074708
PyObject *result;
47084709
uint32_t status = 0;
@@ -4727,13 +4728,13 @@ _decimal.Decimal.copy_negate
47274728
47284729
Return the negation of the argument.
47294730
4730-
This operation is unaffected by context and is quiet: no flags are changed and
4731-
no rounding is performed.
4731+
This operation is unaffected by context and is quiet: no flags are
4732+
changed and no rounding is performed.
47324733
[clinic start generated code]*/
47334734

47344735
static PyObject *
47354736
_decimal_Decimal_copy_negate_impl(PyObject *self)
4736-
/*[clinic end generated code: output=8551bc26dbc5d01d input=2ca2ce000154fca0]*/
4737+
/*[clinic end generated code: output=8551bc26dbc5d01d input=13d47ed3a5d228b1]*/
47374738
{
47384739
PyObject *result;
47394740
uint32_t status = 0;
@@ -4767,20 +4768,24 @@ Return a string describing the class of the operand.
47674768
The returned value is one of the following ten strings:
47684769
47694770
* '-Infinity', indicating that the operand is negative infinity.
4770-
* '-Normal', indicating that the operand is a negative normal number.
4771-
* '-Subnormal', indicating that the operand is negative and subnormal.
4771+
* '-Normal', indicating that the operand is a negative normal
4772+
number.
4773+
* '-Subnormal', indicating that the operand is negative and
4774+
subnormal.
47724775
* '-Zero', indicating that the operand is a negative zero.
47734776
* '+Zero', indicating that the operand is a positive zero.
4774-
* '+Subnormal', indicating that the operand is positive and subnormal.
4775-
* '+Normal', indicating that the operand is a positive normal number.
4777+
* '+Subnormal', indicating that the operand is positive and
4778+
subnormal.
4779+
* '+Normal', indicating that the operand is a positive normal
4780+
number.
47764781
* '+Infinity', indicating that the operand is positive infinity.
47774782
* 'NaN', indicating that the operand is a quiet NaN (Not a Number).
47784783
* 'sNaN', indicating that the operand is a signaling NaN.
47794784
[clinic start generated code]*/
47804785

47814786
static PyObject *
47824787
_decimal_Decimal_number_class_impl(PyObject *self, PyObject *context)
4783-
/*[clinic end generated code: output=3044cd45966b4949 input=80cc37edb4fd663f]*/
4788+
/*[clinic end generated code: output=3044cd45966b4949 input=f3d6cdda603e8b89]*/
47844789
{
47854790
const char *cp;
47864791

@@ -4798,17 +4803,18 @@ _decimal.Decimal.to_eng_string
47984803
47994804
Convert to an engineering-type string.
48004805
4801-
Engineering notation has an exponent which is a multiple of 3, so there are up
4802-
to 3 digits left of the decimal place. For example, Decimal('123E+1') is
4803-
converted to Decimal('1.23E+3').
4806+
Engineering notation has an exponent which is a multiple of 3, so there
4807+
are up to 3 digits left of the decimal place. For example,
4808+
Decimal('123E+1') is converted to Decimal('1.23E+3').
48044809
4805-
The value of context.capitals determines whether the exponent sign is lower
4806-
or upper case. Otherwise, the context does not affect the operation.
4810+
The value of context.capitals determines whether the exponent sign is
4811+
lower or upper case. Otherwise, the context does not affect the
4812+
operation.
48074813
[clinic start generated code]*/
48084814

48094815
static PyObject *
48104816
_decimal_Decimal_to_eng_string_impl(PyObject *self, PyObject *context)
4811-
/*[clinic end generated code: output=d386194c25ffffa7 input=36436cb7973dd5d0]*/
4817+
/*[clinic end generated code: output=d386194c25ffffa7 input=2e13e7c7c1bad2ad]*/
48124818
{
48134819
PyObject *result;
48144820
mpd_ssize_t size;
@@ -4839,22 +4845,23 @@ _decimal.Decimal.copy_sign
48394845
other: object
48404846
context: object = None
48414847
4842-
Return a copy of *self* with the sign set to be the same as the sign of *other*.
4848+
Return a copy of *self* with the sign of *other*.
48434849
48444850
For example:
48454851
48464852
>>> Decimal('2.3').copy_sign(Decimal('-1.5'))
48474853
Decimal('-2.3')
48484854
4849-
This operation is unaffected by context and is quiet: no flags are changed
4850-
and no rounding is performed. As an exception, the C version may raise
4851-
InvalidOperation if the second operand cannot be converted exactly.
4855+
This operation is unaffected by context and is quiet: no flags are
4856+
changed and no rounding is performed. As an exception, the C version
4857+
may raise InvalidOperation if the second operand cannot be converted
4858+
exactly.
48524859
[clinic start generated code]*/
48534860

48544861
static PyObject *
48554862
_decimal_Decimal_copy_sign_impl(PyObject *self, PyObject *other,
48564863
PyObject *context)
4857-
/*[clinic end generated code: output=72c62177763e012e input=96b620d142ed80a9]*/
4864+
/*[clinic end generated code: output=72c62177763e012e input=8410238d533a06eb]*/
48584865
{
48594866
PyObject *a, *b;
48604867
PyObject *result;
@@ -4888,17 +4895,18 @@ _decimal.Decimal.same_quantum
48884895
other: object
48894896
context: object = None
48904897
4891-
Test whether self and other have the same exponent or whether both are NaN.
4898+
Test whether self and other have the same exponent or both are NaN.
48924899
4893-
This operation is unaffected by context and is quiet: no flags are changed
4894-
and no rounding is performed. As an exception, the C version may raise
4895-
InvalidOperation if the second operand cannot be converted exactly.
4900+
This operation is unaffected by context and is quiet: no flags are
4901+
changed and no rounding is performed. As an exception, the C version
4902+
may raise InvalidOperation if the second operand cannot be converted
4903+
exactly.
48964904
[clinic start generated code]*/
48974905

48984906
static PyObject *
48994907
_decimal_Decimal_same_quantum_impl(PyObject *self, PyObject *other,
49004908
PyObject *context)
4901-
/*[clinic end generated code: output=c0a3a046c662a7e2 input=d583092dec58453e]*/
4909+
/*[clinic end generated code: output=c0a3a046c662a7e2 input=3ae45df81d6edb73]*/
49024910
{
49034911
PyObject *a, *b;
49044912
PyObject *result;
@@ -4931,29 +4939,34 @@ _decimal.Decimal.quantize
49314939
rounding: object = None
49324940
context: object = None
49334941
4934-
Return a value equal to *self* after rounding, with the exponent of *other*.
4942+
Quantize *self* so its exponent is the same as that of *exp*.
4943+
4944+
Return a value equal to *self* after rounding, with the exponent
4945+
of *exp*.
49354946
49364947
>>> Decimal('1.41421356').quantize(Decimal('1.000'))
49374948
Decimal('1.414')
49384949
4939-
Unlike other operations, if the length of the coefficient after the quantize
4940-
operation would be greater than precision, then an InvalidOperation is signaled.
4941-
This guarantees that, unless there is an error condition, the quantized exponent
4942-
is always equal to that of the right-hand operand.
4950+
Unlike other operations, if the length of the coefficient after the
4951+
quantize operation would be greater than precision, then an
4952+
InvalidOperation is signaled. This guarantees that, unless there
4953+
is an error condition, the quantized exponent is always equal to
4954+
that of the right-hand operand.
49434955
4944-
Also unlike other operations, quantize never signals Underflow, even if the
4945-
result is subnormal and inexact.
4956+
Also unlike other operations, quantize never signals Underflow, even
4957+
if the result is subnormal and inexact.
49464958
4947-
If the exponent of the second operand is larger than that of the first, then
4948-
rounding may be necessary. In this case, the rounding mode is determined by the
4949-
rounding argument if given, else by the given context argument; if neither
4950-
argument is given, the rounding mode of the current thread's context is used.
4959+
If the exponent of the second operand is larger than that of the first,
4960+
then rounding may be necessary. In this case, the rounding mode is
4961+
determined by the rounding argument if given, else by the given context
4962+
argument; if neither argument is given, the rounding mode of the
4963+
current thread's context is used.
49514964
[clinic start generated code]*/
49524965

49534966
static PyObject *
49544967
_decimal_Decimal_quantize_impl(PyObject *v, PyObject *w, PyObject *rounding,
49554968
PyObject *context)
4956-
/*[clinic end generated code: output=6ebc907ee3000c1f input=223b9dd92655b4bd]*/
4969+
/*[clinic end generated code: output=6ebc907ee3000c1f input=d1dc20057afe0c7e]*/
49574970
{
49584971
PyObject *a, *b;
49594972
PyObject *result;

0 commit comments

Comments
 (0)