From 336159ddefa194c9b998c867d92eefb1c5d5214b Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Sat, 30 Dec 2023 22:50:49 +0000 Subject: [PATCH] Suppress incorrect error which shows up on pylint + macOS --- src/mock_vws/target_raters.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/mock_vws/target_raters.py b/src/mock_vws/target_raters.py index e3e734844..bb4c82c9b 100644 --- a/src/mock_vws/target_raters.py +++ b/src/mock_vws/target_raters.py @@ -32,7 +32,12 @@ def _get_brisque_target_tracking_rating(image_content: bytes) -> int: with np.errstate(divide="ignore", invalid="ignore"): try: score = brisque_obj.score(img=image_array) + # See https://github.com/pylint-dev/pylint/issues/9332 + # for why we disable these warnings - pylint has trouble with + # cv2.error and behaves differently depending on the OS. + # pylint: disable=catching-non-exception, useless-suppression except (cv2.error, ValueError): + # pylint: enable=catching-non-exception, useless-suppression return 0 if math.isnan(score): return 0