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

Method _assign_hms

src/dateutil/parser/_parser.py:1040–1054  ·  view source on GitHub ↗
(self, res, value_repr, hms)

Source from the content-addressed store, hash-verified

1038 return hms_idx
1039
1040 def _assign_hms(self, res, value_repr, hms):
1041 # See GH issue #427, fixing float rounding
1042 value = self._to_decimal(value_repr)
1043
1044 if hms == 0:
1045 # Hour
1046 res.hour = int(value)
1047 if value % 1:
1048 res.minute = int(60*(value % 1))
1049
1050 elif hms == 1:
1051 (res.minute, res.second) = self._parse_min_sec(value)
1052
1053 elif hms == 2:
1054 (res.second, res.microsecond) = self._parsems(value_repr)
1055
1056 def _could_be_tzname(self, hour, tzname, tzoffset, token):
1057 return (hour is not None and

Callers 1

_parse_numeric_tokenMethod · 0.95

Calls 3

_to_decimalMethod · 0.95
_parse_min_secMethod · 0.95
_parsemsMethod · 0.95

Tested by

no test coverage detected