Skip to content

Enable linting rules for S110: try-except-pass#495

Open
brianhelba wants to merge 1 commit intomainfrom
lint-except-pass
Open

Enable linting rules for S110: try-except-pass#495
brianhelba wants to merge 1 commit intomainfrom
lint-except-pass

Conversation

@brianhelba
Copy link
Copy Markdown
Member

No description provided.


if mode == "multi-otsu":
try:
with contextlib.suppress(ValueError):
Copy link
Copy Markdown
Member Author

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.


if mode == "multi-otsu":
try:
with contextlib.suppress(ValueError):
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The 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 np.percentile instead?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The 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.

Copy link
Copy Markdown
Member Author

@brianhelba brianhelba Apr 22, 2026

Choose a reason for hiding this comment

The 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.

@brianhelba brianhelba requested a review from BryonLewis April 22, 2026 20:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants