Skip to content

Commit e70be02

Browse files
committed
Update .pre-commit-config.yaml file.
1 parent 06591f2 commit e70be02

8 files changed

+313
-293
lines changed

.pre-commit-config.yaml

+6-10
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
repos:
22
- repo: https://github.com/pre-commit/pre-commit-hooks
3-
rev: "v4.5.0"
3+
rev: "v5.0.0"
44
hooks:
55
- id: check-added-large-files
66
- id: check-case-conflict
@@ -15,31 +15,27 @@ repos:
1515
- id: requirements-txt-fixer
1616
- id: trailing-whitespace
1717
- repo: https://github.com/codespell-project/codespell
18-
rev: v2.2.6
18+
rev: v2.3.0
1919
hooks:
2020
- id: codespell
2121
exclude: "BIBLIOGRAPHY.bib|CONTRIBUTORS.rst|.*.ipynb"
22-
- repo: https://github.com/ikamensh/flynt
23-
rev: "1.0.1"
24-
hooks:
25-
- id: flynt
26-
args: [--verbose]
2722
- repo: https://github.com/PyCQA/isort
2823
rev: "5.13.2"
2924
hooks:
3025
- id: isort
3126
- repo: https://github.com/astral-sh/ruff-pre-commit
32-
rev: "v0.1.14"
27+
rev: "v0.8.2"
3328
hooks:
3429
- id: ruff-format
3530
- id: ruff
31+
args: [--fix]
3632
- repo: https://github.com/adamchainz/blacken-docs
37-
rev: 1.16.0
33+
rev: 1.19.1
3834
hooks:
3935
- id: blacken-docs
4036
language_version: python3.10
4137
- repo: https://github.com/pre-commit/mirrors-prettier
42-
rev: "v3.1.0"
38+
rev: "v4.0.0-alpha.8"
4339
hooks:
4440
- id: prettier
4541
- repo: https://github.com/pre-commit/pygrep-hooks

colour_checker_detection/__init__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@
6969

