-
Notifications
You must be signed in to change notification settings - Fork 1
Enable linting rules for S110: try-except-pass #495
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,5 +1,6 @@ | ||
| from __future__ import annotations | ||
|
|
||
| import contextlib | ||
| import logging | ||
| from pathlib import Path | ||
| from typing import Any | ||
|
|
@@ -102,10 +103,8 @@ def compute_auto_levels( # noqa: PLR0913 | |
| return [] | ||
|
|
||
| if mode == "multi-otsu": | ||
| try: | ||
| with contextlib.suppress(ValueError): | ||
|
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @BryonLewis Can you verify that the correct behavior on an exception is indeed to silently proceed to the end of the function and call
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'll test it tomorrow. There may be an argument for removing this whole contour extraction from the application. We were using it before to generate contours from spectrogram images for clearer delineation between values, but without some decent filtering (reduction in contour accuracy) and not knowing the size of the wav files, the loading times and data size could be too large to be generally useful. We have disabled this section of the conversion process from wav to spectrogram + metadata.
Member
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sure. That is indeed what the code did and still does. I just wondered if it was overly eager to suppress exceptions that should actually be allowed to cause a failure. |
||
| return threshold_multiotsu(valid, classes=multi_otsu_classes).tolist() | ||
| except Exception: | ||
| pass | ||
|
|
||
| if mode == "histogram": | ||
| return auto_histogram_levels( | ||
|
|
||
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.
Note, this uses a more specific exception, that seems likely to actually be raised by
threshold_multiotsu.