From 44bbface8e9d7082440bdabf63e515524d9c5f3f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 3 Oct 2023 05:58:56 +0000 Subject: [PATCH 1/4] Bump pylint from 2.17.7 to 3.0.0 Bumps [pylint](https://github.com/pylint-dev/pylint) from 2.17.7 to 3.0.0. - [Release notes](https://github.com/pylint-dev/pylint/releases) - [Commits](https://github.com/pylint-dev/pylint/compare/v2.17.7...v3.0.0) --- updated-dependencies: - dependency-name: pylint dependency-type: direct:production update-type: version-update:semver-major ... Signed-off-by: dependabot[bot] --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index 44014e1d9..e5f6b2a42 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -304,7 +304,7 @@ dev = [ "pip_check_reqs==2.5.3", "pydocstyle==6.3.0", "pyenchant==3.2.2", - "pylint==2.17.7", + "pylint==3.0.0", "pyright==1.1.329", "pyroma==4.2", "pytest-cov==4.1.0", From 9cc7074c8b8492d2501f3527f1faf967e911c7f9 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Tue, 3 Oct 2023 13:51:27 +0100 Subject: [PATCH 2/4] Update code to be in line with new pylint expectations --- src/mock_vws/target_raters.py | 12 +++++------- tests/mock_vws/test_requests_mock_usage.py | 6 ++++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/mock_vws/target_raters.py b/src/mock_vws/target_raters.py index 7f1cd786d..07c0bc070 100644 --- a/src/mock_vws/target_raters.py +++ b/src/mock_vws/target_raters.py @@ -11,12 +11,6 @@ import numpy as np from PIL import Image -# cv2 errors cannot be inferred without type stubs. -# See https://github.com/opencv/opencv/issues/14590. -_CV2_ERROR = ( - cv2.error # pyright: ignore[reportGeneralTypeIssues] # noqa: E501 # pylint: disable=no-member -) - @functools.cache def _get_brisque_target_tracking_rating(image_content: bytes) -> int: @@ -38,7 +32,11 @@ 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) - except (_CV2_ERROR, ValueError): + # pylint is not aware of `python-opencv`'s error hierarchy. + except ( # pylint: disable=catching-non-exception + cv2.error, + ValueError, + ): return 0 if math.isnan(score): return 0 diff --git a/tests/mock_vws/test_requests_mock_usage.py b/tests/mock_vws/test_requests_mock_usage.py index 8ba8d65bc..1ee0b58c7 100644 --- a/tests/mock_vws/test_requests_mock_usage.py +++ b/tests/mock_vws/test_requests_mock_usage.py @@ -270,7 +270,8 @@ def test_to_dict(high_quality_image: io.BytesIO) -> None: application_metadata=None, ) - (target,) = database.targets + assert len(database.targets) == 1 + target = next(iter(database.targets)) target_dict = target.to_dict() # The dictionary is JSON dump-able @@ -304,7 +305,8 @@ def test_to_dict_deleted(high_quality_image: io.BytesIO) -> None: vws_client.wait_for_target_processed(target_id=target_id) vws_client.delete_target(target_id=target_id) - (target,) = database.targets + assert len(database.targets) == 1 + target = next(iter(database.targets)) target_dict = target.to_dict() # The dictionary is JSON dump-able From 4a28580e5fcd0f0af3da0bb38273f26ff39652d2 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Tue, 3 Oct 2023 16:34:45 +0100 Subject: [PATCH 3/4] Try a different way of runnign pylint --- lint.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lint.mk b/lint.mk index 26cd58877..8b5678879 100644 --- a/lint.mk +++ b/lint.mk @@ -44,7 +44,7 @@ pip-missing-reqs: .PHONY: pylint pylint: - pylint *.py src/ tests/ docs/ ci/ + python -m pylint *.py src/ tests/ docs/ ci/ .PHONY: pyroma pyroma: From 420f723be67f2bfd7b2c331f2f81df9f1d074563 Mon Sep 17 00:00:00 2001 From: Adam Dangoor Date: Tue, 3 Oct 2023 19:34:17 +0100 Subject: [PATCH 4/4] Try pinning opencv python minimum version --- pyproject.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pyproject.toml b/pyproject.toml index a6c655e9a..07e16767c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -274,7 +274,7 @@ dependencies = [ "flask", "multipart", "numpy", - "opencv-python", + "opencv-python>=4.8.1.78", "pydantic-settings", "requests", "requests-mock",