Skip to content

Skip result lines with an undeclared report id - #40

Merged
btokarzewskidb merged 1 commit into
mainfrom
fix/unknown-report-id
Nov 17, 2026
Merged

btokarzewskidb merged 1 commit into
mainfrom
fix/unknown-report-id

Conversation

@btokarzewskidb

Copy link
Copy Markdown
Contributor

Fixes #39.

read_body wrote every result line straight to raw_outputs.outputs[frequency][line_id], so one line with an id not declared for the current frequency raised a bare KeyError and stopped the whole file loading. It now skips such lines and logs them at debug level (module logger db_eplusout_reader.processing.esofile_reader). No f-strings, so it stays IronPython 2.7-compatible.

Tests

New TestUndeclaredReportId in tests/test_esofile_reader.py:

  • an id that is not in the dictionary at all is skipped, and the declared variable still reads correctly;
  • an id declared hourly that appears after a daily step is skipped, and the daily variable still reads correctly.

Checked locally

  • uv run pytest tests -q: 234 passed
  • ruff check ., ruff format --check .: clean
  • pylint db_eplusout_reader: 10.00/10
  • The repro file from the issue now loads (3 environments).

Not run: the IronPython 2.7 path, which isn't installed here.

2 files changed, 41 insertions(+), 2 deletions(-)

🤖 Generated with Claude Code

A result line whose id has no output slot for the current frequency
raised a bare KeyError and stopped the whole file loading. Such lines
are now skipped and logged at debug level.

Fixes #39

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@btokarzewskidb
btokarzewskidb merged commit 3d010b2 into main Nov 17, 2026
6 checks passed
@btokarzewskidb
btokarzewskidb deleted the fix/unknown-report-id branch November 17, 2026 13:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

KeyError when an .eso data line has an undeclared report ID

1 participant