MCPcopy Index your code
hub / github.com/python/cpython / RestrictedDecimal

Function RestrictedDecimal

Modules/_decimal/tests/deccheck.py:310–323  ·  view source on GitHub ↗
(value)

Source from the content-addressed store, hash-verified

308maxcontext.clamp = 0
309
310def RestrictedDecimal(value):
311 maxcontext.traps = copy(context.p.traps)
312 maxcontext.clear_flags()
313 if isinstance(value, str):
314 value = value.strip()
315 dec = maxcontext.create_decimal(value)
316 if maxcontext.flags[P.Inexact] or \
317 maxcontext.flags[P.Rounded] or \
318 maxcontext.flags[P.Clamped] or \
319 maxcontext.flags[P.InvalidOperation]:
320 return context.p._raise_error(P.InvalidOperation)
321 if maxcontext.flags[P.FloatOperation]:
322 context.p.flags[P.FloatOperation] = True
323 return dec
324
325
326# ======================================================================

Callers 1

convertFunction · 0.85

Calls 5

copyFunction · 0.90
clear_flagsMethod · 0.80
create_decimalMethod · 0.80
_raise_errorMethod · 0.80
stripMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…