-
Notifications
You must be signed in to change notification settings - Fork 14
style: fix E501, F401, E711 on mask, saveresults, selfcalibrate, and srxplanar.py #16
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
src/diffpy/srxplanar/mask.py
Outdated
| try: | ||
| rv = tifffile.imread(im) | ||
| except: | ||
| except ImportError: |
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.
To me, it seems like we are assuming that tifffile is imported properly, and that we are calling a function from that package inside the try block. So maybe OSError or ValueError would make sense here? Because we want to make sure any image loading errors are handled properly?
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.
Updated in new commits.
| rcParams["backend"] = "Qt4Agg" | ||
| try: | ||
| import PySide | ||
| import PySide # noqa: F401 |
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.
Why #noqa in these lines?
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.
Because flake8 gives F401 error here, but actually I think it is implicitly used in the next line rcParams["backend.qt4"] = "PySide". Therefore, we should not delete it, that's why I make #noqa here.
| try: | ||
| import matplotlib.pyplot as plt | ||
| import PyQt4 | ||
| import PyQt4 # noqa: F401 |
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.
This import seems safe to delete. By the way, I'm kind of nitpicking here because in general, we don't want to suppress any warnings or exclude any files if possible
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.
Have deleted it, see the new commit.
src/diffpy/srxplanar/mask.py
Outdated
| try: | ||
| rv = tifffile.imread(im) | ||
| except: | ||
| except ValueError: |
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, maybe include OSError as well? Should have mentioned that, sorry
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.
Have updated in the new commit.
|
@sbillinge Ready to review this one |
@zmx27 ready to review