-
Notifications
You must be signed in to change notification settings - Fork 0
Ruff #300
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
Conversation
I'll go through this and annotate my # noqa s with which rule and justification . |
I've at least gone through and annotated the noqa. I did not justify them - I think it is a good goal to get rid of them, but that maybe these are acceptable-enough on a first pass. |
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.
There are two kind of comments that are repeated:
- the idiom of raising from another exception, which I believe is not what one wants in most cases. In my experience, one either re-raises the same exception or raises from None, with some information from the deeper exception. When removing the warning, one should decide which is the case.
- some unspecified
noqa
(although some might have been annotated in the last commit)
And I'm sorry @javierggt, I thought I'd set PGH004 back on and cleared all the nonspecific "noqa". I'll do another pass. (it looks like all the nonspecific noqa had been handled but it wasn't turned back on in the ruff.toml) |
So yes, in general I figured that the exception handling raising "from err" was the most benign way to just do what the code was doing before to just satisfy ruff with no code improvements. It is a different question I think about if we want to use the ruff formatting as a moment to re-evaluate all of the exception handling. |
I agree that raising from the previous exception carries the least impact. However, it is also the least preferred option and, realistically speaking, you will never come back to these. If it does not take a long time to figure out whether any of the other ways works, then now would be the time. It does not take long to go through them to get it right. I just did and made comments. There is only one I think can be raise from the previous exception, and is the one about an unspecified exception in starcheck. |
Though I do disagree a bit with "realistically speaking, you will never come back to these." - I would like to come back to these - it is part of the reason I just wanted to start with Ruff fixes so we could start to clean up all of this code. |
We can discuss what constitutes "useful" information any time. |
Description
Ruff mica.
These changes include one bugfix, one API change, a few minor changes in the way errors are raised, and includes adding a with context manager for a few h5 file opens.
Interface impacts
bugfix -
get_dark_cal_prop
s inmica.archive.aca_dark.dark_cal
now passest_ccd_ref
through to_get_dark_cal_image_props
. This may not have any utility, but it looks like it was a bug to just drop it on the floor after taking it as a function option.api change - function get_obs_temps in mica.report.report had a useless
outdir
argument that has been removed.Testing
Unit tests
Independent check of unit tests by [REVIEWER NAME]
Functional tests
No functional testing.