basedpyright 1.40.1 → 1.40.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/pyright-langserver.js +1 -1
  2. package/dist/pyright.js +1 -1
  3. package/dist/typeshed-fallback/stdlib/_blake2.pyi +1 -1
  4. package/dist/typeshed-fallback/stdlib/_curses.pyi +81 -54
  5. package/dist/typeshed-fallback/stdlib/_curses_panel.pyi +8 -1
  6. package/dist/typeshed-fallback/stdlib/_decimal.pyi +9 -6
  7. package/dist/typeshed-fallback/stdlib/_interpqueues.pyi +24 -36
  8. package/dist/typeshed-fallback/stdlib/_interpreters.pyi +26 -71
  9. package/dist/typeshed-fallback/stdlib/_json.pyi +15 -11
  10. package/dist/typeshed-fallback/stdlib/_remote_debugging.pyi +355 -72
  11. package/dist/typeshed-fallback/stdlib/_socket.pyi +21 -21
  12. package/dist/typeshed-fallback/stdlib/_sqlite3.pyi +0 -15
  13. package/dist/typeshed-fallback/stdlib/_struct.pyi +39 -42
  14. package/dist/typeshed-fallback/stdlib/_thread.pyi +18 -14
  15. package/dist/typeshed-fallback/stdlib/array.pyi +8 -4
  16. package/dist/typeshed-fallback/stdlib/ast.pyi +9 -3
  17. package/dist/typeshed-fallback/stdlib/binascii.pyi +113 -10
  18. package/dist/typeshed-fallback/stdlib/builtins.pyi +260 -43
  19. package/dist/typeshed-fallback/stdlib/collections/__init__.pyi +12 -4
  20. package/dist/typeshed-fallback/stdlib/dataclasses.pyi +3 -1
  21. package/dist/typeshed-fallback/stdlib/datetime.pyi +93 -25
  22. package/dist/typeshed-fallback/stdlib/decimal.pyi +272 -208
  23. package/dist/typeshed-fallback/stdlib/faulthandler.pyi +29 -4
  24. package/dist/typeshed-fallback/stdlib/fcntl.pyi +6 -12
  25. package/dist/typeshed-fallback/stdlib/importlib/metadata/__init__.pyi +2 -0
  26. package/dist/typeshed-fallback/stdlib/json/encoder.pyi +2 -10
  27. package/dist/typeshed-fallback/stdlib/marshal.pyi +33 -2
  28. package/dist/typeshed-fallback/stdlib/math/__init__.pyi +15 -7
  29. package/dist/typeshed-fallback/stdlib/math/integer.pyi +43 -8
  30. package/dist/typeshed-fallback/stdlib/mmap.pyi +1 -1
  31. package/dist/typeshed-fallback/stdlib/os/__init__.pyi +60 -4
  32. package/dist/typeshed-fallback/stdlib/posixpath.pyi +14 -2
  33. package/dist/typeshed-fallback/stdlib/profiling/__init__.pyi +3 -3
  34. package/dist/typeshed-fallback/stdlib/profiling/sampling/__init__.pyi +17 -17
  35. package/dist/typeshed-fallback/stdlib/profiling/sampling/collector.pyi +25 -25
  36. package/dist/typeshed-fallback/stdlib/profiling/sampling/gecko_collector.pyi +111 -111
  37. package/dist/typeshed-fallback/stdlib/profiling/sampling/heatmap_collector.pyi +24 -24
  38. package/dist/typeshed-fallback/stdlib/profiling/sampling/jsonl_collector.pyi +15 -15
  39. package/dist/typeshed-fallback/stdlib/profiling/sampling/pstats_collector.pyi +17 -17
  40. package/dist/typeshed-fallback/stdlib/profiling/sampling/stack_collector.pyi +39 -39
  41. package/dist/typeshed-fallback/stdlib/profiling/sampling/string_table.pyi +5 -5
  42. package/dist/typeshed-fallback/stdlib/profiling/tracing.pyi +9 -9
  43. package/dist/typeshed-fallback/stdlib/pyexpat/__init__.pyi +24 -18
  44. package/dist/typeshed-fallback/stdlib/re.pyi +18 -3
  45. package/dist/typeshed-fallback/stdlib/select.pyi +2 -2
  46. package/dist/typeshed-fallback/stdlib/signal.pyi +1 -1
  47. package/dist/typeshed-fallback/stdlib/sqlite3/__init__.pyi +28 -5
  48. package/dist/typeshed-fallback/stdlib/sys/__init__.pyi +42 -4
  49. package/dist/typeshed-fallback/stdlib/types.pyi +44 -14
  50. package/dist/typeshed-fallback/stdlib/unicodedata.pyi +27 -9
  51. package/dist/typeshed-fallback/stdlib/urllib/parse.pyi +132 -6
  52. package/dist/typeshed-fallback/stdlib/winreg.pyi +5 -0
  53. package/dist/typeshed-fallback/stdlib/xml/utils.pyi +2 -2
  54. package/dist/typeshed-fallback/stdlib/zlib.pyi +34 -2
  55. package/package.json +1 -1