7070
try:
7171
_version = (
72-
subprocess.check_output(
73-
["git", "describe"], # noqa: S603, S607
72+
subprocess.check_output( # noqa: S603
73+
["git", "describe"], # noqa: S607
7474
cwd=os.path.dirname(__file__),
7575
stderr=subprocess.STDOUT,
7676
)

colour_checker_detection/detection/inference.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -202,8 +202,8 @@ def inferencer_default(
202202
input_image = image
203203

204204
output_results = os.path.join(temp_directory, "output-results.npz")
205-
subprocess.call(
206-
[ # noqa: S603
205+
subprocess.call( # noqa: S603
206+
[
207207
sys.executable,
208208
PATH_INFERENCE_SCRIPT_DEFAULT,
209209
"--input",

colour_checker_detection/examples/examples_detection_inference.ipynb

+251-235
Large diffs are not rendered by default.

colour_checker_detection/examples/examples_detection_segmentation.ipynb

+50-37
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@
6060
"\n",
6161
"from colour_checker_detection import (\n",
6262
" ROOT_RESOURCES_EXAMPLES,\n",
63-
" detect_colour_checkers_segmentation)\n",
63+
" detect_colour_checkers_segmentation,\n",
64+
")\n",
6465
"\n",
6566
"colour.plotting.colour_style()\n",
6667
"\n",
@@ -114,15 +115,16 @@
114115
],
115116
"source": [
116117
"COLOUR_CHECKER_IMAGE_PATHS = glob.glob(\n",
117-
" os.path.join(ROOT_RESOURCES_EXAMPLES, 'detection', '*19*.png'))\n",
118+
" os.path.join(ROOT_RESOURCES_EXAMPLES, \"detection\", \"*19*.png\")\n",
119+
")\n",
118120
"\n",
119121
"COLOUR_CHECKER_IMAGES = [\n",
120122
" colour.cctf_decoding(colour.io.read_image(path))\n",
121123
" for path in COLOUR_CHECKER_IMAGE_PATHS\n",
122124
"]\n",
123125
"\n",
124126
"for image in COLOUR_CHECKER_IMAGES:\n",
125-
" colour.plotting.plot_image(colour.cctf_encoding(image));"
127+
" colour.plotting.plot_image(colour.cctf_encoding(image))"
126128
]
127129
},
128130
{
@@ -166,20 +168,19 @@
166168
"SWATCHES = []\n",
167169
"for image in COLOUR_CHECKER_IMAGES:\n",
168170
" for colour_checker_data in detect_colour_checkers_segmentation(\n",
169-
" image, additional_data=True):\n",
170-
" \n",
171-
" swatch_colours, swatch_masks, colour_checker_image = (\n",
172-
" colour_checker_data.values)\n",
171+
" image, additional_data=True\n",
172+
" ):\n",
173+
" swatch_colours, swatch_masks, colour_checker_image = colour_checker_data.values\n",
173174
" SWATCHES.append(swatch_colours)\n",
174-
" \n",
175+
"\n",
175176
" # Using the additional data to plot the colour checker and masks.\n",
176177
" masks_i = np.zeros(colour_checker_image.shape)\n",
177-
" for i, mask in enumerate(swatch_masks):\n",
178-
" masks_i[mask[0]:mask[1], mask[2]:mask[3], ...] = 1\n",
179-
" \n",
178+
" for mask in swatch_masks:\n",
179+
" masks_i[mask[0] : mask[1], mask[2] : mask[3], ...] = 1\n",
180+
"\n",
180181
" colour.plotting.plot_image(\n",
181-
" colour.cctf_encoding(\n",
182-
" np.clip(colour_checker_image + masks_i * 0.25, 0, 1)));"
182+
" colour.cctf_encoding(np.clip(colour_checker_image + masks_i * 0.25, 0, 1))\n",
183+
" )"
183184
]
184185
},
185186
{
@@ -260,9 +261,10 @@
260261
}
261262
],
262263
"source": [
263-
"D65 = colour.CCS_ILLUMINANTS['CIE 1931 2 Degree Standard Observer']['D65']\n",
264+
"D65 = colour.CCS_ILLUMINANTS[\"CIE 1931 2 Degree Standard Observer\"][\"D65\"]\n",
264265
"REFERENCE_COLOUR_CHECKER = colour.CCS_COLOURCHECKERS[\n",
265-
" 'ColorChecker24 - After November 2014']\n",
266+
" \"ColorChecker24 - After November 2014\"\n",
267+
"]\n",
266268
"\n",
267269
"colour_checker_rows = REFERENCE_COLOUR_CHECKER.rows\n",
268270
"colour_checker_columns = REFERENCE_COLOUR_CHECKER.columns\n",
@@ -272,35 +274,47 @@
272274
"# See https://github.com/colour-science/colour-checker-detection/discussions/59\n",
273275
"# for more information.\n",
274276
"REFERENCE_SWATCHES = colour.XYZ_to_RGB(\n",
275-
" colour.xyY_to_XYZ(list(REFERENCE_COLOUR_CHECKER.data.values())),\n",
276-
" 'sRGB', REFERENCE_COLOUR_CHECKER.illuminant)\n",
277+
" colour.xyY_to_XYZ(list(REFERENCE_COLOUR_CHECKER.data.values())),\n",
278+
" \"sRGB\",\n",
279+
" REFERENCE_COLOUR_CHECKER.illuminant,\n",
280+
")\n",
277281
"\n",
278282
"for i, swatches in enumerate(SWATCHES):\n",
279-
" swatches_xyY = colour.XYZ_to_xyY(colour.RGB_to_XYZ(\n",
280-
" swatches, 'sRGB', D65))\n",
283+
" swatches_xyY = colour.XYZ_to_xyY(colour.RGB_to_XYZ(swatches, \"sRGB\", D65))\n",
281284
"\n",
282285
" colour_checker = colour.characterisation.ColourChecker(\n",
283286
" os.path.basename(COLOUR_CHECKER_IMAGE_PATHS[i]),\n",
284287
" dict(zip(REFERENCE_COLOUR_CHECKER.data.keys(), swatches_xyY)),\n",
285-
" D65, colour_checker_rows, colour_checker_columns)\n",
286-
" \n",
288+
" D65,\n",
289+
" colour_checker_rows,\n",
290+
" colour_checker_columns,\n",
291+
" )\n",
292+
"\n",
287293
" colour.plotting.plot_multi_colour_checkers(\n",
288-
" [REFERENCE_COLOUR_CHECKER, colour_checker])\n",
289-
" \n",
294+
" [REFERENCE_COLOUR_CHECKER, colour_checker]\n",
295+
" )\n",
296+
"\n",
290297
" swatches_f = colour.colour_correction(swatches, swatches, REFERENCE_SWATCHES)\n",
291-
" swatches_f_xyY = colour.XYZ_to_xyY(colour.RGB_to_XYZ(\n",
292-
" swatches_f, 'sRGB', D65))\n",
298+
" swatches_f_xyY = colour.XYZ_to_xyY(colour.RGB_to_XYZ(swatches_f, \"sRGB\", D65))\n",
293299
" colour_checker = colour.characterisation.ColourChecker(\n",
294-
" '{0} - CC'.format(os.path.basename(COLOUR_CHECKER_IMAGE_PATHS[i])),\n",
300+
" f\"{os.path.basename(COLOUR_CHECKER_IMAGE_PATHS[i])} - CC\",\n",
295301
" dict(zip(REFERENCE_COLOUR_CHECKER.data.keys(), swatches_f_xyY)),\n",
296-
" D65, colour_checker_rows, colour_checker_columns)\n",
297-
" \n",
302+
" D65,\n",
303+
" colour_checker_rows,\n",
304+
" colour_checker_columns,\n",
305+
" )\n",
306+
"\n",
298307
" colour.plotting.plot_multi_colour_checkers(\n",
299-
" [REFERENCE_COLOUR_CHECKER, colour_checker])\n",
308+
" [REFERENCE_COLOUR_CHECKER, colour_checker]\n",
309+
" )\n",
300310
"\n",
301-
" colour.plotting.plot_image(colour.cctf_encoding(\n",
302-
" colour.colour_correction(\n",
303-
" COLOUR_CHECKER_IMAGES[i], swatches, REFERENCE_SWATCHES)));"
311+
" colour.plotting.plot_image(\n",
312+
" colour.cctf_encoding(\n",
313+
" colour.colour_correction(\n",
314+
" COLOUR_CHECKER_IMAGES[i], swatches, REFERENCE_SWATCHES\n",
315+
" )\n",
316+
" )\n",
317+
" )"
304318
]
305319
},
306320
{
@@ -414,9 +428,8 @@
414428
],
415429
"source": [
416430
"for image in COLOUR_CHECKER_IMAGES:\n",
417-
" for colour_checker_data in detect_colour_checkers_segmentation(\n",
418-
" image, show=True):\n",
419-
" pass"
431+
" for _colour_checker_data in detect_colour_checkers_segmentation(image, show=True):\n",
432+
" ..."
420433
]
421434
},
422435
{
@@ -537,10 +550,10 @@
537550
")\n",
538551
"\n",
539552
"for path in COLOUR_CHECKER_IMAGE_PATHS:\n",
540-
" for colour_checker_data in detect_colour_checkers_segmentation(\n",
553+
" for _colour_checker_data in detect_colour_checkers_segmentation(\n",
541554
" path, apply_cctf_decoding=True, show=True\n",
542555
" ):\n",
543-
" pass"
556+
" ..."
544557
]
545558
}
546559
],

