Skip to content

Commit a599f4d

Browse files
donBarbosAA-Turner
authored andcommitted
[3.13] gh-131885: Use positional-only markers for the decimal module (GH-131990)
(cherry picked from commit 043f251) Co-authored-by: Semyon Moroz <[email protected]>
1 parent 9face21 commit a599f4d

File tree

1 file changed

+61
-61
lines changed

1 file changed

+61
-61
lines changed

Doc/library/decimal.rst

Lines changed: 61 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -573,7 +573,7 @@ Decimal objects
573573
>>> Decimal(321).exp()
574574
Decimal('2.561702493119680037517373933E+139')
575575

576-
.. classmethod:: from_float(f)
576+
.. classmethod:: from_float(f, /)
577577

578578
Alternative constructor that only accepts instances of :class:`float` or
579579
:class:`int`.
@@ -974,7 +974,7 @@ Each thread has its own current context which is accessed or changed using the
974974
Return the current context for the active thread.
975975

976976

977-
.. function:: setcontext(c)
977+
.. function:: setcontext(c, /)
978978

979979
Set the current context for the active thread to *c*.
980980

@@ -1143,11 +1143,11 @@ In addition to the three supplied contexts, new contexts can be created with the
11431143

11441144
Return a duplicate of the context.
11451145

1146-
.. method:: copy_decimal(num)
1146+
.. method:: copy_decimal(num, /)
11471147

11481148
Return a copy of the Decimal instance num.
11491149

1150-
.. method:: create_decimal(num)
1150+
.. method:: create_decimal(num='0', /)
11511151

11521152
Creates a new Decimal instance from *num* but using *self* as
11531153
context. Unlike the :class:`Decimal` constructor, the context precision,
@@ -1171,7 +1171,7 @@ In addition to the three supplied contexts, new contexts can be created with the
11711171
If the argument is a string, no leading or trailing whitespace or
11721172
underscores are permitted.
11731173

1174-
.. method:: create_decimal_from_float(f)
1174+
.. method:: create_decimal_from_float(f, /)
11751175

11761176
Creates a new Decimal instance from a float *f* but rounding using *self*
11771177
as the context. Unlike the :meth:`Decimal.from_float` class method,
@@ -1209,222 +1209,222 @@ In addition to the three supplied contexts, new contexts can be created with the
12091209
recounted here.
12101210

12111211

1212-
.. method:: abs(x)
1212+
.. method:: abs(x, /)
12131213

12141214
Returns the absolute value of *x*.
12151215

12161216

1217-
.. method:: add(x, y)
1217+
.. method:: add(x, y, /)
12181218

12191219
Return the sum of *x* and *y*.
12201220

12211221

1222-
.. method:: canonical(x)
1222+
.. method:: canonical(x, /)
12231223

12241224
Returns the same Decimal object *x*.
12251225

12261226

1227-
.. method:: compare(x, y)
1227+
.. method:: compare(x, y, /)
12281228

12291229
Compares *x* and *y* numerically.
12301230

12311231

1232-
.. method:: compare_signal(x, y)
1232+
.. method:: compare_signal(x, y, /)
12331233

12341234
Compares the values of the two operands numerically.
12351235

12361236

1237-
.. method:: compare_total(x, y)
1237+
.. method:: compare_total(x, y, /)
12381238

12391239
Compares two operands using their abstract representation.
12401240

12411241

1242-
.. method:: compare_total_mag(x, y)
1242+
.. method:: compare_total_mag(x, y, /)
12431243

12441244
Compares two operands using their abstract representation, ignoring sign.
12451245

12461246

1247-
.. method:: copy_abs(x)
1247+
.. method:: copy_abs(x, /)
12481248

12491249
Returns a copy of *x* with the sign set to 0.
12501250

12511251

1252-
.. method:: copy_negate(x)
1252+
.. method:: copy_negate(x, /)
12531253

12541254
Returns a copy of *x* with the sign inverted.
12551255

12561256

1257-
.. method:: copy_sign(x, y)
1257+
.. method:: copy_sign(x, y, /)
12581258

12591259
Copies the sign from *y* to *x*.
12601260

12611261

1262-
.. method:: divide(x, y)
1262+
.. method:: divide(x, y, /)
12631263

12641264
Return *x* divided by *y*.
12651265

12661266

1267-
.. method:: divide_int(x, y)
1267+
.. method:: divide_int(x, y, /)
12681268

12691269
Return *x* divided by *y*, truncated to an integer.
12701270

12711271

