MCPcopy Create free account
hub / github.com/dateutil/dateutil / _to_decimal

Method _to_decimal

src/dateutil/parser/_parser.py:1135–1146  ·  view source on GitHub ↗
(self, val)

Source from the content-addressed store, hash-verified

1133 return int(i), int(f.ljust(6, "0")[:6])
1134
1135 def _to_decimal(self, val):
1136 try:
1137 decimal_value = Decimal(val)
1138 # See GH 662, edge case, infinite value should not be converted
1139 # via `_to_decimal`
1140 if not decimal_value.is_finite():
1141 raise ValueError("Converted decimal value is infinite or NaN")
1142 except Exception as e:
1143 msg = "Could not convert %s to decimal" % val
1144 raise ValueError(msg) from e
1145 else:
1146 return decimal_value
1147
1148 # ------------------------------------------------------------------
1149 # Post-Parsing construction of datetime output. These are kept as

Callers 2

_parse_numeric_tokenMethod · 0.95
_assign_hmsMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected