diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b527df6..570a31c 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -3,6 +3,10 @@ repos: rev: '1.0.1' hooks: - id: flynt +- repo: https://github.com/PyCQA/isort + rev: '5.12.0' + hooks: + - id: isort - repo: https://github.com/charliermarsh/ruff-pre-commit rev: 'v0.0.285' hooks: diff --git a/README.rst b/README.rst index f381d56..b506fcc 100644 --- a/README.rst +++ b/README.rst @@ -20,7 +20,6 @@ Colour - Checker Detection .. end-badges - A `Python `__ package implementing various colour checker detection algorithms and related utilities. diff --git a/colour_checker_detection/__init__.py b/colour_checker_detection/__init__.py index 8c485ca..ff04849 100644 --- a/colour_checker_detection/__init__.py +++ b/colour_checker_detection/__init__.py @@ -12,19 +12,19 @@ from __future__ import annotations import contextlib -import cv2 -import numpy as np import os import subprocess import colour +import cv2 +import numpy as np from .detection import ( SETTINGS_SEGMENTATION_COLORCHECKER_CLASSIC, SETTINGS_SEGMENTATION_COLORCHECKER_SG, colour_checkers_coordinates_segmentation, - extract_colour_checkers_segmentation, detect_colour_checkers_segmentation, + extract_colour_checkers_segmentation, ) __author__ = "Colour Developers" diff --git a/colour_checker_detection/detection/segmentation.py b/colour_checker_detection/detection/segmentation.py index 1ee58b8..c7a60ba 100644 --- a/colour_checker_detection/detection/segmentation.py +++ b/colour_checker_detection/detection/segmentation.py @@ -19,10 +19,10 @@ from __future__ import annotations -import cv2 -import numpy as np from dataclasses import dataclass +import cv2 +import numpy as np from colour.hints import ( Any, ArrayLike, @@ -548,7 +548,7 @@ class DataColourCheckersCoordinatesSegmentation(MixinDataclassIterable): Parameters ---------- colour_checkers - Colour checker bounding boxes, i.e., the. clusters that have the + Colour checker bounding boxes, i.e., the clusters that have the relevant count of swatches. clusters Detected swatches clusters. diff --git a/colour_checker_detection/detection/tests/test_segmentation.py b/colour_checker_detection/detection/tests/test_segmentation.py index 8088e94..14a2051 100644 --- a/colour_checker_detection/detection/tests/test_segmentation.py +++ b/colour_checker_detection/detection/tests/test_segmentation.py @@ -5,29 +5,29 @@ """ import glob -import numpy as np import os import platform import unittest +import numpy as np from colour import read_image from colour.models import cctf_encoding from colour_checker_detection import ROOT_RESOURCES_TESTS +from colour_checker_detection.detection import ( + colour_checkers_coordinates_segmentation, + detect_colour_checkers_segmentation, + extract_colour_checkers_segmentation, +) from colour_checker_detection.detection.segmentation import ( SETTINGS_SEGMENTATION_COLORCHECKER_CLASSIC, - swatch_masks, - as_8_bit_BGR_image, adjust_image, - is_square, + as_8_bit_BGR_image, contour_centroid, - scale_contour, crop_and_level_image_with_rectangle, -) -from colour_checker_detection.detection import ( - colour_checkers_coordinates_segmentation, - extract_colour_checkers_segmentation, - detect_colour_checkers_segmentation, + is_square, + scale_contour, + swatch_masks, ) __author__ = "Colour Developers" diff --git a/docs/conf.py b/docs/conf.py index 07292b2..57da46c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -30,11 +30,12 @@ ] intersphinx_mapping = { - "python": ("https://docs.python.org/3.11", None), + "python": ("https://docs.python.org/3/", None), + "colour-science": ("https://colour.readthedocs.io/en/stable/", None), "matplotlib": ("https://matplotlib.org/stable", None), "numpy": ("https://numpy.org/doc/stable", None), - "pandas": ("https://pandas.pydata.org/pandas-docs/dev", None), - "scipy": ("https://docs.scipy.org/doc/scipy-1.8.0/", None), + "pandas": ("https://pandas.pydata.org/pandas-docs/stable", None), + "scipy": ("https://docs.scipy.org/doc/scipy/", None), } autodoc_member_order = "bysource" diff --git a/pyproject.toml b/pyproject.toml index b1339ac..446f48e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -45,7 +45,7 @@ exclude = [ [tool.poetry.dependencies] python = ">= 3.9, < 3.12" -colour-science = ">= 0.4.2" +colour-science = ">= 0.4.3" imageio = ">= 2, < 3" numpy = ">= 1.22, < 2" opencv-python = ">= 4, < 5" @@ -63,7 +63,7 @@ coveralls = "*" flynt = "*" invoke = "*" jupyter = "*" -pre-commit = "*" +pre-commit = ">= 3.5" pyright = "*" pytest = "*" pytest-cov = "*" @@ -76,7 +76,7 @@ twine = "*" biblib-simple = "*" pydata-sphinx-theme = "*" restructuredtext-lint = "*" -sphinx = ">= 4, < 5" +sphinx = "*" sphinxcontrib-bibtex = "*" [tool.black] @@ -92,6 +92,16 @@ exclude = ''' [tool.flynt] line_length=999 +[tool.isort] +ensure_newline_before_comments = true +force_grid_wrap = 0 +include_trailing_comma = true +line_length = 88 +multi_line_output = 3 +skip_glob = ["colour_checker_detection/**/__init__.py"] +split_on_trailing_comma = true +use_parentheses = true + [tool.pyright] reportMissingImports = false reportMissingModuleSource = false diff --git a/tasks.py b/tasks.py index 3207954..78e9b26 100644 --- a/tasks.py +++ b/tasks.py @@ -4,23 +4,23 @@ from __future__ import annotations -import biblib.bib import contextlib import fnmatch +import inspect import os import re import uuid -import colour_checker_detection +import biblib.bib from colour.utilities import message_box -import inspect +import colour_checker_detection if not hasattr(inspect, "getargspec"): inspect.getargspec = inspect.getfullargspec # pyright: ignore -from invoke.tasks import task from invoke.context import Context +from invoke.tasks import task __author__ = "Colour Developers" __copyright__ = "Copyright 2018 Colour Developers"