Skip to content

Commit 16b5f49

Browse files
committed
Merge branch 'feature/v0.1.5' into develop
2 parents 586b263 + 9168cdc commit 16b5f49

File tree

9 files changed

+185
-128
lines changed

9 files changed

+185
-128
lines changed

.flake8

Lines changed: 0 additions & 3 deletions
This file was deleted.

.pre-commit-config.yaml

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,12 @@
11
repos:
2-
- repo: https://github.com/asottile/pyupgrade
3-
rev: v3.2.2
4-
hooks:
5-
- id: pyupgrade
6-
args: [--py39-plus]
72
- repo: https://github.com/ikamensh/flynt/
83
rev: '0.77'
94
hooks:
105
- id: flynt
6+
- repo: https://github.com/charliermarsh/ruff-pre-commit
7+
rev: 'v0.0.239'
8+
hooks:
9+
- id: ruff
1110
- repo: https://github.com/psf/black
1211
rev: 22.10.0
1312
hooks:
@@ -18,14 +17,3 @@ repos:
1817
hooks:
1918
- id: blackdoc
2019
language_version: python3.9
21-
- repo: https://github.com/PyCQA/flake8
22-
rev: 6.0.0
23-
hooks:
24-
- id: flake8
25-
- repo: https://github.com/pycqa/pydocstyle
26-
rev: 6.1.1
27-
hooks:
28-
- id: pydocstyle
29-
args:
30-
- --convention=numpy
31-
- --add-ignore=D104,D200,D202,D205,D301,D400

colour_checker_detection/__init__.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
from __future__ import annotations
1313

14+
import contextlib
1415
import cv2
1516
import numpy as np
1617
import os
@@ -81,7 +82,5 @@
8182
del _version
8283

8384
# TODO: Remove legacy printing support when deemed appropriate.
84-
try:
85+
with contextlib.suppress(TypeError):
8586
np.set_printoptions(legacy="1.13")
86-
except TypeError:
87-
pass

colour_checker_detection/detection/segmentation.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@
3434
NDArrayInt,
3535
Tuple,
3636
Type,
37-
Union,
3837
cast,
3938
)
4039
from colour.models import cctf_encoding
@@ -566,7 +565,7 @@ class DataColourCheckersCoordinatesSegmentation(MixinDataclassIterable):
566565

567566
def colour_checkers_coordinates_segmentation(
568567
image: ArrayLike, additional_data: bool = False, **kwargs: Any
569-
) -> Union[DataColourCheckersCoordinatesSegmentation, Tuple[NDArrayInt, ...]]:
568+
) -> DataColourCheckersCoordinatesSegmentation | Tuple[NDArrayInt, ...]:
570569
"""
571570
Detect the colour checkers coordinates in given image :math:`image` using
572571
segmentation.
@@ -975,9 +974,8 @@ def detect_colour_checkers_segmentation(
975974
samples: int = 16,
976975
additional_data: bool = False,
977976
**kwargs: Any,
978-
) -> Union[
979-
Tuple[DataDetectColourCheckersSegmentation, ...],
980-
Tuple[NDArrayFloat, ...],
977+
) -> Tuple[DataDetectColourCheckersSegmentation, ...] | Tuple[
978+
NDArrayFloat, ...
981979
]:
982980
"""
983981
Detect the colour checkers swatches in given image using segmentation.

docs/conf.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@
6969
master_doc = "index"
7070

7171
project = package.__application_name__
72-
copyright = package.__copyright__.replace("Copyright (C)", "")
72+
copyright = package.__copyright__.replace("Copyright (C)", "") # noqa: A001
7373
version = f"{package.__major_version__}.{package.__minor_version__}"
7474
release = package.__version__
7575

@@ -180,7 +180,9 @@
180180
epub_exclude_files = ["search.html"]
181181

182182

183-
def autodoc_process_docstring(app, what, name, obj, options, lines):
183+
def autodoc_process_docstring(
184+
app, what, name, obj, options, lines # noqa: ARG001
185+
):
184186
"""Process the docstrings to remove the *# noqa* *flake8* pragma."""
185187

186188
for i, line in enumerate(lines):

pyproject.toml