@@ -110,12 +110,14 @@ class Decimal:
110
110
  ...
111
111
  def compare(self, other: _Decimal, context: Context | None = None) -> Decimal:
112
112
  """
113
- Compare self to other. Return a decimal value:
113
+ Compare self to other.
114
114
 
115
- a or b is a NaN ==> Decimal('NaN')
116
- a < b ==> Decimal('-1')
117
- a == b ==> Decimal('0')
118
- a > b ==> Decimal('1')
115
+ Return a decimal value:
116
+
117
+ a or b is a NaN ==> Decimal('NaN')
118
+ a < b ==> Decimal('-1')
119
+ a == b ==> Decimal('0')
120
+ a > b ==> Decimal('1')
119
121
  """
120
122
  ...
121
123
  def __hash__(self) -> int:
@@ -126,21 +128,23 @@ class Decimal:
126
128
  ...
127
129
  def as_integer_ratio(self) -> tuple[int, int]:
128
130
  """
129
- Decimal.as_integer_ratio() -> (int, int)
131
+ Return a pair of integers whose ratio is exactly equal to the original.
130
132
 
131
- Return a pair of integers, whose ratio is exactly equal to the original
132
- Decimal and with a positive denominator. The ratio is in lowest terms.
133
+ The ratio is in lowest terms and with a positive denominator.
133
134
  Raise OverflowError on infinities and a ValueError on NaNs.
134
135
  """
135
136
  ...
136
137
  def to_eng_string(self, context: Context | None = None) -> str:
137
138
  """
138
- Convert to an engineering-type string. Engineering notation has an exponent
139
- which is a multiple of 3, so there are up to 3 digits left of the decimal
140
- place. For example, Decimal('123E+1') is converted to Decimal('1.23E+3').
139
+ Convert to an engineering-type string.
140
+
141
+ Engineering notation has an exponent which is a multiple of 3, so
142
+ there are up to 3 digits left of the decimal place. For example,
143
+ Decimal('123E+1') is converted to Decimal('1.23E+3').
141
144
 
142
- The value of context.capitals determines whether the exponent sign is lower
143
- or upper case. Otherwise, the context does not affect the operation.
145
+ The value of context.capitals determines whether the exponent sign
146
+ is lower or upper case. Otherwise, the context does not affect the
147
+ operation.
144
148
  """
145
149
  ...
146
150
  def __abs__(self) -> Decimal:
@@ -214,11 +218,13 @@ class Decimal:
214
218
  ...
215
219
  def remainder_near(self, other: _Decimal, context: Context | None = None) -> Decimal:
216
220
  """
217
- Return the remainder from dividing self by other. This differs from
218
- self % other in that the sign of the remainder is chosen so as to minimize
219
- its absolute value. More precisely, the return value is self - n * other
220
- where n is the integer nearest to the exact value of self / other, and
221
- if two integers are equally near then the even one is chosen.
221
+ Return the remainder from dividing self by other.
222
+
223
+ This differs from self % other in that the sign of the remainder is
224
+ chosen so as to minimize its absolute value. More precisely, the
225
+ return value is self - n * other where n is the integer nearest to
226
+ the exact value of self / other, and if two integers are equally
227
+ near then the even one is chosen.
222
228
 
223
229
  If the result is zero then its sign will be the sign of self.
224
230
  """
@@ -229,7 +235,9 @@ class Decimal:
229
235
  def __int__(self) -> int:
230
236
  """int(self)"""
231
237
  ...
232
- def __trunc__(self) -> int: ...
238
+ def __trunc__(self) -> int:
239
+ """Return the Integral closest to x between 0 and x."""
240
+ ...
233
241
  @property
234
242
  def real(self) -> Decimal: ...
235
243
  @property
@@ -237,19 +245,31 @@ class Decimal:
237
245
  def conjugate(self) -> Decimal:
238
246
  """Return self."""
239
247
  ...
240
- def __complex__(self) -> complex: ...
248
+ def __complex__(self) -> complex:
249
+ """Convert this value to exact type complex."""
250
+ ...
241
251
 
242
252
  @overload
243
- def __round__(self) -> int: ...
253
+ def __round__(self) -> int:
254
+ """Return the Integral closest to self, rounding half toward even."""
255
+ ...
244
256
  @overload
245
- def __round__(self, ndigits: int, /) -> Decimal: ...
257
+ def __round__(self, ndigits: int, /) -> Decimal:
258
+ """Return the Integral closest to self, rounding half toward even."""
259
+ ...
246
260
 
247
- def __floor__(self) -> int: ...
248
- def __ceil__(self) -> int: ...
261
+ def __floor__(self) -> int:
262
+ """Return the floor as an Integral."""
263
+ ...
264
+ def __ceil__(self) -> int:
265
+ """Return the ceiling as an Integral."""
266
+ ...
249
267
  def fma(self, other: _Decimal, third: _Decimal, context: Context | None = None) -> Decimal:
