From cb9f0d0315f85d5d962d2cecf04e8b26bafbf43c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20Dupr=C3=A9?= Date: Sat, 13 Jul 2024 14:34:20 +0200 Subject: [PATCH 1/3] Use ruff check --- _cmake/clang_format.sh | 2 +- azure-pipelines.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/_cmake/clang_format.sh b/_cmake/clang_format.sh index 1134b607..b787eb22 100644 --- a/_cmake/clang_format.sh +++ b/_cmake/clang_format.sh @@ -1,7 +1,7 @@ #!/bin/bash clear echo "--ruff--" -ruff . +ruff check . echo "--cython-lint--" cython-lint . echo "--clang-format--" diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d9efe5dc..73d8d4b7 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -24,7 +24,7 @@ jobs: - script: pip install -r requirements-dev.txt displayName: 'Install Requirements dev' - script: | - ruff . + ruff check . displayName: 'Ruff' - script: | black --diff . @@ -98,7 +98,7 @@ jobs: - script: pip install -r requirements-dev.txt displayName: 'Install Requirements dev' - script: | - ruff . + ruff check . displayName: 'Ruff' - script: | black --diff . From f6973b32a566e9b6481f1ca0ee1d782ff3d36719 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20Dupr=C3=A9?= Date: Mon, 15 Jul 2024 10:26:51 +0200 Subject: [PATCH 2/3] lint --- mlinsights/mlbatch/pipeline_cache.py | 6 +++++- pyproject.toml | 4 ++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/mlinsights/mlbatch/pipeline_cache.py b/mlinsights/mlbatch/pipeline_cache.py index edd3a47f..9e106537 100644 --- a/mlinsights/mlbatch/pipeline_cache.py +++ b/mlinsights/mlbatch/pipeline_cache.py @@ -1,6 +1,10 @@ from sklearn.base import clone from sklearn.pipeline import Pipeline, _fit_transform_one -from sklearn.utils import _print_elapsed_time + +try: + from sklearn.utils._user_interface import _print_elapsed_time +except ImportError: + from sklearn.utils import _print_elapsed_time from sklearn.utils.validation import check_memory from .cache_model import MLCache diff --git a/pyproject.toml b/pyproject.toml index 2b1fecba..f79888ec 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -146,10 +146,10 @@ disable_error_code = ["override", "index"] exclude = [".eggs", ".git", "build", "dist"] line-length = 88 -[tool.ruff.mccabe] +[tool.ruff.lint.mccabe] max-complexity = 10 -[tool.ruff.per-file-ignores] +[tool.ruff.lint.per-file-ignores] "_unittests/ut_plotting/test_dot.py" = ["E501"] "mlinsights/mlbatch/__init__.py" = ["F401"] "mlinsights/metrics/__init__.py" = ["F401"] From 7ab5793b76c05c444b5ba442dd3db37a0091f807 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Xavier=20Dupr=C3=A9?= Date: Mon, 15 Jul 2024 10:57:34 +0200 Subject: [PATCH 3/3] skip --- _unittests/ut_plotting/test_plot_gallery.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_unittests/ut_plotting/test_plot_gallery.py b/_unittests/ut_plotting/test_plot_gallery.py index 3dbf9e92..b5fae3fd 100644 --- a/_unittests/ut_plotting/test_plot_gallery.py +++ b/_unittests/ut_plotting/test_plot_gallery.py @@ -4,6 +4,7 @@ import unittest import warnings import http.client +import urllib.error import numpy from mlinsights.ext_test_case import ExtTestCase, unzip_files from mlinsights.plotting import plot_gallery_images @@ -62,9 +63,8 @@ def test_plot_gallery_url(self): try: fig, ax = plot_gallery_images(files, return_figure=True) - except http.client.RemoteDisconnected as e: - warnings.warn(f"Unable to fetch image {e}'") - return + except (http.client.RemoteDisconnected, urllib.error.HTTPError) as e: + raise unittest.SkipTest(f"Unable to fetch image {e} (url={root!r})") self.assertNotEmpty(fig) self.assertNotEmpty(ax)