-
-
Notifications
You must be signed in to change notification settings - Fork 591
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
enabled passing of corrupt files to map #7018
Conversation
Thanks for the PR @hannahc243 and congrats on your first contribution ! 🥳 |
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.
Thanks for the PR! Some immediate thoughts:
- Don't add a "bad" test file to the repository, much less one that is named to look like a real file! Such an approach is bound to cause confusion and breakages, as you've already discovered with the unrelated unit test that you had to separately fix. Instead, define a pytest fixture that creates a temporary "bad" test file for use in the unit tests.
- Naming the keyword
silence_errors
makes me uneasy because it still emits warnings, so is definitely not silent. I'd probably name the keyword something likeskip_errors
, but others might have better suggestions.
Maybe |
I don't see the harm in a bad test file, I was the one who told them to add it, the filename I think we can work on. It would be nice to have a file that is from a failed download, that we can use easily. That unrelated unit test I don't think even needs to exist.
That |
I think it'd be of extremely limited value to have in the repository, but I'd probably be fine if the name were simply changed to something like
Well, then I additionally prefer to change the name of the keyword that already exists in the API. It doesn't make sense that a keyword called |
I was hoping you wouldn't say this but I agree. Would you be ok with this being punted to another PR? |
Yeah, punting is fine |
Co-authored-by: Alasdair Wilson <[email protected]>
sunpy/data/test/aia_lev1_211a_2022_03_30t17_21_21_63z_image_lev1.fits
Outdated
Show resolved
Hide resolved
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.
Thanks for this PR @hannahc243 !
Looks great, just two suggestions
if kwargs.get("silence_errors"): | ||
warn_user(msg) | ||
return [] | ||
raise OSError(msg) from e |
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 also add a message here to suggest to the user to use the silence_errors
keyword to skip over invalid files?
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.
I think this is worth adding to my follow up PR renaming the keyword.
Co-authored-by: Laura Hayes <[email protected]>
Thank you for the pull request @hannahc243! |
Fixes #3688 which allows passing of corrupt files to map