250
268
  """
251
- Fused multiply-add. Return self*other+third with no rounding of the
252
- intermediate product self*other.
269
+ Fused multiply-add.
270
+
271
+ Return self*other+third with no rounding of the intermediate product
272
+ self*other.
253
273
 
254
274
  >>> Decimal(2).fma(3, 5)
255
275
  Decimal('11')
@@ -260,92 +280,110 @@ class Decimal:
260
280
  ...
261
281
  def normalize(self, context: Context | None = None) -> Decimal:
262
282
  """
263
- Normalize the number by stripping the rightmost trailing zeros and
264
- converting any result equal to Decimal('0') to Decimal('0e0'). Used
265
- for producing canonical values for members of an equivalence class.
266
- For example, Decimal('32.100') and Decimal('0.321000e+2') both normalize
267
- to the equivalent value Decimal('32.1').
283
+ Normalize the number by stripping trailing 0s
284
+
285
+ This also change anything equal to 0 to 0e0. Used for producing
286
+ canonical values for members of an equivalence class. For example,
287
+ Decimal('32.100') and Decimal('0.321000e+2') both normalize to
288
+ the equivalent value Decimal('32.1').
268
289
  """
269
290
  ...
270
291
  def quantize(self, exp: _Decimal, rounding: str | None = None, context: Context | None = None) -> Decimal:
271
292
  """
272
- Return a value equal to the first operand after rounding and having the
273
- exponent of the second operand.
293
+ Quantize *self* so its exponent is the same as that of *exp*.
294
+
295
+ Return a value equal to *self* after rounding, with the exponent
296
+ of *exp*.
274
297
 
275
298
  >>> Decimal('1.41421356').quantize(Decimal('1.000'))
276
299
  Decimal('1.414')
277
300
 
278
- Unlike other operations, if the length of the coefficient after the quantize
279
- operation would be greater than precision, then an InvalidOperation is signaled.
280
- This guarantees that, unless there is an error condition, the quantized exponent
281
- is always equal to that of the right-hand operand.
301
+ Unlike other operations, if the length of the coefficient after the
302
+ quantize operation would be greater than precision, then an
303
+ InvalidOperation is signaled. This guarantees that, unless there
304
+ is an error condition, the quantized exponent is always equal to
305
+ that of the right-hand operand.
282
306
 
283
- Also unlike other operations, quantize never signals Underflow, even if the
284
- result is subnormal and inexact.
307
+ Also unlike other operations, quantize never signals Underflow, even
308
+ if the result is subnormal and inexact.
285
309
 
286
- If the exponent of the second operand is larger than that of the first, then
287
- rounding may be necessary. In this case, the rounding mode is determined by the
288
- rounding argument if given, else by the given context argument; if neither
289
- argument is given, the rounding mode of the current thread's context is used.
310
+ If the exponent of the second operand is larger than that of the
311
+ first, then rounding may be necessary. In this case, the rounding
312
+ mode is determined by the rounding argument if given, else by the
313
+ given context argument; if neither argument is given, the rounding
314
+ mode of the current thread's context is used.
290
315
  """
291
316
  ...
292
317
  def same_quantum(self, other: _Decimal, context: Context | None = None) -> bool:
293
318
  """
294
- Test whether self and other have the same exponent or whether both are NaN.
319
+ Test whether self and other have the same exponent or both are NaN.
295
320
 
296
- This operation is unaffected by context and is quiet: no flags are changed
297
- and no rounding is performed. As an exception, the C version may raise
298
- InvalidOperation if the second operand cannot be converted exactly.
321
+ This operation is unaffected by context and is quiet: no flags are
322
+ changed and no rounding is performed. As an exception, the C version
323
+ may raise InvalidOperation if the second operand cannot be converted
324
+ exactly.
299
325
  """
300
326
  ...
301
327
  def to_integral_exact(self, rounding: str | None = None, context: Context | None = None) -> Decimal:
302
328
  """
303
- Round to the nearest integer, signaling Inexact or Rounded as appropriate if
304
- rounding occurs. The rounding mode is determined by the rounding parameter
305
- if given, else by the given context. If neither parameter is given, then the
306
- rounding mode of the current default context is used.
329
+ Round to the nearest integer.
330
+
331
+ This method signals Inexact or Rounded as appropriate if rounding
332
+ occurs. The rounding mode is determined by the rounding parameter
333
+ if given, else by the given context. If neither parameter is given,
334
+ then the rounding mode of the current default context is used.
307
335
  """
308
336
  ...
309
337
  def to_integral_value(self, rounding: str | None = None, context: Context | None = None) -> Decimal:
310
338
  """