docs/conf.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
sys.path.append(str(Path(__file__).parent.parent))
1111

12-
import colour_checker_detection as package # noqa: E402
12+
import colour_checker_detection as package
1313

1414
basename = re.sub("_(\\w)", lambda x: x.group(1).upper(), package.__name__.title())
1515

pyproject.toml

-3
Original file line numberDiff line numberDiff line change
@@ -109,9 +109,6 @@ colour-checker-detection-inference = "colour_checker_detection.scripts.inference
109109
[tool.codespell]
110110
skip = "BIBLIOGRAPHY.bib,CONTRIBUTORS.rst,*.ipynb"
111111

112-
[tool.flynt]
113-
line_length = 999
114-
115112
[tool.isort]
116113
ensure_newline_before_comments = true
117114
force_grid_wrap = 0

tasks.py

+1-3
Original file line numberDiff line numberDiff line change
@@ -336,9 +336,7 @@ def virtualise(ctx: Context, tests: bool = True):
336336
ctx.run(f"mv {PYPI_ARCHIVE_NAME}-{APPLICATION_VERSION} {unique_name}")
337337
ctx.run(f"rm -rf {unique_name}/{PYTHON_PACKAGE_NAME}/resources")
338338
ctx.run(
339-
"ln -s ../../../{0}/resources {1}/{0}".format(
340-
PYTHON_PACKAGE_NAME, unique_name
341-
)
339+
f"ln -s ../../../{PYTHON_PACKAGE_NAME}/resources {unique_name}/{PYTHON_PACKAGE_NAME}" # noqa: E501
342340
)
343341

344342
with ctx.cd(unique_name):

0 commit comments

Comments
 (0)