Skip to content

Commit abdd448

Browse files
[pre-commit.ci] auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent 4c91e1d commit abdd448

26 files changed

+72
-100
lines changed

colour/algebra/common.py

+10-12
Original file line numberDiff line numberDiff line change
@@ -71,18 +71,16 @@
7171
"""
7272

7373

74-
def get_sdiv_mode() -> (
75-
Literal[
76-
"Numpy",
77-
"Ignore",
78-
"Warning",
79-
"Raise",
80-
"Ignore Zero Conversion",
81-
"Warning Zero Conversion",
82-
"Ignore Limit Conversion",
83-
"Warning Limit Conversion",
84-
]
85-
):
74+
def get_sdiv_mode() -> Literal[
75+
"Numpy",
76+
"Ignore",
77+
"Warning",
78+
"Raise",
79+
"Ignore Zero Conversion",
80+
"Warning Zero Conversion",
81+
"Ignore Limit Conversion",
82+
"Warning Limit Conversion",
83+
]:
8684
"""
8785
Return *Colour* safe division mode.
8886

colour/algebra/interpolation.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1136,8 +1136,7 @@ def y(self, value: ArrayLike) -> None:
11361136

11371137
attest(
11381138
len(value) >= 6,
1139-
'"y" dependent variable values count must be equal to or '
1140-
"greater than 6!",
1139+
'"y" dependent variable values count must be equal to or greater than 6!',
11411140
)
11421141

11431142
self._y = value