311
- Round to the nearest integer without signaling Inexact or Rounded. The
312
- rounding mode is determined by the rounding parameter if given, else by
313
- the given context. If neither parameter is given, then the rounding mode
314
- of the current default context is used.
339
+ Round to the nearest integer without signaling Inexact or Rounded.
340
+
341
+ The rounding mode is determined by the rounding parameter if given,
342
+ else by the given context. If neither parameter is given, then the
343
+ rounding mode of the current default context is used.
315
344
  """
316
345
  ...
317
346
  def to_integral(self, rounding: str | None = None, context: Context | None = None) -> Decimal:
318
347
  """
319
- Identical to the to_integral_value() method. The to_integral() name has been
320
- kept for compatibility with older versions.
348
+ Identical to the to_integral_value() method.
349
+
350
+ The to_integral() name has been kept for compatibility with older
351
+ versions.
321
352
  """
322
353
  ...
323
354
  def sqrt(self, context: Context | None = None) -> Decimal:
324
355
  """
325
- Return the square root of the argument to full precision. The result is
326
- correctly rounded using the ROUND_HALF_EVEN rounding mode.
356
+ Return the square root of the argument to full precision.
357
+
358
+ The result is correctly rounded using the ROUND_HALF_EVEN rounding
359
+ mode.
327
360
  """
328
361
  ...
329
362
  def max(self, other: _Decimal, context: Context | None = None) -> Decimal:
330
363
  """
331
- Maximum of self and other. If one operand is a quiet NaN and the other is
332
- numeric, the numeric operand is returned.
364
+ Maximum of self and other.
365
+
366
+ If one operand is a quiet NaN and the other is numeric, the numeric
367
+ operand is returned.
333
368
  """
334
369
  ...
335
370
  def min(self, other: _Decimal, context: Context | None = None) -> Decimal:
336
371
  """
337
- Minimum of self and other. If one operand is a quiet NaN and the other is
338
- numeric, the numeric operand is returned.
372
+ Minimum of self and other.
373
+
374
+ If one operand is a quiet NaN and the other is numeric, the numeric
375
+ operand is returned.
339
376
  """
340
377
  ...
341
378
  def adjusted(self) -> int:
342
- """Return the adjusted exponent of the number. Defined as exp + digits - 1."""
379
+ """Return the adjusted exponent (exp + digits - 1) of the number."""
343
380
  ...
344
381
  def canonical(self) -> Decimal:
345
382
  """
346
- Return the canonical encoding of the argument. Currently, the encoding
347
- of a Decimal instance is always canonical, so this operation returns its
348
- argument unchanged.
383
+ Return the canonical encoding of the argument.
384
+
385
+ Currently, the encoding of a Decimal instance is always canonical,
386
+ so this operation returns its argument unchanged.
349
387
  """
350
388
  ...
351
389
  def compare_signal(self, other: _Decimal, context: Context | None = None) -> Decimal:
@@ -353,100 +391,103 @@ class Decimal:
353
391
  ...
354
392
  def compare_total(self, other: _Decimal, context: Context | None = None) -> Decimal:
355
393
  """
356
- Compare two operands using their abstract representation rather than
357
- their numerical value. Similar to the compare() method, but the result
358
- gives a total ordering on Decimal instances. Two Decimal instances with
359
- the same numeric value but different representations compare unequal
360
- in this ordering:
394
+ Compare two operands using their abstract representation.
395
+
396
+ Similar to the compare() method, but the result gives a total
397
+ ordering on Decimal instances. Two Decimal instances with the same
398
+ numeric value but different representations compare unequal in this
399
+ ordering:
361
400
 
362
401
  >>> Decimal('12.0').compare_total(Decimal('12'))
363
402
  Decimal('-1')
364
403
 
365
- Quiet and signaling NaNs are also included in the total ordering. The result
366
- of this function is Decimal('0') if both operands have the same representation,
367
- Decimal('-1') if the first operand is lower in the total order than the second,
368
- and Decimal('1') if the first operand is higher in the total order than the
369
- second operand. See the specification for details of the total order.
404
+ Quiet and signaling NaNs are also included in the total ordering.
405
+ The result of this function is Decimal('0') if both operands have
406
+ the same representation, Decimal('-1') if the first operand is lower
407
+ in the total order than the second, and Decimal('1') if the first
408
+ operand is higher in the total order than the second operand. See
409
+ the specification for details of the total order.
370
410
 
371
- This operation is unaffected by context and is quiet: no flags are changed
372
- and no rounding is performed. As an exception, the C version may raise
373
- InvalidOperation if the second operand cannot be converted exactly.
411
+ This operation is unaffected by context and is quiet: no flags are
412
+ changed and no rounding is performed. As an exception, the C
413
+ version may raise InvalidOperation if the second operand cannot be
414
+ converted exactly.
374
415
  """
375
416
  ...
376
417
  def compare_total_mag(self, other: _Decimal, context: Context | None = None) -> Decimal:
377
418
  """
378
- Compare two operands using their abstract representation rather than their
379
- value as in compare_total(), but ignoring the sign of each operand.
419
+ As compare_total(), but ignores the sign of each operand.
380
420
 