Lines changed: 92 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -59,19 +59,17 @@ black = { version = "*", optional = true } # Development dependency.
5959
blackdoc = { version = "*", optional = true } # Development dependency.
6060
coverage = { version = "*", optional = true } # Development dependency.
6161
coveralls = { version = "*", optional = true } # Development dependency.
62-
flake8 = { version = "*", optional = true } # Development dependency.
6362
flynt = { version = "*", optional = true } # Development dependency.
6463
invoke = { version = "*", optional = true } # Development dependency.
6564
jupyter = { version = "*", optional = true } # Development dependency.
6665
pre-commit = { version = "*", optional = true } # Development dependency.
6766
pydata-sphinx-theme = { version = "*", optional = true } # Development dependency.
68-
pydocstyle = { version = "*", optional = true } # Development dependency.
6967
pyright = { version = "*", optional = true } # Development dependency.
7068
pytest = { version = "*", optional = true } # Development dependency.
7169
pytest-cov = { version = "*", optional = true } # Development dependency.
7270
pytest-xdist = { version = "*", optional = true} #Development dependency
73-
pyupgrade = { version = "*", optional = true } # Development dependency.
7471
restructuredtext-lint = { version = "*", optional = true } # Development dependency.
72+
ruff = { version = "*", optional = true } # Development dependency.
7573
sphinx = { version = ">= 4, < 5", optional = true } # Development dependency.
7674
sphinxcontrib-bibtex = { version = "*", optional = true } # Development dependency.
7775
toml = { version = "*", optional = true } # Development dependency.
@@ -83,19 +81,17 @@ black = "*"
8381
blackdoc = "*"
8482
coverage = "!= 6.3"
8583
coveralls = "*"
86-
flake8 = "*"
8784
flynt = "*"
8885
invoke = "*"
8986
jupyter = "*"
9087
pre-commit = "*"
9188
pydata-sphinx-theme = "*"
92-
pydocstyle = "*"
9389
pyright = "*"
9490
pytest = "*"
9591
pytest-cov = "*"
9692
pytest-xdist = "*"
97-
pyupgrade = "*"
9893
restructuredtext-lint = "*"
94+
ruff = "*"
9995
sphinx = ">= 4, < 5"
10096
sphinxcontrib-bibtex = "*"
10197
toml = "*"
@@ -108,19 +104,17 @@ development = [
108104
"blackdoc",
109105
"coverage",
110106
"coveralls",
111-
"flake8",
112107
"flynt",
113108
"invoke",
114109
"jupyter",
115110
"pre-commit",
116111
"pydata-sphinx-theme",
117-
"pydocstyle",
118112
"pyright",
119113
"pytest",
120114
"pytest-cov",
121115
"pytest-xdist",
122-
"pyupgrade",
123116
"restructuredtext-lint",
117+
"ruff",
124118
"sphinx",
125119
"sphinxcontrib-bibtex",
126120
"toml",
@@ -142,10 +136,6 @@ exclude = '''
142136
[tool.flynt]
143137
line_length=999
144138

145-
[tool.pydocstyle]
146-
convention = "numpy"
147-
add-ignore = "D104,D200,D202,D205,D301,D400"
148-
149139
[tool.pyright]
150140
reportMissingImports = false
151141
reportMissingModuleSource = false
@@ -158,6 +148,95 @@ reportUnusedExpression = false
158148
[tool.pytest.ini_options]
159149
addopts = "-n auto --dist=loadscope --durations=5"
160150

151+
[tool.ruff]
152+
target-version = "py39"
153+
line-length = 88
154+
select = [
155+
"A", # flake8-builtins
156+
"ARG", # flake8-unused-arguments
157+
# "ANN", # flake8-annotations
158+
"B", # flake8-bugbear
159+
# "BLE", # flake8-blind-except
160+
"C4", # flake8-comprehensions
161+
# "C90", # mccabe
162+
# "COM", # flake8-commas
163+
"DTZ", # flake8-datetimez
164+
"D", # pydocstyle
165+
"E", # pydocstyle
166+
# "ERA", # eradicate
167+
# "EM", # flake8-errmsg
168+
"EXE", # flake8-executable
169+
"F", # flake8
170+
# "FBT", # flake8-boolean-trap
171+
"G", # flake8-logging-format
172+
"I", # isort
173+
"ICN", # flake8-import-conventions
174+
"INP", # flake8-no-pep420
175+
"ISC", # flake8-implicit-str-concat
176+
"N", # pep8-naming
177+
# "PD", # pandas-vet
178+
"PIE", # flake8-pie
179+
"PGH", # pygrep-hooks
180+
"PL", # pylint
181+
# "PT", # flake8-pytest-style
182+
# "PTH", # flake8-use-pathlib [Enable]
183+
"Q", # flake8-quotes
184+
"RET", # flake8-return
185+
"RUF", # Ruff
186+
"S", # flake8-bandit
187+
"SIM", # flake8-simplify
188+
"T10", # flake8-debugger
189+
"T20", # flake8-print
190+
# "TCH", # flake8-type-checking
191+
"TID", # flake8-tidy-imports
192+
"TRY", # tryceratops
193+
"UP", # pyupgrade
194+
"W", # pydocstyle
195+
"YTT" # flake8-2020
196+
]
197+
ignore = [
198+
"B008",
199+
"B905",
200+
"D104",
201+
"D200",
202+
"D202",
203+
"D205",
204+
"D301",
205+
"D400",
206+
"I001",
207+
"N801",
208+
"N802",
209+
"N803",
210+
"N806",
211+
"N813",
212+
"N815",
213+
"N816",
214+
"PIE804",
215+
"PLE0605",
216+
"PLR0913",
217+
"PLR2004",
218+
"RET504",
219+
"RET505",
220+
"RET506",
221+
"RET507",
222+
"RET508",
223+
"TRY003",
224+
"TRY300",
225+
]
226+
typing-modules = ["colour.hints"]
227+
fixable = ["B", "C", "E", "F", "PIE", "RUF", "SIM", "UP", "W"]
228+
229+
[tool.ruff.pydocstyle]
230+
convention = "numpy"
231+
232+
[tool.ruff.per-file-ignores]
233+
"colour-checker-detection/examples/*" = ["INP", "T201", "T203"]
234+
"docs/*" = ["INP"]
235+
"setup.py" = ["INP"]
236+
"tasks.py" = ["INP"]
237+
"utilities/*" = ["EXE001", "INP"]
238+
"utilities/unicode_to_ascii.py" = ["RUF001"]
239+
161240
[build-system]
162241
requires = [ "poetry_core>=1.0.0" ]
163242
build-backend = "poetry.core.masonry.api"

0 commit comments

Comments
 (0)