diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b527df66f..1f77565f0 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: @@ -16,4 +20,4 @@ repos: rev: v0.3.8 hooks: - id: blackdoc - language_version: python3.9 + language_version: python3.9 \ No newline at end of file diff --git a/docs/conf.py b/docs/conf.py index 56a2bcc91..b3028efc2 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -5,12 +5,13 @@ import os import re -import setuptools.archive_util import sys import urllib.parse import urllib.request from pathlib import Path +import setuptools.archive_util + sys.path.append(str(Path(__file__).parent.parent)) import colour as package # noqa: E402 diff --git a/tasks.py b/tasks.py index 8987b028e..6a2105b5a 100644 --- a/tasks.py +++ b/tasks.py @@ -5,23 +5,23 @@ from __future__ import annotations -import biblib.bib import contextlib import fnmatch +import inspect import os import re import uuid +import biblib.bib + import colour from colour.utilities import message_box -import inspect - 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 2013 Colour Developers" diff --git a/utilities/generate_plots.py b/utilities/generate_plots.py index 133886c72..13ae747ca 100755 --- a/utilities/generate_plots.py +++ b/utilities/generate_plots.py @@ -10,18 +10,20 @@ mpl.use("AGG") +import os # noqa: E402 + import matplotlib.pyplot as plt # noqa: E402 import numpy as np # noqa: E402 -import os # noqa: E402 import trimesh # noqa: E402 + import colour # noqa: E402 from colour.characterisation import SDS_COLOURCHECKERS # noqa: E402 from colour.colorimetry import ( # noqa: E402 + MSDS_CMFS_STANDARD_OBSERVER, SDS_ILLUMINANTS, - SDS_LIGHT_SOURCES, SDS_LEFS_PHOTOPIC, SDS_LEFS_SCOTOPIC, - MSDS_CMFS_STANDARD_OBSERVER, + SDS_LIGHT_SOURCES, SpectralDistribution, SpectralShape, sd_blackbody, @@ -34,13 +36,13 @@ from colour.models import ( # noqa: E402 RGB_COLOURSPACE_sRGB, RGB_to_XYZ, - sRGB_to_XYZ, XYZ_to_sRGB, XYZ_to_xy, + sRGB_to_XYZ, ) from colour.plotting import ( # noqa: E402 - colour_style, ColourSwatch, + colour_style, plot_automatic_colour_conversion_graph, plot_blackbody_colours, plot_blackbody_spectral_radiance, @@ -63,9 +65,9 @@ plot_multi_lightness_functions, plot_multi_luminance_functions, plot_multi_munsell_value_functions, + plot_multi_sds, plot_multi_sds_colour_quality_scales_bars, plot_multi_sds_colour_rendering_indexes_bars, - plot_multi_sds, plot_planckian_locus_in_chromaticity_diagram_CIE1931, plot_planckian_locus_in_chromaticity_diagram_CIE1960UCS, plot_planckian_locus_in_chromaticity_diagram_CIE1976UCS, @@ -91,26 +93,26 @@ plot_single_lightness_function, plot_single_luminance_function, plot_single_munsell_value_function, + plot_single_sd, plot_single_sd_colour_quality_scale_bars, plot_single_sd_colour_rendering_index_bars, plot_single_sd_colour_rendition_report, plot_single_sd_rayleigh_scattering, - plot_single_sd, plot_the_blue_sky, plot_visible_spectrum, plot_visible_spectrum_section, render, ) from colour.plotting.diagrams import ( # noqa: E402 - plot_spectral_locus, - plot_chromaticity_diagram_colours, plot_chromaticity_diagram, + plot_chromaticity_diagram_colours, plot_sds_in_chromaticity_diagram, + plot_spectral_locus, ) from colour.plotting.models import ( # noqa: E402 - plot_RGB_colourspaces_in_chromaticity_diagram, - plot_RGB_chromaticities_in_chromaticity_diagram, plot_ellipses_MacAdam1942_in_chromaticity_diagram, + plot_RGB_chromaticities_in_chromaticity_diagram, + plot_RGB_colourspaces_in_chromaticity_diagram, ) from colour.plotting.quality import plot_colour_quality_bars # noqa: E402 from colour.plotting.section import ( # noqa: E402 @@ -123,10 +125,10 @@ plot_planckian_locus_in_chromaticity_diagram, ) from colour.quality import colour_quality_scale # noqa: E402 -from colour.utilities import ( # noqa: E402 +from colour.utilities import ( # noqa: E402; noqa: RUF100 domain_range_scale, filter_warnings, -) # noqa: RUF100 +) __copyright__ = "Copyright 2013 Colour Developers" __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause" diff --git a/utilities/literalise.py b/utilities/literalise.py index c436ed23a..707fa7296 100755 --- a/utilities/literalise.py +++ b/utilities/literalise.py @@ -8,9 +8,8 @@ import os import re -from textwrap import dedent - import sys +from textwrap import dedent sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))) diff --git a/utilities/mock_for_colour.py b/utilities/mock_for_colour.py index 346906c74..af6673ac3 100644 --- a/utilities/mock_for_colour.py +++ b/utilities/mock_for_colour.py @@ -13,7 +13,6 @@ """ import os - from types import FunctionType, MethodType, ModuleType __author__ = "Sphinx Team, Colour Developers"