381
- x.compare_total_mag(y) is equivalent to x.copy_abs().compare_total(y.copy_abs()).
421
+ x.compare_total_mag(y) is equivalent to
422
+ x.copy_abs().compare_total(y.copy_abs()).
382
423
 
383
- This operation is unaffected by context and is quiet: no flags are changed
384
- and no rounding is performed. As an exception, the C version may raise
385
- InvalidOperation if the second operand cannot be converted exactly.
424
+ This operation is unaffected by context and is quiet: no flags are
425
+ changed and no rounding is performed. As an exception, the C version
426
+ may raise InvalidOperation if the second operand cannot be converted
427
+ exactly.
386
428
  """
387
429
  ...
388
430
  def copy_abs(self) -> Decimal:
389
431
  """
390
- Return the absolute value of the argument. This operation is unaffected by
391
- context and is quiet: no flags are changed and no rounding is performed.
432
+ Return the absolute value of the argument.
433
+
434
+ This operation is unaffected by context and is quiet: no flags are
435
+ changed and no rounding is performed.
392
436
  """
393
437
  ...
394
438
  def copy_negate(self) -> Decimal:
395
439
  """
396
- Return the negation of the argument. This operation is unaffected by context
397
- and is quiet: no flags are changed and no rounding is performed.
440
+ Return the negation of the argument.
441
+
442
+ This operation is unaffected by context and is quiet: no flags are
443
+ changed and no rounding is performed.
398
444
  """
399
445
  ...
400
446
  def copy_sign(self, other: _Decimal, context: Context | None = None) -> Decimal:
401
447
  """
402
- Return a copy of the first operand with the sign set to be the same as the
403
- sign of the second operand. For example:
448
+ Return a copy of *self* with the sign of *other*.
449
+
450
+ For example:
404
451
 
405
452
  >>> Decimal('2.3').copy_sign(Decimal('-1.5'))
406
453
  Decimal('-2.3')
407
454
 
408
- This operation is unaffected by context and is quiet: no flags are changed
409
- and no rounding is performed. As an exception, the C version may raise
410
- InvalidOperation if the second operand cannot be converted exactly.
455
+ This operation is unaffected by context and is quiet: no flags are
456
+ changed and no rounding is performed. As an exception, the C version
457
+ may raise InvalidOperation if the second operand cannot be converted
458
+ exactly.
411
459
  """
412
460
  ...
413
461
  def exp(self, context: Context | None = None) -> Decimal:
414
462
  """
415
- Return the value of the (natural) exponential function e**x at the given
416
- number. The function always uses the ROUND_HALF_EVEN mode and the result
417
- is correctly rounded.
463
+ Return the value of the (natural) exponential function e**x.
464
+
465
+ The function always uses the ROUND_HALF_EVEN mode and the result is
466
+ correctly rounded.
418
467
  """
419
468
  ...
420
469
  def is_canonical(self) -> bool:
421
470
  """
422
- Return True if the argument is canonical and False otherwise. Currently,
423
- a Decimal instance is always canonical, so this operation always returns
424
- True.
471
+ Return True if the argument is canonical and False otherwise.
472
+
473
+ Currently, a Decimal instance is always canonical, so this operation
474
+ always returns True.
425
475
  """
426
476
  ...
427
477
  def is_finite(self) -> bool:
428
- """
429
- Return True if the argument is a finite number, and False if the argument
430
- is infinite or a NaN.
431
- """
478
+ """Return True if the argument is a finite number, and False otherwise."""
432
479
  ...
433
480
  def is_infinite(self) -> bool:
434
- """
435
- Return True if the argument is either positive or negative infinity and
436
- False otherwise.
437
- """
481
+ """Return True if the argument is infinite, and False otherwise."""
438
482
  ...
439
483
  def is_nan(self) -> bool:
440
- """
441
- Return True if the argument is a (quiet or signaling) NaN and False
442
- otherwise.
443
- """
484
+ """Return True if the argument is a (quiet or signaling) NaN, else False."""
444
485
  ...
445
486
  def is_normal(self, context: Context | None = None) -> bool:
446
487
  """
447
- Return True if the argument is a normal finite non-zero number with an
448
- adjusted exponent greater than or equal to Emin. Return False if the
449
- argument is zero, subnormal, infinite or a NaN.
488
+ Return True if the argument is a normal number and False otherwise.
489
+
490
+ Normal number is a finite nonzero number, which is not subnormal.
450
491
  """
451
492
  ...
452
493
  def is_qnan(self) -> bool:
@@ -455,6 +496,7 @@ class Decimal:
455
496
  def is_signed(self) -> bool:
456
497
  """
457
498
  Return True if the argument has a negative sign and False otherwise.
499
+
458
500
  Note that both zeros and NaNs can carry signs.
459
501
  """
460
502
  ...
@@ -463,35 +505,38 @@ class Decimal:
463
505
  ...
464
506
  def is_subnormal(self, context: Context | None = None) -> bool:
465
507
  """
