Honor the download-flag contract across all datasets and harden the NEMAR sourcedata path - #1146
Open
bruAristimunha wants to merge 2 commits into
Open
Honor the download-flag contract across all datasets and harden the NEMAR sourcedata path#1146bruAristimunha wants to merge 2 commits into
bruAristimunha wants to merge 2 commits into
Conversation
…urcedata path Flag contract: - CacheConfig.overwrite_* now erases the cache even when use=False (previously a silent no-op with the default config); docstring and make() examples corrected to match behavior. - CompoundDataset.data_path forwards path/force_update/update_path/verbose to the wrapped dataset instead of dropping all four. - data_path implementations that ignored path or force_update now honor them: Weibo2014, alphawaves, bbci_eeg_fnirs (Shin2017 helpers), beetl, chailloux2020, dreyer2023, epfl, erpcore2021, hinss2021, huebner_llp, kaneshiro2015, lee2024, liu2024, mainsah2025, phmd_ml, physionet_mi, sosulski2019, speier2017, ssvep_mamem, stieger2021, zhang2025, zheng2020. - Kojima2024a/b data_path regains the standard signature; its narrowed form made BaseDataset.download() raise TypeError. - force_update also re-extracts stale zip folders; download_if_missing gains a force_update parameter as the choke point for manifest-based datasets. - New AST regression test enforces that every dataset's data_path uses path and force_update; new test proves overwrite works with use=False. NEMAR sourcedata: - download() falls back to the upstream host per failing subject instead of discarding the whole NEMAR batch; the unused batch helper is removed. - sourcedata_path resolves subjects through nemar_subject_template, matching the sibling BIDS path. - Transport/verification failures are no longer misreported as 'deposit publishes no sourcedata'; SelectionError keeps that message. - Manifest filenames are glob-escaped before being used as include patterns and local verification globs. - Stale nemar_sourcedata_include changelog claim replaced with the real provenance mechanism; nemar_dl/nemar_sourcedata_dl added to api.rst; docstrings no longer promise a NemarDownloadError for a missing nemar-py (that raises ImportError at import time). - Direct round-trip tests for set/get_download_provider (validation, normalization, None reset, env-var precedence, unknown-value fallback) and a per-subject fallback test.
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
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.
What
Two related fix-sets, landed together because they share the same download layer (
datasets/base.py,datasets/download.py):1. The download-flag contract — enforced for every dataset
An AST audit of every
data_pathimplementation found flags accepted but silently ignored across the catalogue:CacheConfig.overwrite_*was a no-op with the defaultuse=False—get_data(cache_config=dict(overwrite_raw=True))erased nothing. The docstring also claimedsave_*was ignored in that case while the code honored it. Overwrite now always erases; docs match behavior.CompoundDataset.data_pathdropped all four flags when delegating to the wrapped dataset.data_pathimplementations ignoredpathand/orforce_update(full list in the commit message) — including every recent dataset that resolved its storage dir viaget_dataset_path(SIGN, None)with the user'spathhardcoded away.data_pathsignature to(subject, path), soBaseDataset.download()raisedTypeError: unexpected keyword argument 'force_update'.force_updatenow also re-extracts stale archives;download_if_missinggains aforce_updateparameter as the choke point for the manifest-based datasets (dreyer2023, erpcore2021, kojima2024a/b, mainsah2025).update_pathis left as documented-deprecated (download.py: "Unused, kept for compatibility purpose").Guard rails: a new AST regression test fails CI if any dataset's
data_pathever ignorespathorforce_updateagain (exempt: the abstract base andFakeDataset), and a new cache test provesoverwrite_raw=True, use=Falseactually erases.2. NEMAR sourcedata hardening (follow-ups to #1139)
data_path, keeping what NEMAR already served. The now-unused batch helper_download_nemar_sourcedatais removed.sourcedata_pathresolves subjects throughnemar_subject_template, matching the sibling BIDS path (_download_nemar). Datasets likeErpCore2021({subject:03d}) previously sent the raw int to the provenance matcher.SelectionErrormaps to "deposit publishes no sourcedata"; transport/verification/S3 failures now report as download failures with the original error text.glob.escaped before being used as nemarincludepatterns and local verification globs, so upstream names containing[ ] * ?still match.nemar_sourcedata_includeattribute (never implemented) is replaced with the real provenance mechanism;nemar_dl/nemar_sourcedata_dlare registered inapi.rst; docstrings no longer promise aNemarDownloadErrorfor a missing nemar-py (that raisesImportErrorat import time).set_download_provider/get_download_provider(previously only exercised through monkeypatched seams): validation, case normalization,Nonereset, env-var precedence, unknown-value fallback — using the isolated MNE config fixture so nothing touches the real~/.mneconfig.Not in scope (deliberate, candidates for follow-ups)
provider=override / context manager instead of the persisted global (set_download_providerstill writes the MNE config).import nemar(todayimport moabbrequires nemar-py even withprovider="upstream").data_path/get_dataso a prefetch warms the evaluation path — needs a design decision on cache-location mapping.verbosein the pooch-based downloaders (progress bars are hardcoded; no slot to honor it).Test plan
pytest moabb/tests/test_download.py moabb/tests/test_datasets.py -k 'not doi'→ 1464 passedpytest moabb/tests/test_paradigms.py→ 102 passed;pytest moabb/tests/test_evaluations.py→ 93 passedpath+force_updatepre-commit run --all-files→ clean