@@ -459,7 +459,7 @@ Decimal objects
459459 a :class: `Decimal ` instance is always canonical, so this operation returns
460460 its argument unchanged.
461461
462- .. method :: compare(other[ , context] )
462+ .. method :: compare(other, context=None )
463463
464464 Compare the values of two Decimal instances. :meth: `compare ` returns a
465465 Decimal instance, and if either operand is a NaN then the result is a
@@ -470,13 +470,13 @@ Decimal objects
470470 a == b ==> Decimal('0')
471471 a > b ==> Decimal('1')
472472
473- .. method :: compare_signal(other[ , context] )
473+ .. method :: compare_signal(other, context=None )
474474
475475 This operation is identical to the :meth: `compare ` method, except that all
476476 NaNs signal. That is, if neither operand is a signaling NaN then any
477477 quiet NaN operand is treated as though it were a signaling NaN.
478478
479- .. method :: compare_total(other)
479+ .. method :: compare_total(other, context=None )
480480
481481 Compare two operands using their abstract representation rather than their
482482 numerical value. Similar to the :meth: `compare ` method, but the result
@@ -494,13 +494,21 @@ Decimal objects
494494 higher in the total order than the second operand. See the specification
495495 for details of the total order.
496496
497- .. method :: compare_total_mag(other)
497+ This operation is unaffected by context and is quiet: no flags are changed
498+ and no rounding is performed. As an exception, the C version may raise
499+ InvalidOperation if the second operand cannot be converted exactly.
500+
501+ .. method :: compare_total_mag(other, context=None)
498502
499503 Compare two operands using their abstract representation rather than their
500504 value as in :meth: `compare_total `, but ignoring the sign of each operand.
501505 ``x.compare_total_mag(y) `` is equivalent to
502506 ``x.copy_abs().compare_total(y.copy_abs()) ``.
503507
508+ This operation is unaffected by context and is quiet: no flags are changed
509+ and no rounding is performed. As an exception, the C version may raise
510+ InvalidOperation if the second operand cannot be converted exactly.
511+
504512 .. method :: conjugate()
505513
506514 Just returns self, this method is only to comply with the Decimal
@@ -517,18 +525,19 @@ Decimal objects
517525 Return the negation of the argument. This operation is unaffected by the
518526 context and is quiet: no flags are changed and no rounding is performed.
519527
520- .. method :: copy_sign(other)
528+ .. method :: copy_sign(other, context=None )
521529
522530 Return a copy of the first operand with the sign set to be the same as the
523531 sign of the second operand. For example:
524532
525533 >>> Decimal(' 2.3' ).copy_sign(Decimal(' -1.5' ))
526534 Decimal('-2.3')
527535
528- This operation is unaffected by the context and is quiet: no flags are
529- changed and no rounding is performed.
536+ This operation is unaffected by context and is quiet: no flags are changed
537+ and no rounding is performed. As an exception, the C version may raise
538+ InvalidOperation if the second operand cannot be converted exactly.
530539
531- .. method :: exp([ context] )
540+ .. method :: exp(context=None )
532541
533542 Return the value of the (natural) exponential function ``e**x `` at the
534543 given number. The result is correctly rounded using the
@@ -565,7 +574,7 @@ Decimal objects
565574
566575 .. versionadded :: 3.1
567576
568- .. method :: fma(other, third[ , context] )
577+ .. method :: fma(other, third, context=None )
569578
570579 Fused multiply-add. Return self*other+third with no rounding of the
571580 intermediate product self*other.
@@ -594,7 +603,7 @@ Decimal objects
594603 Return :const: `True ` if the argument is a (quiet or signaling) NaN and
595604 :const: `False ` otherwise.
596605
597- .. method :: is_normal()
606+ .. method :: is_normal(context=None )
598607
599608 Return :const: `True ` if the argument is a *normal * finite number. Return
600609 :const: `False ` if the argument is zero, subnormal, infinite or a NaN.
@@ -614,7 +623,7 @@ Decimal objects
614623 Return :const: `True ` if the argument is a signaling NaN and :const: `False `
615624 otherwise.
616625
617- .. method :: is_subnormal()
626+ .. method :: is_subnormal(context=None )
618627
619628 Return :const: `True ` if the argument is subnormal, and :const: `False `
620629 otherwise.
@@ -624,91 +633,91 @@ Decimal objects
624633 Return :const: `True ` if the argument is a (positive or negative) zero and
625634 :const: `False ` otherwise.
626635
627- .. method :: ln([ context] )
636+ .. method :: ln(context=None )
628637
629638 Return the natural (base e) logarithm of the operand. The result is
630639 correctly rounded using the :const: `ROUND_HALF_EVEN ` rounding mode.
631640
632- .. method :: log10([ context] )
641+ .. method :: log10(context=None )
633642
634643 Return the base ten logarithm of the operand. The result is correctly
635644 rounded using the :const: `ROUND_HALF_EVEN ` rounding mode.
636645
637- .. method :: logb([ context] )
646+ .. method :: logb(context=None )
638647
639648 For a nonzero number, return the adjusted exponent of its operand as a
640649 :class: `Decimal ` instance. If the operand is a zero then
641650 ``Decimal('-Infinity') `` is returned and the :const: `DivisionByZero ` flag
642651 is raised. If the operand is an infinity then ``Decimal('Infinity') `` is
643652 returned.
644653
645- .. method :: logical_and(other[ , context] )
654+ .. method :: logical_and(other, context=None )
646655
647656 :meth: `logical_and ` is a logical operation which takes two *logical
648657 operands * (see :ref: `logical_operands_label `). The result is the
649658 digit-wise ``and `` of the two operands.
650659
651- .. method :: logical_invert([ context] )
660+ .. method :: logical_invert(context=None )
652661
653662 :meth: `logical_invert ` is a logical operation. The
654663 result is the digit-wise inversion of the operand.
655664
656- .. method :: logical_or(other[ , context] )
665+ .. method :: logical_or(other, context=None )
657666
658667 :meth: `logical_or ` is a logical operation which takes two *logical
659668 operands * (see :ref: `logical_operands_label `). The result is the
660669 digit-wise ``or `` of the two operands.
661670
662- .. method :: logical_xor(other[ , context] )
671+ .. method :: logical_xor(other, context=None )
663672
664673 :meth: `logical_xor ` is a logical operation which takes two *logical
665674 operands * (see :ref: `logical_operands_label `). The result is the
666675 digit-wise exclusive or of the two operands.
667676
668- .. method :: max(other[ , context] )
677+ .. method :: max(other, context=None )
669678
670679 Like ``max(self, other) `` except that the context rounding rule is applied
671680 before returning and that :const: `NaN ` values are either signaled or
672681 ignored (depending on the context and whether they are signaling or
673682 quiet).
674683
675- .. method :: max_mag(other[ , context] )
684+ .. method :: max_mag(other, context=None )
676685
677686 Similar to the :meth: `.max ` method, but the comparison is done using the
678687 absolute values of the operands.
679688
680- .. method :: min(other[ , context] )
689+ .. method :: min(other, context=None )
681690
682691 Like ``min(self, other) `` except that the context rounding rule is applied
683692 before returning and that :const: `NaN ` values are either signaled or
684693 ignored (depending on the context and whether they are signaling or
685694 quiet).
686695
687- .. method :: min_mag(other[ , context] )
696+ .. method :: min_mag(other, context=None )
688697
689698 Similar to the :meth: `.min ` method, but the comparison is done using the
690699 absolute values of the operands.
691700
692- .. method :: next_minus([ context] )
701+ .. method :: next_minus(context=None )
693702
694703 Return the largest number representable in the given context (or in the
695704 current thread's context if no context is given) that is smaller than the
696705 given operand.
697706
698- .. method :: next_plus([ context] )
707+ .. method :: next_plus(context=None )
699708
700709 Return the smallest number representable in the given context (or in the
701710 current thread's context if no context is given) that is larger than the
702711 given operand.
703712
704- .. method :: next_toward(other[ , context] )
713+ .. method :: next_toward(other, context=None )
705714
706715 If the two operands are unequal, return the number closest to the first
707716 operand in the direction of the second operand. If both operands are
708717 numerically equal, return a copy of the first operand with the sign set to
709718 be the same as the sign of the second operand.
710719
711- .. method :: normalize([ context] )
720+ .. method :: normalize(context=None )
712721
713722 Normalize the number by stripping the rightmost trailing zeros and
714723 converting any result equal to :const: `Decimal('0') ` to
@@ -717,7 +726,7 @@ Decimal objects
717726 ``Decimal('0.321000e+2') `` both normalize to the equivalent value
718727 ``Decimal('32.1') ``.
719728
720- .. method :: number_class([ context] )
729+ .. method :: number_class(context=None )
721730
722731 Return a string describing the *class * of the operand. The returned value
723732 is one of the following ten strings.
@@ -733,7 +742,7 @@ Decimal objects
733742 * ``"NaN" ``, indicating that the operand is a quiet NaN (Not a Number).
734743 * ``"sNaN" ``, indicating that the operand is a signaling NaN.
735744
736- .. method :: quantize(exp[ , rounding[ , context[ , watchexp]]] )
745+ .. method :: quantize(exp, rounding=None , context=None , watchexp=True )
737746
738747 Return a value equal to the first operand after rounding and having the
739748 exponent of the second operand.
@@ -771,7 +780,7 @@ Decimal objects
771780 class does all its arithmetic. Included for compatibility with the
772781 specification.
773782
774- .. method :: remainder_near(other[ , context] )
783+ .. method :: remainder_near(other, context=None )
775784
776785 Return the remainder from dividing *self * by *other *. This differs from
777786 ``self % other `` in that the sign of the remainder is chosen so as to
@@ -789,7 +798,7 @@ Decimal objects
789798 >>> Decimal(35 ).remainder_near(Decimal(10 ))
790799 Decimal('-5')
791800
792- .. method :: rotate(other[ , context] )
801+ .. method :: rotate(other, context=None )
793802
794803 Return the result of rotating the digits of the first operand by an amount
795804 specified by the second operand. The second operand must be an integer in
@@ -800,18 +809,22 @@ Decimal objects
800809 length precision if necessary. The sign and exponent of the first operand
801810 are unchanged.
802811
803- .. method :: same_quantum(other[ , context] )
812+ .. method :: same_quantum(other, context=None )
804813
805814 Test whether self and other have the same exponent or whether both are
806815 :const: `NaN `.
807816
808- .. method :: scaleb(other[, context])
817+ This operation is unaffected by context and is quiet: no flags are changed
818+ and no rounding is performed. As an exception, the C version may raise
819+ InvalidOperation if the second operand cannot be converted exactly.
820+
821+ .. method :: scaleb(other, context=None)
809822
810823 Return the first operand with exponent adjusted by the second.
811824 Equivalently, return the first operand multiplied by ``10**other ``. The
812825 second operand must be an integer.
813826
814- .. method :: shift(other[ , context] )
827+ .. method :: shift(other, context=None )
815828
816829 Return the result of shifting the digits of the first operand by an amount
817830 specified by the second operand. The second operand must be an integer in
@@ -821,33 +834,33 @@ Decimal objects
821834 right. Digits shifted into the coefficient are zeros. The sign and
822835 exponent of the first operand are unchanged.
823836
824- .. method :: sqrt([ context] )
837+ .. method :: sqrt(context=None )
825838
826839 Return the square root of the argument to full precision.
827840
828841
829- .. method :: to_eng_string([ context] )
842+ .. method :: to_eng_string(context=None )
830843
831844 Convert to an engineering-type string.
832845
833846 Engineering notation has an exponent which is a multiple of 3, so there
834847 are up to 3 digits left of the decimal place. For example, converts
835848 ``Decimal('123E+1') `` to ``Decimal('1.23E+3') ``
836849
837- .. method :: to_integral([ rounding[ , context]] )
850+ .. method :: to_integral(rounding=None , context=None )
838851
839852 Identical to the :meth: `to_integral_value ` method. The ``to_integral ``
840853 name has been kept for compatibility with older versions.
841854
842- .. method :: to_integral_exact([ rounding[ , context]] )
855+ .. method :: to_integral_exact(rounding=None , context=None )
843856
844857 Round to the nearest integer, signaling :const: `Inexact ` or
845858 :const: `Rounded ` as appropriate if rounding occurs. The rounding mode is
846859 determined by the ``rounding `` parameter if given, else by the given
847860 ``context ``. If neither parameter is given then the rounding mode of the
848861 current context is used.
849862
850- .. method :: to_integral_value([ rounding[ , context]] )
863+ .. method :: to_integral_value(rounding=None , context=None )
851864
852865 Round to the nearest integer without signaling :const: `Inexact ` or
853866 :const: `Rounded `. If given, applies *rounding *; otherwise, uses the
@@ -893,10 +906,10 @@ Each thread has its own current context which is accessed or changed using the
893906You can also use the :keyword: `with ` statement and the :func: `localcontext `
894907function to temporarily change the active context.
895908
896- .. function :: localcontext([c] )
909+ .. function :: localcontext(ctx=None )
897910
898911 Return a context manager that will set the current context for the active thread
899- to a copy of *c * on entry to the with-statement and restore the previous context
912+ to a copy of *ctx * on entry to the with-statement and restore the previous context
900913 when exiting the with-statement. If no context is specified, a copy of the
901914 current context is used.
902915
@@ -1315,7 +1328,7 @@ In addition to the three supplied contexts, new contexts can be created with the
13151328 identity operation.
13161329
13171330
1318- .. method :: power(x, y[ , modulo] )
1331+ .. method :: power(x, y, modulo=None )
13191332
13201333 Return ``x `` to the power of ``y ``, reduced modulo ``modulo `` if given.
13211334
0 commit comments