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

Method _to_decimal

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

Source from the content-addressed store, hash-verified

1139 return int(i), int(f.ljust(6, "0")[:6])
1140
1141 def _to_decimal(self, val):
1142 try:
1143 decimal_value = Decimal(val)
1144 # See GH 662, edge case, infinite value should not be converted
1145 # via `_to_decimal`
1146 if not decimal_value.is_finite():
1147 raise ValueError("Converted decimal value is infinite or NaN")
1148 except Exception as e:
1149 msg = "Could not convert %s to decimal" % val
1150 six.raise_from(ValueError(msg), e)
1151 else:
1152 return decimal_value
1153
1154 # ------------------------------------------------------------------
1155 # 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