fix: Resolve R1710 pylint inconsistent-return-statements errors#2101
Open
Ayush10 wants to merge 1 commit intomicrosoft:mainfrom
Open
fix: Resolve R1710 pylint inconsistent-return-statements errors#2101Ayush10 wants to merge 1 commit intomicrosoft:mainfrom
Ayush10 wants to merge 1 commit intomicrosoft:mainfrom
Conversation
Fix all 20 instances of R1710 (inconsistent-return-statements) pylint errors across the codebase. This enables the R1710 rule to be removed from the disabled list in the Makefile. Changes: - Add explicit `return None` for functions with conditional returns - Change `elif` to `else` where assert guarantees the condition - Add `raise ValueError` for invalid parameter values in switch-like functions - Fix generator function that mixed `return []` with `yield` Files modified: - qlib/backtest/profit_attribution.py - qlib/backtest/utils.py - qlib/contrib/data/utils/sepdf.py - qlib/contrib/model/pytorch_adarnn.py - qlib/contrib/report/analysis_model/analysis_model_performance.py - qlib/contrib/report/analysis_position/*.py (5 files) - qlib/contrib/strategy/optimizer/optimizer.py - qlib/data/cache.py - qlib/data/data.py - qlib/utils/index_data.py - qlib/workflow/exp.py - qlib/workflow/expm.py - qlib/workflow/online/update.py - qlib/workflow/record_temp.py Partial fix for microsoft#1007
Author
|
@microsoft-github-policy-service agree |
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.
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