466
- Return True if the argument is subnormal, and False otherwise. A number is
467
- subnormal if it is non-zero, finite, and has an adjusted exponent less
468
- than Emin.
508
+ Return True if the argument is subnormal, and False otherwise.
509
+
510
+ A number is subnormal if it is non-zero, finite, and has an adjusted
511
+ exponent less than Emin.
469
512
  """
470
513
  ...
471
514
  def is_zero(self) -> bool:
472
- """
473
- Return True if the argument is a (positive or negative) zero and False
474
- otherwise.
475
- """
515
+ """Return True if the argument is a zero and False otherwise."""
476
516
  ...
477
517
  def ln(self, context: Context | None = None) -> Decimal:
478
518
  """
479
- Return the natural (base e) logarithm of the operand. The function always
480
- uses the ROUND_HALF_EVEN mode and the result is correctly rounded.
519
+ Return the natural (base e) logarithm of the operand.
520
+
521
+ The function always uses the ROUND_HALF_EVEN mode and the result is
522
+ correctly rounded.
481
523
  """
482
524
  ...
483
525
  def log10(self, context: Context | None = None) -> Decimal:
484
526
  """
485
- Return the base ten logarithm of the operand. The function always uses the
486
- ROUND_HALF_EVEN mode and the result is correctly rounded.
527
+ Return the base ten logarithm of the operand.
528
+
529
+ The function always uses the ROUND_HALF_EVEN mode and the result is
530
+ correctly rounded.
487
531
  """
488
532
  ...
489
533
  def logb(self, context: Context | None = None) -> Decimal:
490
534
  """
491
- For a non-zero number, return the adjusted exponent of the operand as a
492
- Decimal instance. If the operand is a zero, then Decimal('-Infinity') is
493
- returned and the DivisionByZero condition is raised. If the operand is
494
- an infinity then Decimal('Infinity') is returned.
535
+ Return the adjusted exponent of the operand as a Decimal instance.
536
+
537
+ If the operand is a zero, then Decimal('-Infinity') is returned and
538
+ the DivisionByZero condition is raised. If the operand is an
539
+ infinity then Decimal('Infinity') is returned.
495
540
  """
496
541
  ...
497
542
  def logical_and(self, other: _Decimal, context: Context | None = None) -> Decimal:
@@ -512,7 +557,7 @@ class Decimal:
512
557
  """
513
558
  Applies an 'or' operation between self and other's digits.
514
559
 
515
- Both self and other must be logical numbers.
560
+ Both self and other must be logical numbers.
516
561
  """
517
562
  ...
518
563
  def logical_xor(self, other: _Decimal, context: Context | None = None) -> Decimal:
@@ -523,96 +568,99 @@ class Decimal:
523
568
  """
524
569
  ...
525
570
  def max_mag(self, other: _Decimal, context: Context | None = None) -> Decimal:
526
- """
527
- Similar to the max() method, but the comparison is done using the absolute
528
- values of the operands.
529
- """
571
+ """As the max() method, but compares the absolute values of the operands."""
530
572
  ...
531
573
  def min_mag(self, other: _Decimal, context: Context | None = None) -> Decimal:
532
- """
533
- Similar to the min() method, but the comparison is done using the absolute
534
- values of the operands.
535
- """
574
+ """As the min() method, but compares the absolute values of the operands."""
536
575
  ...
537
576
  def next_minus(self, context: Context | None = None) -> Decimal:
538
- """
539
- Return the largest number representable in the given context (or in the
540
- current default context if no context is given) that is smaller than the
541
- given operand.
542
- """
577
+ """Returns the largest representable number smaller than itself."""
543
578
  ...
544
579
  def next_plus(self, context: Context | None = None) -> Decimal:
545
- """
546
- Return the smallest number representable in the given context (or in the
547
- current default context if no context is given) that is larger than the
548
- given operand.
549
- """
580
+ """Returns the smallest representable number larger than itself."""
550
581
  ...
551
582
  def next_toward(self, other: _Decimal, context: Context | None = None) -> Decimal:
552
583
  """
553
- If the two operands are unequal, return the number closest to the first
554
- operand in the direction of the second operand. If both operands are
555
- numerically equal, return a copy of the first operand with the sign set
556
- to be the same as the sign of the second operand.
584
+ Returns the number closest to self, in the direction towards other.
585
+
586
+ If the two operands are unequal, return the number closest to the
587
+ first operand in the direction of the second operand. If both
588
+ operands are numerically equal, return a copy of the first operand
589
+ with the sign set to be the same as the sign of the second operand.
557
590
  """
558
591
  ...
559
592
  def number_class(self, context: Context | None = None) -> str:
