-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Feature] download zip #882
[Feature] download zip #882
Conversation
neurokit2/data/database.py
Outdated
import zipfile | ||
from pathlib import Path | ||
|
||
def download_zip(url, destination_path): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should we do this somewhat more "generic", like something like download_from_url()
and then there is an unzip=True
argument that triggers, if the content is detected to be a zipped file, automatically unzips it?
So that we could use that function for both zipped un non-zipped stuff? (although I'm not sure if there would be such a need)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah I just realized you meant downloading any files from a url and not just a zip. Yeah sure I can do that too (though I feel like then we should still have download_zip()
that calls download_from_url()
, since there are zip-specific functionalities in the function like removing the original zip file), but I have to go now, can get back to it in a few days probably
can revert if you'd like, sorry, thought I did this already
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## dev #882 +/- ##
==========================================
- Coverage 55.13% 55.01% -0.12%
==========================================
Files 298 299 +1
Lines 13956 13993 +37
==========================================
+ Hits 7694 7698 +4
- Misses 6262 6295 +33
☔ View full report in Codecov by Sentry. |
Looks good to me, should we merge? |
Description
This PR aims to allow for zip files to be automatically downloaded and extracted, as a first step towards automating the downloading and formatting of various datasets (see Tam-Pham/HRVStructure#2 (comment))
Proposed Changes
I added a
download_zip()
function to adatabase.py
file (was thinking that this could be where the refactored functions for downloading individual databases could be moved to within NeuroKit), and I used this function for the fantasia and mit arrhythmia databases.Let me know if you want me to change the naming (wasn't sure about
database.py
), and also if you have any thoughts on whether there should be automated tests for this (not sure if downloading entire datasets is a good idea with GitHub Actions)Checklist