diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 20117d9..7a95833 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,18 +25,13 @@ repos: - id: flynt args: [--verbose] - repo: https://github.com/PyCQA/isort - rev: "5.12.0" + rev: "5.13.2" hooks: - id: isort - repo: https://github.com/astral-sh/ruff-pre-commit - rev: "v0.1.6" + rev: "v0.1.14" hooks: - id: ruff - - repo: https://github.com/psf/black-pre-commit-mirror - rev: 23.11.0 - hooks: - - id: black - language_version: python3.9 - repo: https://github.com/adamchainz/blacken-docs rev: 1.16.0 hooks: diff --git a/colour_visuals/daylight_locus.py b/colour_visuals/daylight_locus.py index 5b264ff..e8e0540 100644 --- a/colour_visuals/daylight_locus.py +++ b/colour_visuals/daylight_locus.py @@ -111,8 +111,9 @@ class VisualDaylightLocus( def __init__( self, - method: Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"] - | str = "CIE 1931", + method: ( + Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"] | str + ) = "CIE 1931", mireds: bool = False, colour: ArrayLike | None = None, opacity: float = 1, diff --git a/colour_visuals/diagrams.py b/colour_visuals/diagrams.py index 7ff0ca9..abf3d9e 100644 --- a/colour_visuals/diagrams.py +++ b/colour_visuals/diagrams.py @@ -157,13 +157,14 @@ class VisualSpectralLocus2D( def __init__( self, - cmfs: MultiSpectralDistributions - | str - | Sequence[ - MultiSpectralDistributions | str - ] = "CIE 1931 2 Degree Standard Observer", - method: Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"] - | str = "CIE 1931", + cmfs: ( + MultiSpectralDistributions + | str + | Sequence[MultiSpectralDistributions | str] + ) = "CIE 1931 2 Degree Standard Observer", + method: ( + Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"] | str + ) = "CIE 1931", labels: Sequence | None = None, colour: ArrayLike | None = None, opacity: float = 1, @@ -308,9 +309,11 @@ def update(self): str(label), font_size=CONSTANTS_COLOUR_STYLE.font.size, screen_space=True, - anchor="Center-Left" - if lines_w["normal"][::2][i, 0] >= 0 - else "Center-Right", + anchor=( + "Center-Left" + if lines_w["normal"][::2][i, 0] >= 0 + else "Center-Right" + ), ), gfx.TextMaterial(color=CONSTANTS_COLOUR_STYLE.colour.light), ) @@ -437,11 +440,11 @@ class VisualSpectralLocus3D( def __init__( self, - cmfs: MultiSpectralDistributions - | str - | Sequence[ - MultiSpectralDistributions | str - ] = "CIE 1931 2 Degree Standard Observer", + cmfs: ( + MultiSpectralDistributions + | str + | Sequence[MultiSpectralDistributions | str] + ) = "CIE 1931 2 Degree Standard Observer", model: LiteralColourspaceModel | str = "CIE xyY", colour: ArrayLike | None = None, opacity: float = 1, @@ -584,13 +587,14 @@ class VisualChromaticityDiagram( def __init__( self, - cmfs: MultiSpectralDistributions - | str - | Sequence[ - MultiSpectralDistributions | str - ] = "CIE 1931 2 Degree Standard Observer", - method: Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"] - | str = "CIE 1931", + cmfs: ( + MultiSpectralDistributions + | str + | Sequence[MultiSpectralDistributions | str] + ) = "CIE 1931 2 Degree Standard Observer", + method: ( + Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"] | str + ) = "CIE 1931", colours: ArrayLike | None = None, opacity: float = 1, material: Type[gfx.MeshAbstractMaterial] = gfx.MeshBasicMaterial, @@ -670,9 +674,13 @@ def update(self): self._chromaticity_diagram = gfx.Mesh( geometry, - self._type_material(color_mode="vertex", wireframe=self._wireframe) - if self._wireframe - else self._type_material(color_mode="vertex"), + ( + self._type_material( + color_mode="vertex", wireframe=self._wireframe + ) + if self._wireframe + else self._type_material(color_mode="vertex") + ), ) self.add(self._chromaticity_diagram) diff --git a/colour_visuals/planckian_locus.py b/colour_visuals/planckian_locus.py index 1dd0c90..f59f305 100644 --- a/colour_visuals/planckian_locus.py +++ b/colour_visuals/planckian_locus.py @@ -124,8 +124,9 @@ class VisualPlanckianLocus( def __init__( self, - method: Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"] - | str = "CIE 1931", + method: ( + Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"] | str + ) = "CIE 1931", labels: Sequence | None = None, mireds: bool = False, colour: ArrayLike | None = None, diff --git a/colour_visuals/pointer_gamut.py b/colour_visuals/pointer_gamut.py index 38e1e09..0908f59 100644 --- a/colour_visuals/pointer_gamut.py +++ b/colour_visuals/pointer_gamut.py @@ -114,8 +114,9 @@ class VisualPointerGamut2D( def __init__( self, - method: Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"] - | str = "CIE 1931", + method: ( + Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"] | str + ) = "CIE 1931", colour: ArrayLike | None = None, opacity: float = 1, thickness: float = 1, diff --git a/colour_visuals/rgb_colourspace.py b/colour_visuals/rgb_colourspace.py index 5dedf7b..85abe0d 100644 --- a/colour_visuals/rgb_colourspace.py +++ b/colour_visuals/rgb_colourspace.py @@ -132,11 +132,14 @@ class VisualRGBColourspace2D( def __init__( self, - colourspace: RGB_Colourspace - | str - | Sequence[RGB_Colourspace | LiteralRGBColourspace | str] = "sRGB", - method: Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"] - | str = "CIE 1931", + colourspace: ( + RGB_Colourspace + | str + | Sequence[RGB_Colourspace | LiteralRGBColourspace | str] + ) = "sRGB", + method: ( + Literal["CIE 1931", "CIE 1960 UCS", "CIE 1976 UCS"] | str + ) = "CIE 1931", colour: ArrayLike | None = None, opacity: float = 1, thickness: float = 1, @@ -320,9 +323,11 @@ class VisualRGBColourspace3D( def __init__( self, - colourspace: RGB_Colourspace - | str - | Sequence[RGB_Colourspace | LiteralRGBColourspace | str] = "sRGB", + colourspace: ( + RGB_Colourspace + | str + | Sequence[RGB_Colourspace | LiteralRGBColourspace | str] + ) = "sRGB", model: LiteralColourspaceModel | str = "CIE xyY", colour: ArrayLike | None = None, opacity: float = 1, @@ -392,9 +397,13 @@ def update(self): append_channel(colour, self._opacity) ), ), - self._type_material(color_mode="vertex", wireframe=self._wireframe) - if self._wireframe - else self._type_material(color_mode="vertex"), + ( + self._type_material( + color_mode="vertex", wireframe=self._wireframe + ) + if self._wireframe + else self._type_material(color_mode="vertex") + ), ) self.add(self._gamut) diff --git a/colour_visuals/rgb_scatter.py b/colour_visuals/rgb_scatter.py index df7afd7..e0b2556 100644 --- a/colour_visuals/rgb_scatter.py +++ b/colour_visuals/rgb_scatter.py @@ -137,9 +137,11 @@ class VisualRGBScatter3D( def __init__( self, RGB: ArrayLike, - colourspace: RGB_Colourspace - | str - | Sequence[RGB_Colourspace | LiteralRGBColourspace | str] = "sRGB", + colourspace: ( + RGB_Colourspace + | str + | Sequence[RGB_Colourspace | LiteralRGBColourspace | str] + ) = "sRGB", model: LiteralColourspaceModel | str = "CIE xyY", colour: ArrayLike | None = None, opacity: float = 1, diff --git a/colour_visuals/rosch_macadam.py b/colour_visuals/rosch_macadam.py index 1d9c659..c9d13a0 100644 --- a/colour_visuals/rosch_macadam.py +++ b/colour_visuals/rosch_macadam.py @@ -141,14 +141,14 @@ class VisualRoschMacAdam( def __init__( self, - cmfs: MultiSpectralDistributions - | str - | Sequence[ - MultiSpectralDistributions | str - ] = "CIE 1931 2 Degree Standard Observer", - illuminant: SpectralDistribution - | str - | Sequence[SpectralDistribution | str] = "E", + cmfs: ( + MultiSpectralDistributions + | str + | Sequence[MultiSpectralDistributions | str] + ) = "CIE 1931 2 Degree Standard Observer", + illuminant: ( + SpectralDistribution | str | Sequence[SpectralDistribution | str] + ) = "E", model: LiteralColourspaceModel | str = "CIE xyY", colour: ArrayLike | None = None, opacity: float = 1, diff --git a/colour_visuals/visual.py b/colour_visuals/visual.py index 1fa6a29..7935224 100644 --- a/colour_visuals/visual.py +++ b/colour_visuals/visual.py @@ -152,9 +152,11 @@ def cmfs( @cmfs.setter def cmfs( self, - value: MultiSpectralDistributions - | str - | Sequence[MultiSpectralDistributions | str], + value: ( + MultiSpectralDistributions + | str + | Sequence[MultiSpectralDistributions | str] + ), ): """Setter for the **self.cmfs** property.""" diff --git a/pyproject.toml b/pyproject.toml index f9f5525..3a37752 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -78,6 +78,9 @@ exclude = ''' )/ ''' +[tool.codespell] +skip = 'BIBLIOGRAPHY.bib,CONTRIBUTORS.rst' + [tool.flynt] line_length=999 @@ -194,6 +197,9 @@ convention = "numpy" "utilities/*" = ["EXE001", "INP"] "utilities/unicode_to_ascii.py" = ["RUF001"] +[tool.ruff.format] +docstring-code-format = true + [build-system] requires = [ "poetry_core>=1.0.0" ] build-backend = "poetry.core.masonry.api" diff --git a/utilities/generate_plots.py b/utilities/generate_plots.py index b9f4ff2..ca27257 100755 --- a/utilities/generate_plots.py +++ b/utilities/generate_plots.py @@ -10,20 +10,20 @@ mpl.use("AGG") -import os # noqa: E402 - -import matplotlib.pyplot as plt # noqa: E402 -import numpy as np # noqa: E402 -import pygfx as gfx # noqa: E402 -import pylinalg as la # noqa: E402 -from colour.io import write_image # noqa: E402 -from colour.plotting import colour_style, plot_image # noqa: E402 -from colour.utilities import filter_warnings # noqa: E402 -from wgpu.gui.offscreen import WgpuCanvas # noqa: E402 - -from colour_visuals.axes import VisualAxes # noqa: E402 -from colour_visuals.daylight_locus import VisualDaylightLocus # noqa: E402 -from colour_visuals.diagrams import ( # noqa: E402 +import os + +import matplotlib.pyplot as plt +import numpy as np +import pygfx as gfx +import pylinalg as la +from colour.io import write_image +from colour.plotting import colour_style, plot_image +from colour.utilities import filter_warnings +from wgpu.gui.offscreen import WgpuCanvas + +from colour_visuals.axes import VisualAxes +from colour_visuals.daylight_locus import VisualDaylightLocus +from colour_visuals.diagrams import ( VisualChromaticityDiagram, VisualChromaticityDiagramCIE1931, VisualChromaticityDiagramCIE1960UCS, @@ -31,23 +31,23 @@ VisualSpectralLocus2D, VisualSpectralLocus3D, ) -from colour_visuals.grid import VisualGrid # noqa: E402 -from colour_visuals.patterns import ( # noqa: E402 +from colour_visuals.grid import VisualGrid +from colour_visuals.patterns import ( pattern_colour_wheel, pattern_hue_stripes, pattern_hue_swatches, ) -from colour_visuals.planckian_locus import VisualPlanckianLocus # noqa: E402 -from colour_visuals.pointer_gamut import ( # noqa: E402 +from colour_visuals.planckian_locus import VisualPlanckianLocus +from colour_visuals.pointer_gamut import ( VisualPointerGamut2D, VisualPointerGamut3D, ) -from colour_visuals.rgb_colourspace import ( # noqa: E402 +from colour_visuals.rgb_colourspace import ( VisualRGBColourspace2D, VisualRGBColourspace3D, ) -from colour_visuals.rgb_scatter import VisualRGBScatter3D # noqa: E402 -from colour_visuals.rosch_macadam import VisualRoschMacAdam # noqa: E402 +from colour_visuals.rgb_scatter import VisualRGBScatter3D +from colour_visuals.rosch_macadam import VisualRoschMacAdam __copyright__ = "Copyright 2023 Colour Developers" __license__ = "BSD-3-Clause - https://opensource.org/licenses/BSD-3-Clause"