Fix IGRA release time parsing - #1073
Open
Sanjays2402 wants to merge 3 commits into
Open
Conversation
Use the four-character HHMM field width when converting release times so both hour digits are preserved. Add a regression for 11:42.
Sanjays2402
requested review from
dcamron,
dopplershift and
lesserwhirls
as code owners
July 20, 2026 11:19
| """Return a function converting a string from MMMSS or HHMM to seconds.""" | ||
| def _ctime_strformat(val): | ||
| time = val.strip().zfill(5) | ||
| time = val.strip().zfill(5 if strformat == 'MMMSS' else 4) |
Member
There was a problem hiding this comment.
How about:
Suggested change
| time = val.strip().zfill(5 if strformat == 'MMMSS' else 4) | |
| time = val.strip().zfill(len(strformat)) |
Author
There was a problem hiding this comment.
Applied — zfill(len(strformat)) in 9be5b1b, which reads better than my conditional and stays right if another width shows up.
Sanity check on the HHMM path: 1142 -> 42120, " 942" -> 34920, 9999 -> nan. tests/test_igra2.py is 5 passed.
Member
There was a problem hiding this comment.
While here, can you also replace this with:
Suggested change
| raise ValueError(f'Unrecognized time format "{strformat}"') |
and also remove the import sys at the top?
Author
|
Good call — switched it to raise ValueError(f'Unrecognized time format "{strformat}"') so it surfaces the offending format string, and dropped the now-unused import sys (it was only used by the old sys.exit). IGRA tests still green. Thanks! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description Of Changes
Closes #982. IGRA release times in
HHMMformat now use their four-character field width, preserving both hour digits. The regression covers1142converting to 11:42 rather than 01:14.Checklist