-
Notifications
You must be signed in to change notification settings - Fork 145
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
config_checker update and linting for C408,C419,C405, C409, E721,F401,E722 #560
base: dev
Are you sure you want to change the base?
Conversation
merging in more ruff errors
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.
The majority of these changes are good, but at least one is wrong, and some are behavior changes that should be evaluated.
It would also be nice to clean up the TODOs before merging.
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.
Looks good - let us know when you're done modifying that import_spec
--> try...except
statements and I think we can merge
@sezelt I'm good with these edits but will wait for your approval as well. |
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.
It seems there are at least 7 remaining TODOs added by this PR. I'd prefer not to add too many of these, so if there are cases where it's possible to either deduce or test what errors should be captured we should do that. I also marked a few minor comments that would be good to clean up.
@@ -840,7 +837,8 @@ def _integrate_disks(DP, maxima_x, maxima_y, maxima_int, int_window_radius=1): | |||
disks.append(np.average(disk)) | |||
try: | |||
disks = disks / max(disks) | |||
except: | |||
# TODO work out what exception would go here |
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.
TODO
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'd guess this is a ZeroDivisionError
, but I didn't want to guess I can remove the TODO if prefered.
py4DSTEM/io/filereaders/read_K2.py
Outdated
@@ -124,7 +124,8 @@ def __init__( | |||
# this may be wrong for binned data... in which case the reader doesn't work anyway! | |||
Q_Nx = gtg.allTags[".SI Image Tags.Acquisition.Parameters.Detector.height"] | |||
Q_Ny = gtg.allTags[".SI Image Tags.Acquisition.Parameters.Detector.width"] | |||
except: | |||
# TODO check this is the correct error type |
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.
TODO
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 can remove as Exception
will handle what we want, but I think it would be better to add the expected exception/s in the future, but I'm not familiar enough to check/test
@@ -100,7 +97,8 @@ def get_N_dataobjects(filepath, topgroup="4DSTEM_experiment"): | |||
N_pla = len(f[topgroup]["data/pointlistarrays"].keys()) | |||
try: | |||
N_coords = len(f[topgroup]["data/coordinates"].keys()) | |||
except: | |||
# TODO work out what exception will be raised ValueError, AttributeError, BS thinks KeyError |
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.
TODO
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 can remove
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.
Actually, I'm going to leave this as a TODO I don't want to break this and I'm not familiar enough with this part to test
@sezelt, I've resolved most of the changes you requested. I would prefer to leave the remaining TODOs as I think we should address them next time they're worked on, but I don't have enough familiarity with the code to be confident in guessing or being able to test. |
Hey @sezelt @alex-rakowski - This is a large set of small edits which will affect the linting PR and likely modifies many similar pieces of code. I think it's best to finish / resolve this PR first, then rebase PR#563 once this is merged, before continuing to work on that PR. Otherwise we're going to run into a lot of conflicts and work duplication. Could you please also make a checklist of the kinds modifications made in this PR? (E.g. modifying exceptions, etc). I'd also request modifying the PR name. |
This PR does the following: Updates In addition, it lints for the following errors:
|
I've tried to sync this with |
It seems to not pass its own tests anymore, though, so something is off with the updated flake8 config... |
Getting rid of some of the bare exceptions. Adding the correct Error if I could work it out otherwise using
Exception
.