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

Method _parse_hms

src/dateutil/parser/_parser.py:1111–1127  ·  view source on GitHub ↗
(self, idx, tokens, info, hms_idx)

Source from the content-addressed store, hash-verified

1109 return (minute, second)
1110
1111 def _parse_hms(self, idx, tokens, info, hms_idx):
1112 # TODO: Is this going to admit a lot of false-positives for when we
1113 # just happen to have digits and "h", "m" or "s" characters in non-date
1114 # text? I guess hex hashes won't have that problem, but there's plenty
1115 # of random junk out there.
1116 if hms_idx is None:
1117 hms = None
1118 new_idx = idx
1119 elif hms_idx > idx:
1120 hms = info.hms(tokens[hms_idx])
1121 new_idx = hms_idx
1122 else:
1123 # Looking backwards, increment one.
1124 hms = info.hms(tokens[hms_idx]) + 1
1125 new_idx = idx
1126
1127 return (new_idx, hms)
1128
1129 # ------------------------------------------------------------------
1130 # Handling for individual tokens. These are kept as methods instead

Callers 1

_parse_numeric_tokenMethod · 0.95

Calls 1

hmsMethod · 0.80

Tested by

no test coverage detected