Skip to content

Commit 3a1f14b

Browse files
authored
Use ruff check (#131)
* Use ruff check * lint * skip
1 parent f42e93e commit 3a1f14b

File tree

5 files changed

+13
-9
lines changed

5 files changed

+13
-9
lines changed

_cmake/clang_format.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#!/bin/bash
22
clear
33
echo "--ruff--"
4-
ruff .
4+
ruff check .
55
echo "--cython-lint--"
66
cython-lint .
77
echo "--clang-format--"

_unittests/ut_plotting/test_plot_gallery.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import unittest
55
import warnings
66
import http.client
7+
import urllib.error
78
import numpy
89
from mlinsights.ext_test_case import ExtTestCase, unzip_files
910
from mlinsights.plotting import plot_gallery_images
@@ -62,9 +63,8 @@ def test_plot_gallery_url(self):
6263

6364
try:
6465
fig, ax = plot_gallery_images(files, return_figure=True)
65-
except http.client.RemoteDisconnected as e:
66-
warnings.warn(f"Unable to fetch image {e}'")
67-
return
66+
except (http.client.RemoteDisconnected, urllib.error.HTTPError) as e:
67+
raise unittest.SkipTest(f"Unable to fetch image {e} (url={root!r})")
6868
self.assertNotEmpty(fig)
6969
self.assertNotEmpty(ax)
7070

azure-pipelines.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ jobs:
2424
- script: pip install -r requirements-dev.txt
2525
displayName: 'Install Requirements dev'
2626
- script: |
27-
ruff .
27+
ruff check .
2828
displayName: 'Ruff'
2929
- script: |
3030
black --diff .
@@ -98,7 +98,7 @@ jobs:
9898
- script: pip install -r requirements-dev.txt
9999
displayName: 'Install Requirements dev'
100100
- script: |
101-
ruff .
101+
ruff check .
102102
displayName: 'Ruff'
103103
- script: |
104104
black --diff .

mlinsights/mlbatch/pipeline_cache.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
from sklearn.base import clone
22
from sklearn.pipeline import Pipeline, _fit_transform_one
3-
from sklearn.utils import _print_elapsed_time
3+
4+
try:
5+
from sklearn.utils._user_interface import _print_elapsed_time
6+
except ImportError:
7+
from sklearn.utils import _print_elapsed_time
48
from sklearn.utils.validation import check_memory
59
from .cache_model import MLCache
610

pyproject.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -146,10 +146,10 @@ disable_error_code = ["override", "index"]
146146
exclude = [".eggs", ".git", "build", "dist"]
147147
line-length = 88
148148

149-
[tool.ruff.mccabe]
149+
[tool.ruff.lint.mccabe]
150150
max-complexity = 10
151151

152-
[tool.ruff.per-file-ignores]
152+
[tool.ruff.lint.per-file-ignores]
153153
"_unittests/ut_plotting/test_dot.py" = ["E501"]
154154
"mlinsights/mlbatch/__init__.py" = ["F401"]
155155
"mlinsights/metrics/__init__.py" = ["F401"]

0 commit comments

Comments
 (0)