Repository navigation
test: native stacked OCR review — upper layer before parent merge - #17
Open
zehongye-gaga wants to merge 1 commit into
Open
zehongye-gaga wants to merge 1 commit into
zehongye-gaga wants to merge 1 commit into
Conversation
zehongye-gaga
marked this pull request as ready for review
November 1, 2026 12:32
There was a problem hiding this comment.
This review found 1 issue(s), including 1 blocking issue(s).
| return average(values) | ||
| if len(values) != len(weights): | ||
| raise ValueError("values and weights must have the same length") | ||
| return sum(value * weight for value, weight in zip(values, weights)) / sum(weights) |
There was a problem hiding this comment.
A zero total weight raises ZeroDivisionError instead of returning the promised 0. For example, weighted_average([10], [0]) and weighted_average([], []) both reach this division with a zero denominator. Compute the total weight first and return 0 when it is zero, preserving the existing None fallback and length validation.
Suggestion:
Suggested change
| return sum(value * weight for value, weight in zip(values, weights)) / sum(weights) | |
| total_weight = sum(weights) | |
| if total_weight == 0: | |
| return 0 | |
| return sum(value * weight for value, weight in zip(values, weights)) / total_weight |
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.
Dependent layer above #16, intentionally kept unmerged. Verify native GitHub stack membership and automatic OCR review after ready_for_review while #16 is still open. The weighted-average fixture intentionally contradicts its zero-weight contract so the review can demonstrate an inline finding on this layer. Test only; do not merge.
AI disclosure: prepared by OpenAI Codex (GPT-6).