colour/characterisation/aces_it.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -733,9 +733,9 @@ def whitepoint_preserving_matrix(
733733
return M
734734

735735

736-
def optimisation_factory_rawtoaces_v1() -> (
737-
Tuple[NDArrayFloat, Callable, Callable, Callable]
738-
):
736+
def optimisation_factory_rawtoaces_v1() -> Tuple[
737+
NDArrayFloat, Callable, Callable, Callable
738+
]:
739739
"""
740740
Produce the objective function and *CIE XYZ* colourspace to optimisation
741741
colourspace/colour model function according to *RAW to ACES* v1.
@@ -862,9 +862,9 @@ def finaliser_function(M: ArrayLike) -> NDArrayFloat:
862862
)
863863

864864

865-
def optimisation_factory_Oklab_15() -> (
866-
Tuple[NDArrayFloat, Callable, Callable, Callable]
867-
):
865+
def optimisation_factory_Oklab_15() -> Tuple[
866+
NDArrayFloat, Callable, Callable, Callable
867+
]:
868868
"""
869869
Produce the objective function and *CIE XYZ* colourspace to optimisation
870870
colourspace/colour model function based on the *Oklab* colourspace.

colour/colorimetry/spectrum.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ def _on_domain_changed(
717717
"""Invalidate *sd._shape* when *sd._domain* is changed."""
718718

719719
if name == "_domain":
720-
sd._shape = None # noqa: SLF001
720+
sd._shape = None
721721

722722
return value
723723

@@ -1883,8 +1883,7 @@ def display_labels(self, value: Sequence) -> None:
18831883

18841884
attest(
18851885
is_iterable(value),
1886-
f'"display_labels" property: "{value}" is not an "iterable" like '
1887-
f"object!",
1886+
f'"display_labels" property: "{value}" is not an "iterable" like object!',
18881887
)
18891888

18901889
attest(

colour/colorimetry/tristimulus_values.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1274,8 +1274,7 @@ def sd_to_XYZ(
12741274

12751275
if isinstance(sd, MultiSpectralDistributions):
12761276
runtime_warning(
1277-
"A multi-spectral distributions was passed, enforcing integration "
1278-
"method!"
1277+
"A multi-spectral distributions was passed, enforcing integration method!"
12791278
)
12801279
function = sd_to_XYZ_integration
12811280
else:

colour/continuous/multi_signals.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1510,8 +1510,7 @@ def multi_signals_unpack_data(
15101510
for signal in signals.values():
15111511
attest(
15121512
len(domain_array) == len(signal.domain),
1513-
'User "domain" length is not compatible with unpacked '
1514-
'"signals"!',
1513+
'User "domain" length is not compatible with unpacked "signals"!',
15151514
)
15161515

15171516
signal.domain = domain_array

colour/examples/models/examples_models.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -413,8 +413,7 @@
413413

414414
Lab = np.array([0.51634019, 0.15469500, 0.06289579])
415415
message_box(
416-
f'Converting to "CIE XYZ" tristimulus values from "Oklab" colourspace:\n\n'
417-
f"\t{Lab}"
416+
f'Converting to "CIE XYZ" tristimulus values from "Oklab" colourspace:\n\n\t{Lab}'
418417
)
419418
print(colour.Oklab_to_XYZ(Lab))
420419

colour/examples/models/examples_rgb.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@
7575
print("\n")
7676

7777
message_box(
78-
f"Transfer Characteristics: "
79-
f"{list(colour.TRANSFER_CHARACTERISTICS_ITUTH273.keys())}"
78+
f"Transfer Characteristics: {list(colour.TRANSFER_CHARACTERISTICS_ITUTH273.keys())}"
8079
)
8180
colour.models.describe_video_signal_transfer_characteristics(1)
8281

colour/examples/plotting/examples_colorimetry_plots.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@
3636
print("\n")
3737

3838
message_box(
39-
'Plotting "CIE Standard Illuminant "A", "B", and "C" with their '
40-
"normalised colours."
39+
'Plotting "CIE Standard Illuminant "A", "B", and "C" with their normalised colours.'
4140
)
4241
plot_multi_illuminant_sds(
4342
["A", "B", "C"],

colour/examples/plotting/examples_models_plots.py

+4-8
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,7 @@
8787
print("\n")
8888

8989
message_box(
90-
'Plotting a single custom "RGB" colourspace in the '
91-
'"CIE 1931 Chromaticity Diagram".'
90+
'Plotting a single custom "RGB" colourspace in the "CIE 1931 Chromaticity Diagram".'
9291
)
9392
AWFUL_RGB = colour.RGB_Colourspace(
9493
"Awful RGB",
@@ -107,21 +106,18 @@
107106
print("\n")
108107

109108
message_box(
110-
'Plotting a single "RGB" colourspace encoding colour component transfer '
111-
"function."
109+
'Plotting a single "RGB" colourspace encoding colour component transfer function.'
112110
)
113111
plot_single_cctf("ITU-R BT.709")
114112

115113
print("\n")
116114

117115
message_box(
118-
'Plotting multiple "RGB" colourspaces encoding colour component transfer '
119-
"functions."
116+
'Plotting multiple "RGB" colourspaces encoding colour component transfer functions.'
120117
)
121118
plot_multi_cctfs(["ITU-R BT.709", "sRGB"])
122119

123120
message_box(
124-
'Plotting multiple "RGB" colourspaces decoding colour component transfer '
125-
"functions."
121+
'Plotting multiple "RGB" colourspaces decoding colour component transfer functions.'
126122
)
127123
plot_multi_cctfs(["ACES2065-1", "ProPhoto RGB"], cctf_decoding=True)

colour/examples/quality/examples_cfi.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,7 @@
2121
print("\n")
2222

2323
message_box(
24-
'Computing "F2" illuminant "Colour Fidelity Index" (CFI) with detailed '
25-
"output data."
24+
'Computing "F2" illuminant "Colour Fidelity Index" (CFI) with detailed output data.'
2625
)
2726
pprint(
2827
colour.colour_fidelity_index(colour.SDS_ILLUMINANTS["FL2"], additional_data=True)

colour/examples/volume/examples_rgb.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616

1717
samples = int(10e4)
1818
message_box(
19-
f'Computing the "ProPhoto RGB" RGB colourspace volume using {samples} '
20-
f"samples."
19+
f'Computing the "ProPhoto RGB" RGB colourspace volume using {samples} samples.'
2120
)
2221
print(
2322
colour.RGB_colourspace_volume_MonteCarlo(

colour/io/fichet2021.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -307,7 +307,7 @@ class Specification_Fichet2021:
307307
References
308308
----------
309309
:cite:`Fichet2021`
310-
""" # noqa: D405, D407, D410, D411
310+
"""
311311

312312
path: str | None = field(default_factory=lambda: None)
313313
components: defaultdict = field(default_factory=lambda: defaultdict(dict))
@@ -848,13 +848,13 @@ def write_spectral_image_Fichet2021(
848848
for i, wavelength in enumerate(wavelengths):
849849
component_type = str(component)[0]
850850
if component_type == "S": # Emissive Component Type # noqa: SIM114
851-
channel_name = f'{component}.{str(wavelength).replace(".", ",")}nm'
851+
channel_name = f"{component}.{str(wavelength).replace('.', ',')}nm"
852852
elif component_type == "T": # Reflectance et al. Component Type
853-
channel_name = f'{component}.{str(wavelength).replace(".", ",")}nm'
853+
channel_name = f"{component}.{str(wavelength).replace('.', ',')}nm"
854854
else: # Bi-spectral Component Type
855855
channel_name = (
856-
f'T.{str(component).replace(".", ",")}nm.'
857-
f'{str(wavelength).replace(".", ",")}nm'
856+
f"T.{str(component).replace('.', ',')}nm."
857+
f"{str(wavelength).replace('.', ',')}nm"
858858
)
859859

860860
channels[channel_name] = values[..., i]

colour/io/image.py

+4-4
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ def add_attributes_to_image_specification_OpenImageIO(
176176
... ) # doctest: +SKIP
177177
>>> image_specification.extra_attribs[0].value # doctest: +SKIP
178178
'none'
179-
""" # noqa: D405, D407, D410, D411
179+
"""
180180

181181
for attribute in attributes:
182182
name = str(attribute.name)
@@ -234,7 +234,7 @@ def image_specification_OpenImageIO(
234234
... 1920, 1080, 3, "float16", [compression]
235235
... ) # doctest: +SKIP
236236
<OpenImageIO.ImageSpec object at 0x...>
237-
""" # noqa: D405, D407, D410, D411
237+
"""
238238

239239
from OpenImageIO import ImageSpec # pyright: ignore
240240

@@ -687,7 +687,7 @@ def write_image_OpenImageIO(
687687
... Image_Specification_Attribute("compression", "none"),
688688
... ]
689689
... write_image_OpenImageIO(image, path, attributes=attributes)
690-
""" # noqa: D405, D407, D410, D411
690+
"""
691691

692692
from OpenImageIO import ImageOutput # pyright: ignore
693693

@@ -901,7 +901,7 @@ def write_image(
901901
>>> write_image(image, path, bit_depth="uint8", attributes=[compression])
902902
... # doctest: +SKIP
903903
True
904-
""" # noqa: D405, D407, D410, D411, D414
904+
"""
905905

906906
method = validate_method(method, tuple(WRITE_IMAGE_METHODS))
907907

colour/io/luts/operator.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -403,7 +403,7 @@ def __repr__(self) -> str:
403403
[
404404
f"{representation[:-1]},",
405405
f"{indentation}"
406-
f'{repr(self._offset).replace("array(", "").replace(")", "")},',
406+
f"{repr(self._offset).replace('array(', '').replace(')', '')},",
407407
f"{indentation}name='{self._name}'{comments})",
408408
]
409409
)

colour/io/luts/sequence.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -141,8 +141,7 @@ def sequence(self, value: Sequence[ProtocolLUTSequenceItem]) -> None:
141141
for item in value:
142142
attest(
143143
isinstance(item, ProtocolLUTSequenceItem),
144-
'"value" items must implement the "ProtocolLUTSequenceItem" '
145-
"protocol!",
144+
'"value" items must implement the "ProtocolLUTSequenceItem" protocol!',
146145
)
147146

148147
self._sequence = list(value)
@@ -179,8 +178,7 @@ def __setitem__(self, index: int | slice, value: Any) -> None:
179178
for item in value if is_iterable(value) else [value]:
180179
attest(
181180
isinstance(item, ProtocolLUTSequenceItem),
182-
'"value" items must implement the "ProtocolLUTSequenceItem" '
183-
"protocol!",
181+
'"value" items must implement the "ProtocolLUTSequenceItem" protocol!',
184182
)
185183

186184
self._sequence[index] = value

colour/io/tm2714.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -1676,8 +1676,7 @@ def read(self) -> SpectralDistribution_IESTM2714:
16761676
namespace = match.group(1)
16771677
else:
16781678
error = (
1679-
'The "IES TM-27-14" spectral distribution namespace '
1680-
"was not found!"
1679+
'The "IES TM-27-14" spectral distribution namespace was not found!'
16811680
)
16821681

16831682
raise ValueError(error)

colour/io/uprtek_sekonic.py

+1-4
Original file line numberDiff line numberDiff line change
@@ -279,10 +279,7 @@ def __str__(self) -> str:
279279
representation = super().__str__()
280280

281281
return representation.replace(
282-
(
283-
"IES TM-27-14 Spectral Distribution\n"
284-
"=================================="
285-
),
282+
("IES TM-27-14 Spectral Distribution\n=================================="),
286283
"UPRTek\n======",
287284
)
288285

colour/notation/munsell.py

+9-14
Original file line numberDiff line numberDiff line change
@@ -352,9 +352,9 @@ def _munsell_value_ASTMD1535_interpolator() -> Extrapolator:
352352
return extrapolator
353353

354354

355-
def _munsell_maximum_chromas_from_renotation() -> (
356-
Tuple[Tuple[Tuple[float, float], float], ...]
357-
):
355+
def _munsell_maximum_chromas_from_renotation() -> Tuple[
356+
Tuple[Tuple[float, float], float], ...
357+
]:
358358
"""
359359
Return the maximum *Munsell* chromas from *Munsell Renotation System* data
360360
and caches them if not existing.
@@ -1658,8 +1658,7 @@ def munsell_specification_to_munsell_colour(
16581658
hue = round(hue, hue_decimals)
16591659
attest(
16601660
0 <= hue <= 10,
1661-
f'"{specification!r}" specification hue must be normalised to '
1662-
f"domain [0, 10]!",
1661+
f'"{specification!r}" specification hue must be normalised to domain [0, 10]!',
16631662
)
16641663

16651664
value = round(value, value_decimals)
@@ -2055,8 +2054,7 @@ def interpolation_method_from_renotation_ovoid(
20552054

20562055
attest(
20572056
abs(2 * (chroma / 2 - round(chroma / 2))) <= THRESHOLD_INTEGER,
2058-
f'"{specification}" specification chroma must be an int and '
2059-
f"multiple of 2!",
2057+
f'"{specification}" specification chroma must be an int and multiple of 2!',
20602058
)
20612059

20622060
chroma = 2 * round(chroma / 2)
@@ -2318,8 +2316,7 @@ def xy_from_renotation_ovoid(specification: ArrayLike) -> NDArrayFloat:
23182316

23192317
attest(
23202318
1 <= value <= 9,
2321-
f'"{specification}" specification value must be normalised to '
2322-
f"domain [1, 9]!",
2319+
f'"{specification}" specification value must be normalised to domain [1, 9]!',
23232320
)
23242321

23252322
attest(
@@ -2331,8 +2328,7 @@ def xy_from_renotation_ovoid(specification: ArrayLike) -> NDArrayFloat:
23312328

23322329
attest(
23332330
2 <= chroma <= 50,
2334-
f'"{specification}" specification chroma must be normalised to '
2335-
f"domain [2, 50]!",
2331+
f'"{specification}" specification chroma must be normalised to domain [2, 50]!',
23362332
)
23372333

23382334
attest(
@@ -2398,7 +2394,7 @@ def xy_from_renotation_ovoid(specification: ArrayLike) -> NDArrayFloat:
23982394

23992395
attest(
24002396
interpolation_method is not None,
2401-
f"Interpolation method must be one of: \"{'Linear, Radial'}\"",
2397+
f'Interpolation method must be one of: "{"Linear, Radial"}"',
24022398
)
24032399

24042400
hue_angle_lower_upper = np.squeeze([hue_angle_lower, hue_angle_upper])
@@ -2615,8 +2611,7 @@ def munsell_specification_to_xy(specification: ArrayLike) -> NDArrayFloat:
26152611

26162612
attest(
26172613
0 <= value <= 10,
2618-
f'"{specification}" specification value must be normalised to '
2619-
f"domain [0, 10]!",
2614+
f'"{specification}" specification value must be normalised to domain [0, 10]!',
26202615
)
26212616

26222617
attest(

colour/plotting/common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@
225225
# affecting *Matplotplib* ones.
226226
for _scaling, _value in CONSTANTS_COLOUR_STYLE.font.scaling.items():
227227
matplotlib.font_manager.font_scalings[
228-
f'{_scaling.replace("_", "-")}-colour-science'
228+
f"{_scaling.replace('_', '-')}-colour-science"
229229
] = _value
230230

231231
del _scaling, _value

colour/plotting/quality.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -490,8 +490,7 @@ def plot_multi_sds_colour_quality_scales_bars(
490490
_figure, axes = plot_colour_quality_bars(specifications, **settings)
491491

492492
title = (
493-
f"Colour Quality Scale - "
494-
f"{', '.join([sd.display_name for sd in sds_converted])}"
493+
f"Colour Quality Scale - {', '.join([sd.display_name for sd in sds_converted])}"
495494
)
496495

497496
settings = {"axes": axes, "title": title}

0 commit comments

Comments
 (0)