1272-
.. method:: divmod(x, y)
1272+
.. method:: divmod(x, y, /)
12731273

12741274
Divides two numbers and returns the integer part of the result.
12751275

12761276

1277-
.. method:: exp(x)
1277+
.. method:: exp(x, /)
12781278

12791279
Returns ``e ** x``.
12801280

12811281

1282-
.. method:: fma(x, y, z)
1282+
.. method:: fma(x, y, z, /)
12831283

12841284
Returns *x* multiplied by *y*, plus *z*.
12851285

12861286

1287-
.. method:: is_canonical(x)
1287+
.. method:: is_canonical(x, /)
12881288

12891289
Returns ``True`` if *x* is canonical; otherwise returns ``False``.
12901290

12911291

1292-
.. method:: is_finite(x)
1292+
.. method:: is_finite(x, /)
12931293

12941294
Returns ``True`` if *x* is finite; otherwise returns ``False``.
12951295

12961296

1297-
.. method:: is_infinite(x)
1297+
.. method:: is_infinite(x, /)
12981298

12991299
Returns ``True`` if *x* is infinite; otherwise returns ``False``.
13001300

13011301

1302-
.. method:: is_nan(x)
1302+
.. method:: is_nan(x, /)
13031303

13041304
Returns ``True`` if *x* is a qNaN or sNaN; otherwise returns ``False``.
13051305

13061306

1307-
.. method:: is_normal(x)
1307+
.. method:: is_normal(x, /)
13081308

13091309
Returns ``True`` if *x* is a normal number; otherwise returns ``False``.
13101310

13111311

1312-
.. method:: is_qnan(x)
1312+
.. method:: is_qnan(x, /)
13131313

13141314
Returns ``True`` if *x* is a quiet NaN; otherwise returns ``False``.
13151315

13161316

1317-
.. method:: is_signed(x)
1317+
.. method:: is_signed(x, /)
13181318

13191319
Returns ``True`` if *x* is negative; otherwise returns ``False``.
13201320

13211321

1322-
.. method:: is_snan(x)
1322+
.. method:: is_snan(x, /)
13231323

13241324
Returns ``True`` if *x* is a signaling NaN; otherwise returns ``False``.
13251325

13261326

1327-
.. method:: is_subnormal(x)
1327+
.. method:: is_subnormal(x, /)
13281328

13291329
Returns ``True`` if *x* is subnormal; otherwise returns ``False``.
13301330

13311331

1332-
.. method:: is_zero(x)
1332+
.. method:: is_zero(x, /)
13331333

13341334
Returns ``True`` if *x* is a zero; otherwise returns ``False``.
13351335

13361336

1337-
.. method:: ln(x)
1337+
.. method:: ln(x, /)
13381338

13391339
Returns the natural (base e) logarithm of *x*.
13401340

13411341

1342-
.. method:: log10(x)
1342+
.. method:: log10(x, /)
13431343

13441344
Returns the base 10 logarithm of *x*.
13451345

13461346

1347-
.. method:: logb(x)
1347+
.. method:: logb(x, /)
13481348

13491349
Returns the exponent of the magnitude of the operand's MSD.
13501350

13511351

1352-
.. method:: logical_and(x, y)
1352+
.. method:: logical_and(x, y, /)
13531353

13541354
Applies the logical operation *and* between each operand's digits.
13551355

13561356

1357-
.. method:: logical_invert(x)
1357+
.. method:: logical_invert(x, /)
13581358

13591359
Invert all the digits in *x*.
13601360

13611361

1362-
.. method:: logical_or(x, y)
1362+
.. method:: logical_or(x, y, /)
13631363

13641364
Applies the logical operation *or* between each operand's digits.
13651365

13661366

1367-
.. method:: logical_xor(x, y)
1367+
.. method:: logical_xor(x, y, /)
13681368

13691369
Applies the logical operation *xor* between each operand's digits.
13701370

13711371

1372-
.. method:: max(x, y)
1372+
.. method:: max(x, y, /)
13731373

13741374
Compares two values numerically and returns the maximum.
13751375

13761376

1377-
.. method:: max_mag(x, y)
1377+
.. method:: max_mag(x, y, /)
13781378

13791379
Compares the values numerically with their sign ignored.
13801380

13811381

1382-
.. method:: min(x, y)
1382+
.. method:: min(x, y, /)
13831383

13841384
Compares two values numerically and returns the minimum.
13851385

13861386

1387-
.. method:: min_mag(x, y)
1387+
.. method:: min_mag(x, y, /)
13881388

