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

Method _assign_hms

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

Source from the content-addressed store, hash-verified

1032 return hms_idx
1033
1034 def _assign_hms(self, res, value_repr, hms):
1035 # See GH issue #427, fixing float rounding
1036 value = self._to_decimal(value_repr)
1037
1038 if hms == 0:
1039 # Hour
1040 res.hour = int(value)
1041 if value % 1:
1042 res.minute = int(60*(value % 1))
1043
1044 elif hms == 1:
1045 (res.minute, res.second) = self._parse_min_sec(value)
1046
1047 elif hms == 2:
1048 (res.second, res.microsecond) = self._parsems(value_repr)
1049
1050 def _could_be_tzname(self, hour, tzname, tzoffset, token):
1051 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