flpit 0.4.0.dev2__py3-none-any.whl → 0.4.0.dev3__py3-none-any.whl

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.
flpit/core/linq.py CHANGED
@@ -290,8 +290,9 @@ def dotnet_context() -> AbstractContextManager[decimal.Context]:
290
290
  # 1. Create and configure pure Context object
291
291
  ctx = decimal.getcontext().copy()
292
292
  ctx.prec = max(ctx.prec, 29)
293
+ ctx.Emax = ctx.prec - 1
293
294
  ctx.traps[Overflow] = True
294
- ctx.traps[Inexact] = True
295
+ ctx.traps[Inexact] = False
295
296
 
296
297
  return decimal.localcontext(ctx)
297
298
 
@@ -1314,12 +1315,17 @@ class FlpIt[TItem](Iterable[TItem]):
1314
1315
  else:
1315
1316
  try:
1316
1317
  total += item
1317
- except (Overflow, Inexact):
1318
+ except Overflow:
1318
1319
  raise OverflowError(
1319
1320
  "System.OverflowException: Value was either too large or too small for a Decimal."
1320
1321
  )
1321
1322
  count += 1
1322
1323
 
1324
+ if isinstance(total, Decimal) and total.adjusted() >= decimal.getcontext().prec:
1325
+ raise OverflowError(
1326
+ "System.OverflowException: Value was either too large or too small for a Decimal."
1327
+ )
1328
+
1323
1329
  return total, count
1324
1330
 
1325
1331
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: flpit
3
- Version: 0.4.0.dev2
3
+ Version: 0.4.0.dev3
4
4
  Summary: Fluent LINQ for Python — flip your iterables
5
5
  Project-URL: Homepage, https://github.com/riemar/flpit
6
6
  Project-URL: Repository, https://github.com/riemar/flpit
@@ -13,8 +13,8 @@ flpit/core/_join.py,sha256=7kevlwH6KyH3Dq_Xtk0h9-5LtA9iTolhnhLleuHyN6w,217
13
13
  flpit/core/_lookup.py,sha256=v_FC9anm6OpbQqj3DmNwOW4ppxDZY9VY5MybAvsHJsk,1641
14
14
  flpit/core/_zip.py,sha256=lz5cbHcVV12UNyaOtrUd5jz-v_XI5xEp24KbnhAQZq8,259
15
15
  flpit/core/async_linq.py,sha256=kgswFZlFHUKB2Sdpzw4pTdVLaa-Rm-Dypt5CpIhgAUc,73450
16
- flpit/core/linq.py,sha256=K_XB7uhFdE_1iHiZnrYZuaGYpgxTbOrm6UUfc1_ecfU,83794
17
- flpit-0.4.0.dev2.dist-info/METADATA,sha256=3Lw-R3P_ZIZ-1ajnvIxwYr6uVTuQjOEIkqj_LKqW6LI,36857
18
- flpit-0.4.0.dev2.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
19
- flpit-0.4.0.dev2.dist-info/licenses/LICENSE,sha256=bi5Vg_YP3Oq3jaOMQT4b7WZu0NfBcZr-nRyOExUKJrQ,1063
20
- flpit-0.4.0.dev2.dist-info/RECORD,,
16
+ flpit/core/linq.py,sha256=Sq_C2qjT0MQQZ01qv9Vkbiaj8bTfeAsbflpyQQrdAcs,84048
17
+ flpit-0.4.0.dev3.dist-info/METADATA,sha256=Dl6ly1D9ET7Ud6DiM4S5SiuxbBot2dUrExcy4jYv0LE,36857
18
+ flpit-0.4.0.dev3.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
19
+ flpit-0.4.0.dev3.dist-info/licenses/LICENSE,sha256=bi5Vg_YP3Oq3jaOMQT4b7WZu0NfBcZr-nRyOExUKJrQ,1063
20
+ flpit-0.4.0.dev3.dist-info/RECORD,,