560
593
  """
561
- Return a string describing the class of the operand. The returned value
562
- is one of the following ten strings:
594
+ Return a string describing the class of the operand.
595
+
596
+ The returned value is one of the following ten strings:
563
597
 
564
598
  * '-Infinity', indicating that the operand is negative infinity.
565
- * '-Normal', indicating that the operand is a negative normal number.
566
- * '-Subnormal', indicating that the operand is negative and subnormal.
599
+ * '-Normal', indicating that the operand is a negative normal
600
+ number.
601
+ * '-Subnormal', indicating that the operand is negative and
602
+ subnormal.
567
603
  * '-Zero', indicating that the operand is a negative zero.
568
604
  * '+Zero', indicating that the operand is a positive zero.
569
- * '+Subnormal', indicating that the operand is positive and subnormal.
570
- * '+Normal', indicating that the operand is a positive normal number.
605
+ * '+Subnormal', indicating that the operand is positive and
606
+ subnormal.
607
+ * '+Normal', indicating that the operand is a positive normal
608
+ number.
571
609
  * '+Infinity', indicating that the operand is positive infinity.
572
- * 'NaN', indicating that the operand is a quiet NaN (Not a Number).
610
+ * 'NaN', indicating that the operand is a quiet NaN (Not a
611
+ Number).
573
612
  * 'sNaN', indicating that the operand is a signaling NaN.
574
613
  """
575
614
  ...
576
615
  def radix(self) -> Decimal:
577
616
  """
578
- Return Decimal(10), the radix (base) in which the Decimal class does
579
- all its arithmetic. Included for compatibility with the specification.
617
+ Return Decimal(10).
618
+
619
+ This is the radix (base) in which the Decimal class does all its
620
+ arithmetic. Included for compatibility with the specification.
580
621
  """
581
622
  ...
582
623
  def rotate(self, other: _Decimal, context: Context | None = None) -> Decimal:
583
624
  """
584
- Return the result of rotating the digits of the first operand by an amount
585
- specified by the second operand. The second operand must be an integer in
586
- the range -precision through precision. The absolute value of the second
587
- operand gives the number of places to rotate. If the second operand is
588
- positive then rotation is to the left; otherwise rotation is to the right.
589
- The coefficient of the first operand is padded on the left with zeros to
590
- length precision if necessary. The sign and exponent of the first operand are
591
- unchanged.
625
+ Returns a rotated copy of self's digits, value-of-other times.
626
+
627
+ The second operand must be an integer in the range -precision
628
+ through precision. The absolute value of the second operand gives
629
+ the number of places to rotate. If the second operand is positive
630
+ then rotation is to the left; otherwise rotation is to the right.
631
+ The coefficient of the first operand is padded on the left with
632
+ zeros to length precision if necessary. The sign and exponent of
633
+ the first operand are unchanged.
592
634
  """
593
635
  ...
594
636
  def scaleb(self, other: _Decimal, context: Context | None = None) -> Decimal:
595
637
  """
596
- Return the first operand with the exponent adjusted the second. Equivalently,
597
- return the first operand multiplied by 10**other. The second operand must be
598
- an integer.
638
+ Return the first operand with the exponent adjusted the second.
639
+
640
+ Equivalently, return the first operand multiplied by 10**other. The
641
+ second operand must be an integer.
599
642
  """
600
643
  ...
601
644
  def shift(self, other: _Decimal, context: Context | None = None) -> Decimal:
602
645
  """
603
- Return the result of shifting the digits of the first operand by an amount
604
- specified by the second operand. The second operand must be an integer in
605
- the range -precision through precision. The absolute value of the second
606
- operand gives the number of places to shift. If the second operand is
607
- positive, then the shift is to the left; otherwise the shift is to the
608
- right. Digits shifted into the coefficient are zeros. The sign and exponent
609
- of the first operand are unchanged.
646
+ Returns a shifted copy of self's digits, value-of-other times.
647
+
648
+ The second operand must be an integer in the range -precision
649
+ through precision. The absolute value of the second operand gives
650
+ the number of places to shift. If the second operand is positive,
651
+ then the shift is to the left; otherwise the shift is to the right.
652
+ Digits shifted into the coefficient are zeros. The sign and
653
+ exponent of the first operand are unchanged.
610
654
  """
611
655
  ...
612
- def __reduce__(self) -> tuple[type[Self], tuple[str]]: ...
656
+ def __reduce__(self) -> tuple[type[Self], tuple[str]]:
657
+ """Return state information for pickling."""
658
+ ...
613
659
  def __copy__(self) -> Self: ...
614
660
  def __deepcopy__(self, memo: Any, /) -> Self: ...
615
- def __format__(self, specifier: str, context: Context | None = None, /) -> str: ...
661
+ def __format__(self, specifier: str, context: Context | None = None, /) -> str:
662
+ """Formats the Decimal according to format_spec."""
663
+ ...
616
664
 
617
665
  @disjoint_base
618
666
  class Context:
@@ -655,27 +703,34 @@ class Context:
655
703
  __hash__: ClassVar[None] # type: ignore[assignment]
656
704
  def Etiny(self) -> int:
657
705
  """
658
- Return a value equal to Emin - prec + 1, which is the minimum exponent value
659
- for subnormal results. When underflow occurs, the exponent is set to Etiny.
706
+ Return a value equal to Emin - prec + 1.
707
+
708
+ This is the minimum exponent value for subnormal results. When
709
+ underflow occurs, the exponent is set to Etiny.
660
710
  """
