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

Method _parse_hms

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

Source from the content-addressed store, hash-verified

1103 return (minute, second)
1104
1105 def _parse_hms(self, idx, tokens, info, hms_idx):
1106 # TODO: Is this going to admit a lot of false-positives for when we
1107 # just happen to have digits and "h", "m" or "s" characters in non-date
1108 # text? I guess hex hashes won't have that problem, but there's plenty
1109 # of random junk out there.
1110 if hms_idx is None:
1111 hms = None
1112 new_idx = idx
1113 elif hms_idx > idx:
1114 hms = info.hms(tokens[hms_idx])
1115 new_idx = hms_idx
1116 else:
1117 # Looking backwards, increment one.
1118 hms = info.hms(tokens[hms_idx]) + 1
1119 new_idx = idx
1120
1121 return (new_idx, hms)
1122
1123 # ------------------------------------------------------------------
1124 # 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