13891389
Compares the values numerically with their sign ignored.
13901390

13911391

1392-
.. method:: minus(x)
1392+
.. method:: minus(x, /)
13931393

13941394
Minus corresponds to the unary prefix minus operator in Python.
13951395

13961396

1397-
.. method:: multiply(x, y)
1397+
.. method:: multiply(x, y, /)
13981398

13991399
Return the product of *x* and *y*.
14001400

14011401

1402-
.. method:: next_minus(x)
1402+
.. method:: next_minus(x, /)
14031403

14041404
Returns the largest representable number smaller than *x*.
14051405

14061406

1407-
.. method:: next_plus(x)
1407+
.. method:: next_plus(x, /)
14081408

14091409
Returns the smallest representable number larger than *x*.
14101410

14111411

1412-
.. method:: next_toward(x, y)
1412+
.. method:: next_toward(x, y, /)
14131413

14141414
Returns the number closest to *x*, in direction towards *y*.
14151415

14161416

1417-
.. method:: normalize(x)
1417+
.. method:: normalize(x, /)
14181418

14191419
Reduces *x* to its simplest form.
14201420

14211421

1422-
.. method:: number_class(x)
1422+
.. method:: number_class(x, /)
14231423

14241424
Returns an indication of the class of *x*.
14251425

14261426

1427-
.. method:: plus(x)
1427+
.. method:: plus(x, /)
14281428

14291429
Plus corresponds to the unary prefix plus operator in Python. This
14301430
operation applies the context precision and rounding, so it is *not* an
@@ -1465,7 +1465,7 @@ In addition to the three supplied contexts, new contexts can be created with the
14651465
always exact.
14661466

14671467

1468-
.. method:: quantize(x, y)
1468+
.. method:: quantize(x, y, /)
14691469

14701470
Returns a value equal to *x* (rounded), having the exponent of *y*.
14711471

@@ -1475,51 +1475,51 @@ In addition to the three supplied contexts, new contexts can be created with the
14751475
Just returns 10, as this is Decimal, :)
14761476

14771477

1478-
.. method:: remainder(x, y)
1478+
.. method:: remainder(x, y, /)
14791479

14801480
Returns the remainder from integer division.
14811481

14821482
The sign of the result, if non-zero, is the same as that of the original
14831483
dividend.
14841484

14851485

1486-
.. method:: remainder_near(x, y)
1486+
.. method:: remainder_near(x, y, /)
14871487

14881488
Returns ``x - y * n``, where *n* is the integer nearest the exact value
14891489
of ``x / y`` (if the result is 0 then its sign will be the sign of *x*).
14901490

14911491

1492-
.. method:: rotate(x, y)
1492+
.. method:: rotate(x, y, /)
14931493

14941494
Returns a rotated copy of *x*, *y* times.
14951495

14961496

1497-
.. method:: same_quantum(x, y)
1497+
.. method:: same_quantum(x, y, /)
14981498

14991499
Returns ``True`` if the two operands have the same exponent.
15001500

15011501

1502-
.. method:: scaleb (x, y)
1502+
.. method:: scaleb (x, y, /)
15031503

15041504
Returns the first operand after adding the second value its exp.
15051505

15061506

1507-
.. method:: shift(x, y)
1507+
.. method:: shift(x, y, /)
15081508

15091509
Returns a shifted copy of *x*, *y* times.
15101510

15111511

1512-
.. method:: sqrt(x)
1512+
.. method:: sqrt(x, /)
15131513

15141514
Square root of a non-negative number to context precision.
15151515

15161516

1517-
.. method:: subtract(x, y)
1517+
.. method:: subtract(x, y, /)
15181518

15191519
Return the difference between *x* and *y*.
15201520

15211521

1522-
.. method:: to_eng_string(x)
1522+
.. method:: to_eng_string(x, /)
15231523

15241524
Convert to a string, using engineering notation if an exponent is needed.
15251525

@@ -1528,12 +1528,12 @@ In addition to the three supplied contexts, new contexts can be created with the
15281528
require the addition of either one or two trailing zeros.
15291529

15301530

1531-
.. method:: to_integral_exact(x)
1531+
.. method:: to_integral_exact(x, /)
15321532

15331533
Rounds to an integer.
15341534

15351535

1536-
.. method:: to_sci_string(x)
1536+
.. method:: to_sci_string(x, /)
15371537

15381538
Converts a number to a string using scientific notation.
15391539

0 commit comments

Comments
 (0)