fix: forward delete_old in Yahoo data updates - #2335
Open
Rishabh Raj (aerraj) wants to merge 1 commit into
Open
Conversation
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.
Description
Add
delete_old: bool = Trueto the end ofRun.update_data_to_binand forward it toGetData.qlib_datawhen the base dataset needs to be downloaded. Document the option in the method and Yahoo collector README.The default remains unchanged.
--delete_old Falseskips deletion of existing data directories before archive extraction; it does not prevent archive entries from overwriting matching files. Complete local datasets still skip the base download.Motivation and Context
Fixes #1121.
Current main already forwards
exists_skip, butdelete_oldis still missing from the update method's signature and download call. This addresses the remaining part of the report without changing the existing download condition or update pipeline.How Has This Been Tested?
tests/test_yahoo_collector.py: default/explicit deletion settings, bothexists_skipvalues, CLI boolean parsing through Fire, and skipping the base download when data already exists. Downloads, normalization, binary writes, and index collection are mocked; calendar input uses a temporary directory.delete_oldkeyword).python -m pytest tests/test_yahoo_collector.py tests/misc/test_index_data.py tests/misc/test_sepdf.py -q: 20 passed, with one existing pandasSettingWithCopyWarningintest_sepdf.py.cd tests && python -m pytest test_yahoo_collector.py -q: 12 passed, matching the CI working directory.python -m black --check --diff -l 120 scripts/data_collector/yahoo/collector.py tests/test_yahoo_collector.py: passed.git diff --check: passed. The collector has four existing F841 warnings on lines 116, 146, 175, and 185; compared against upstream and confirmed unchanged.python scripts/data_collector/yahoo/collector.py update_data_to_bin --helplists--delete_oldwith defaultTrue.Environment: macOS arm64, Python 3.12.14, NumPy 1.26.4, pandas 2.3.3, editable source install.
Types of changes