fix: Resolve R1710 pylint inconsistent-return-statements errors #2101
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.
Summary
Fix all 20 instances of
R1710(inconsistent-return-statements) pylint errors across the codebase.This is a partial fix for #1007 - focusing on a single, well-defined pylint rule that can be re-enabled after this PR.
Changes
return Nonefor functions with conditional returnseliftoelsewhereassertguarantees the conditionraise ValueErrorfor invalid parameter values in switch-like functionsreturn []withyieldFiles Modified (18 files)
qlib/backtest/profit_attribution.pyqlib/backtest/utils.pyqlib/contrib/data/utils/sepdf.pyqlib/contrib/model/pytorch_adarnn.pyqlib/contrib/report/analysis_model/analysis_model_performance.pyqlib/contrib/report/analysis_position/*.py(5 files)qlib/contrib/strategy/optimizer/optimizer.pyqlib/data/cache.pyqlib/data/data.pyqlib/utils/index_data.pyqlib/workflow/exp.pyqlib/workflow/expm.pyqlib/workflow/online/update.pyqlib/workflow/record_temp.pyTest Plan
pylint --enable=R1710 qlibnow passes (0 errors)Next Steps
After this PR is merged,
R1710can be removed from the disabled list in the Makefile.Partial fix for #1007