Fix/redundant return 478#502
Conversation
|
hey @param20h , this PR is under GSSoC 2026, kindly review it and lemme know if any changes are to be made! |
|
Hi @param20h, It looks like the I wanted to confirm that this failure is unrelated to the changes in this branch. This PR is strictly scoped to adding defensive The failure appears to be due to an intermittent CI environment timeout or an existing issue on the base branch. Since I don't have write permissions to trigger a workflow re-run on this repository, feel free to either restart the failed job or proceed with merging the changes directly. Thank you! |
🔗 Related Issue
Closes #478
📝 What does this PR do?
Simplifies the redundant conditional return logic at the end of the
generate_document_summaryfunction inapp/rag/summary_generator.py.The original code used a redundant ternary check (
return summary if summary else None) on a variable that was already safely evaluated. This has been refactored to use Python's idiomatic short-circuiting pattern (return summary or None), which maintains the strictstr | Nonereturn type while improving readability and adhering to clean-code standards.🗂️ Type of Change
🧪 How was this tested?
📸 Screenshots (if UI change)
N/A
No major risks. The logic handles both a valid string and falsy values (
""orNone) identically to the original code, but in a cleaner manner.✅ Self-Review Checklist
dev, notmainmainbranch or any HuggingFace deployment config