661
711
  ...
662
712
  def Etop(self) -> int:
663
713
  """
664
- Return a value equal to Emax - prec + 1. This is the maximum exponent
665
- if the _clamp field of the context is set to 1 (IEEE clamp mode). Etop()
666
- must not be negative.
714
+ Return a value equal to Emax - prec + 1.
715
+
716
+ This is the maximum exponent if the _clamp field of the context is
717
+ set to 1 (IEEE clamp mode). Etop() must not be negative.
667
718
  """
668
719
  ...
669
720
  def create_decimal(self, num: _DecimalNew = "0", /) -> Decimal:
670
721
  """
671
- Create a new Decimal instance from num, using self as the context. Unlike the
672
- Decimal constructor, this function observes the context limits.
722
+ Create a new Decimal instance from num, using self as the context.
723
+
724
+ Unlike the Decimal constructor, this function observes the context
725
+ limits.
673
726
  """
674
727
  ...
675
728
  def create_decimal_from_float(self, f: float, /) -> Decimal:
676
729
  """
677
- Create a new Decimal instance from float f. Unlike the Decimal.from_float()
678
- class method, this function observes the context limits.
730
+ Create a new Decimal instance from float f.
731
+
732
+ Unlike the Decimal.from_float() class method, this function observes
733
+ the context limits.
679
734
  """
680
735
  ...
681
736
  def abs(self, x: _Decimal, /) -> Decimal:
@@ -875,8 +930,9 @@ class Context:
875
930
  ...
876
931
  def minus(self, x: _Decimal, /) -> Decimal:
877
932
  """
878
- Minus corresponds to the unary prefix minus operator in Python, but applies
879
- the context to the result.
933
+ Minus corresponds to unary prefix minus in Python.
934
+
935
+ This operation applies the context to the result.
880
936
  """
881
937
  ...
882
938
  def multiply(self, x: _Decimal, y: _Decimal, /) -> Decimal:
@@ -899,25 +955,29 @@ class Context:
899
955
  ...
900
956
  def plus(self, x: _Decimal, /) -> Decimal:
901
957
  """
902
- Plus corresponds to the unary prefix plus operator in Python, but applies
903
- the context to the result.
958
+ Plus corresponds to the unary prefix plus operator in Python.
959
+
960
+ This operation applies the context to the result.
904
961
  """
905
962
  ...
906
963
  def power(self, a: _Decimal, b: _Decimal, modulo: _Decimal | None = None) -> Decimal:
907
964
  """
908
- Compute a**b. If 'a' is negative, then 'b' must be integral. The result
909
- will be inexact unless 'a' is integral and the result is finite and can
910
- be expressed exactly in 'precision' digits. In the Python version the
911
- result is always correctly rounded, in the C version the result is almost
912
- always correctly rounded.
965
+ Compute a**b.
966
+
967
+ If 'a' is negative, then 'b' must be integral. The result will be
968
+ inexact unless 'a' is integral and the result is finite and can be
969
+ expressed exactly in 'precision' digits. In the Python version the
970
+ result is always correctly rounded, in the C version the result is
971
+ almost always correctly rounded.
913
972
 
914
- If modulo is given, compute (a**b) % modulo. The following restrictions
915
- hold:
973
+ If modulo is given, compute (a**b) % modulo. The following
974
+ restrictions hold:
916
975
 
917
976
  * all three arguments must be integral
918
977
  * 'b' must be nonnegative
919
978
  * at least one of 'a' or 'b' must be nonzero
920
- * modulo must be nonzero and less than 10**prec in absolute value
979
+ * modulo must be nonzero and less than 10**prec in absolute
980
+ value
921
981
  """
922
982
  ...
923
983
  def quantize(self, x: _Decimal, y: _Decimal, /) -> Decimal:
@@ -928,14 +988,18 @@ class Context:
928
988
  ...
929
989
  def remainder(self, x: _Decimal, y: _Decimal, /) -> Decimal:
930
990
  """
931
- Return the remainder from integer division. The sign of the result,
932
- if non-zero, is the same as that of the original dividend.
991
+ Return the remainder from integer division.
992
+
993
+ The sign of the result, if non-zero, is the same as that of the
994
+ original dividend.
933
995
  """
934
996
  ...
935
997
  def remainder_near(self, x: _Decimal, y: _Decimal, /) -> Decimal:
936
998
  """
937
- Return x - y * n, where n is the integer nearest the exact value of x / y
938
- (if the result is 0 then its sign will be the sign of x).
999
+ Return x - y * n.
1000
+
1001
+ Here n is the integer nearest the exact value of x / y (if the
1002
+ result is 0 then its sign will be the sign of x).
939
1003
  """
940
1004
  ...
941
1005
  def rotate(self, x: _Decimal, y: _Decimal, /) -> Decimal: