Conversation
WalkthroughDetects column-formatted MCNP lines beginning with Changes
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Poem
🚥 Pre-merge checks | ✅ 2 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/f4enix/input/MCNPinput.py`:
- Around line 605-613: The code assumes previous_key is always set when handling
column-format continuations (PAT_COLUMN_FORMAT.match(card.lines[0]) branch),
which can raise if a fragment appears before any real card; modify the
conditional to guard that previous_key is not None and exists in new_cards
(e.g., check "previous_key is not None and previous_key in new_cards") before
accessing new_cards[previous_key], and if the guard fails either create a new
entry or skip/raise a controlled parse error; apply the same guard to the
similar merge at the later occurrence (the block around the other
PAT_COLUMN_FORMAT usage at ~line 628) and ensure subsequent calls to get_input()
and get_values() only run on a valid card object.
In `@tests/MCNPinput_test.py`:
- Line 928: The test assigns an unused variable inp2 from
Input.from_input(outfile) causing a lint F841; either remove the assignment or
replace inp2 with a throwaway name (e.g., _) to indicate the parse is executed
for side-effects only. Locate the call to Input.from_input in the test (the inp2
variable assignment) and change the left-hand variable to _ or drop the
assignment entirely so the parsing is still performed but no unused-variable
warning is emitted.
ℹ️ Review info
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (3)
src/f4enix/input/MCNPinput.pytests/MCNPinput_test.pytests/resources/input/column_format.i
Codecov Report✅ All modified and coverable lines are covered by tests.
... and 26 files with indirect coverage changes 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.
Inline comments:
In `@src/f4enix/input/ace.py`:
- Line 317: The call to np.trapezoid in the values.append(...) expression will
fail on NumPy <2.0.0; either add an explicit dependency numpy>=2.0.0 to
pyproject.toml, or add a local compatibility fallback before that call: resolve
a trapezoid function by checking getattr(np, "trapezoid", np.trapz) (or
try/except AttributeError) and then replace the direct np.trapezoid call with
the resolved function (e.g., trapezoid_fn(y, x) / (e - e_0)) so older NumPy
installations use np.trapz.
Description
Support column format in MCNP. Something like:
Type of change
Please select what type of change this is.
Checklist:
Summary by CodeRabbit
New Features
Tests
Refactor