Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[pre-commit.ci] pre-commit autoupdate #1080

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ repos:
hooks:
- id: isort
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.8.2"
rev: "v0.9.1"
hooks:
- id: ruff-format
- id: ruff
Expand Down
22 changes: 10 additions & 12 deletions colour/algebra/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,18 +71,16 @@
"""


def get_sdiv_mode() -> (
Literal[
"Numpy",
"Ignore",
"Warning",
"Raise",
"Ignore Zero Conversion",
"Warning Zero Conversion",
"Ignore Limit Conversion",
"Warning Limit Conversion",
]
):
def get_sdiv_mode() -> Literal[
"Numpy",
"Ignore",
"Warning",
"Raise",
"Ignore Zero Conversion",
"Warning Zero Conversion",
"Ignore Limit Conversion",
"Warning Limit Conversion",
]:
"""
Return *Colour* safe division mode.

Expand Down
3 changes: 1 addition & 2 deletions colour/algebra/interpolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -1136,8 +1136,7 @@ def y(self, value: ArrayLike) -> None:

attest(
len(value) >= 6,
'"y" dependent variable values count must be equal to or '
"greater than 6!",
'"y" dependent variable values count must be equal to or greater than 6!',
)

self._y = value
Expand Down
12 changes: 6 additions & 6 deletions colour/characterisation/aces_it.py
Original file line number Diff line number Diff line change
Expand Up @@ -733,9 +733,9 @@ def whitepoint_preserving_matrix(
return M


def optimisation_factory_rawtoaces_v1() -> (
Tuple[NDArrayFloat, Callable, Callable, Callable]
):
def optimisation_factory_rawtoaces_v1() -> Tuple[
NDArrayFloat, Callable, Callable, Callable
]:
"""
Produce the objective function and *CIE XYZ* colourspace to optimisation
colourspace/colour model function according to *RAW to ACES* v1.
Expand Down Expand Up @@ -862,9 +862,9 @@ def finaliser_function(M: ArrayLike) -> NDArrayFloat:
)


def optimisation_factory_Oklab_15() -> (
Tuple[NDArrayFloat, Callable, Callable, Callable]
):
def optimisation_factory_Oklab_15() -> Tuple[
NDArrayFloat, Callable, Callable, Callable
]:
"""
Produce the objective function and *CIE XYZ* colourspace to optimisation
colourspace/colour model function based on the *Oklab* colourspace.
Expand Down
3 changes: 1 addition & 2 deletions colour/colorimetry/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -1885,8 +1885,7 @@ def display_labels(self, value: Sequence) -> None:

attest(
is_iterable(value),
f'"display_labels" property: "{value}" is not an "iterable" like '
f"object!",
f'"display_labels" property: "{value}" is not an "iterable" like object!',
)

attest(
Expand Down
3 changes: 1 addition & 2 deletions colour/colorimetry/tristimulus_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -1274,8 +1274,7 @@ def sd_to_XYZ(

if isinstance(sd, MultiSpectralDistributions):
runtime_warning(
"A multi-spectral distributions was passed, enforcing integration "
"method!"
"A multi-spectral distributions was passed, enforcing integration method!"
)
function = sd_to_XYZ_integration
else:
Expand Down
3 changes: 1 addition & 2 deletions colour/continuous/multi_signals.py
Original file line number Diff line number Diff line change
Expand Up @@ -1510,8 +1510,7 @@ def multi_signals_unpack_data(
for signal in signals.values():
attest(
len(domain_array) == len(signal.domain),
'User "domain" length is not compatible with unpacked '
'"signals"!',
'User "domain" length is not compatible with unpacked "signals"!',
)

signal.domain = domain_array
Expand Down
3 changes: 1 addition & 2 deletions colour/examples/models/examples_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -413,8 +413,7 @@

Lab = np.array([0.51634019, 0.15469500, 0.06289579])
message_box(
f'Converting to "CIE XYZ" tristimulus values from "Oklab" colourspace:\n\n'
f"\t{Lab}"
f'Converting to "CIE XYZ" tristimulus values from "Oklab" colourspace:\n\n\t{Lab}'
)
print(colour.Oklab_to_XYZ(Lab))

Expand Down
3 changes: 1 addition & 2 deletions colour/examples/models/examples_rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,7 @@
print("\n")

message_box(
f"Transfer Characteristics: "
f"{list(colour.TRANSFER_CHARACTERISTICS_ITUTH273.keys())}"
f"Transfer Characteristics: {list(colour.TRANSFER_CHARACTERISTICS_ITUTH273.keys())}"
)
colour.models.describe_video_signal_transfer_characteristics(1)

Expand Down
3 changes: 1 addition & 2 deletions colour/examples/plotting/examples_colorimetry_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,7 @@
print("\n")

message_box(
'Plotting "CIE Standard Illuminant "A", "B", and "C" with their '
"normalised colours."
'Plotting "CIE Standard Illuminant "A", "B", and "C" with their normalised colours.'
)
plot_multi_illuminant_sds(
["A", "B", "C"],
Expand Down
12 changes: 4 additions & 8 deletions colour/examples/plotting/examples_models_plots.py
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,7 @@
print("\n")

message_box(
'Plotting a single custom "RGB" colourspace in the '
'"CIE 1931 Chromaticity Diagram".'
'Plotting a single custom "RGB" colourspace in the "CIE 1931 Chromaticity Diagram".'
)
AWFUL_RGB = colour.RGB_Colourspace(
"Awful RGB",
Expand All @@ -107,21 +106,18 @@
print("\n")

message_box(
'Plotting a single "RGB" colourspace encoding colour component transfer '
"function."
'Plotting a single "RGB" colourspace encoding colour component transfer function.'
)
plot_single_cctf("ITU-R BT.709")

print("\n")

message_box(
'Plotting multiple "RGB" colourspaces encoding colour component transfer '
"functions."
'Plotting multiple "RGB" colourspaces encoding colour component transfer functions.'
)
plot_multi_cctfs(["ITU-R BT.709", "sRGB"])

message_box(
'Plotting multiple "RGB" colourspaces decoding colour component transfer '
"functions."
'Plotting multiple "RGB" colourspaces decoding colour component transfer functions.'
)
plot_multi_cctfs(["ACES2065-1", "ProPhoto RGB"], cctf_decoding=True)
3 changes: 1 addition & 2 deletions colour/examples/quality/examples_cfi.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,7 @@
print("\n")

message_box(
'Computing "F2" illuminant "Colour Fidelity Index" (CFI) with detailed '
"output data."
'Computing "F2" illuminant "Colour Fidelity Index" (CFI) with detailed output data.'
)
pprint(
colour.colour_fidelity_index(colour.SDS_ILLUMINANTS["FL2"], additional_data=True)
Expand Down
3 changes: 1 addition & 2 deletions colour/examples/volume/examples_rgb.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@

samples = int(10e4)
message_box(
f'Computing the "ProPhoto RGB" RGB colourspace volume using {samples} '
f"samples."
f'Computing the "ProPhoto RGB" RGB colourspace volume using {samples} samples.'
)
print(
colour.RGB_colourspace_volume_MonteCarlo(
Expand Down
8 changes: 4 additions & 4 deletions colour/io/fichet2021.py
Original file line number Diff line number Diff line change
Expand Up @@ -852,13 +852,13 @@ def write_spectral_image_Fichet2021(
for i, wavelength in enumerate(wavelengths):
component_type = str(component)[0]
if component_type == "S": # Emissive Component Type # noqa: SIM114
channel_name = f'{component}.{str(wavelength).replace(".", ",")}nm'
channel_name = f"{component}.{str(wavelength).replace('.', ',')}nm"
elif component_type == "T": # Reflectance et al. Component Type
channel_name = f'{component}.{str(wavelength).replace(".", ",")}nm'
channel_name = f"{component}.{str(wavelength).replace('.', ',')}nm"
else: # Bi-spectral Component Type
channel_name = (
f'T.{str(component).replace(".", ",")}nm.'
f'{str(wavelength).replace(".", ",")}nm'
f"T.{str(component).replace('.', ',')}nm."
f"{str(wavelength).replace('.', ',')}nm"
)

channels[channel_name] = values[..., i]
Expand Down
2 changes: 1 addition & 1 deletion colour/io/luts/operator.py
Original file line number Diff line number Diff line change
Expand Up @@ -403,7 +403,7 @@ def __repr__(self) -> str:
[
f"{representation[:-1]},",
f"{indentation}"
f'{repr(self._offset).replace("array(", "").replace(")", "")},',
f"{repr(self._offset).replace('array(', '').replace(')', '')},",
f"{indentation}name='{self._name}'{comments})",
]
)
Expand Down
6 changes: 2 additions & 4 deletions colour/io/luts/sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -141,8 +141,7 @@ def sequence(self, value: Sequence[ProtocolLUTSequenceItem]) -> None:
for item in value:
attest(
isinstance(item, ProtocolLUTSequenceItem),
'"value" items must implement the "ProtocolLUTSequenceItem" '
"protocol!",
'"value" items must implement the "ProtocolLUTSequenceItem" protocol!',
)

self._sequence = list(value)
Expand Down Expand Up @@ -179,8 +178,7 @@ def __setitem__(self, index: int | slice, value: Any) -> None:
for item in value if is_iterable(value) else [value]:
attest(
isinstance(item, ProtocolLUTSequenceItem),
'"value" items must implement the "ProtocolLUTSequenceItem" '
"protocol!",
'"value" items must implement the "ProtocolLUTSequenceItem" protocol!',
)

self._sequence[index] = value
Expand Down
3 changes: 1 addition & 2 deletions colour/io/tm2714.py
Original file line number Diff line number Diff line change
Expand Up @@ -1676,8 +1676,7 @@ def read(self) -> SpectralDistribution_IESTM2714:
namespace = match.group(1)
else:
error = (
'The "IES TM-27-14" spectral distribution namespace '
"was not found!"
'The "IES TM-27-14" spectral distribution namespace was not found!'
)

raise ValueError(error)
Expand Down
5 changes: 1 addition & 4 deletions colour/io/uprtek_sekonic.py
Original file line number Diff line number Diff line change
Expand Up @@ -279,10 +279,7 @@ def __str__(self) -> str:
representation = super().__str__()

return representation.replace(
(
"IES TM-27-14 Spectral Distribution\n"
"=================================="
),
("IES TM-27-14 Spectral Distribution\n=================================="),
"UPRTek\n======",
)

Expand Down
23 changes: 9 additions & 14 deletions colour/notation/munsell.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,9 +352,9 @@ def _munsell_value_ASTMD1535_interpolator() -> Extrapolator:
return extrapolator


def _munsell_maximum_chromas_from_renotation() -> (
Tuple[Tuple[Tuple[float, float], float], ...]
):
def _munsell_maximum_chromas_from_renotation() -> Tuple[
Tuple[Tuple[float, float], float], ...
]:
"""
Return the maximum *Munsell* chromas from *Munsell Renotation System* data
and caches them if not existing.
Expand Down Expand Up @@ -1658,8 +1658,7 @@ def munsell_specification_to_munsell_colour(
hue = round(hue, hue_decimals)
attest(
0 <= hue <= 10,
f'"{specification!r}" specification hue must be normalised to '
f"domain [0, 10]!",
f'"{specification!r}" specification hue must be normalised to domain [0, 10]!',
)

value = round(value, value_decimals)
Expand Down Expand Up @@ -2055,8 +2054,7 @@ def interpolation_method_from_renotation_ovoid(

attest(
abs(2 * (chroma / 2 - round(chroma / 2))) <= THRESHOLD_INTEGER,
f'"{specification}" specification chroma must be an int and '
f"multiple of 2!",
f'"{specification}" specification chroma must be an int and multiple of 2!',
)

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

attest(
1 <= value <= 9,
f'"{specification}" specification value must be normalised to '
f"domain [1, 9]!",
f'"{specification}" specification value must be normalised to domain [1, 9]!',
)

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

attest(
2 <= chroma <= 50,
f'"{specification}" specification chroma must be normalised to '
f"domain [2, 50]!",
f'"{specification}" specification chroma must be normalised to domain [2, 50]!',
)

attest(
Expand Down Expand Up @@ -2398,7 +2394,7 @@ def xy_from_renotation_ovoid(specification: ArrayLike) -> NDArrayFloat:

attest(
interpolation_method is not None,
f"Interpolation method must be one of: \"{'Linear, Radial'}\"",
f'Interpolation method must be one of: "{"Linear, Radial"}"',
)

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

attest(
0 <= value <= 10,
f'"{specification}" specification value must be normalised to '
f"domain [0, 10]!",
f'"{specification}" specification value must be normalised to domain [0, 10]!',
)

attest(
Expand Down
2 changes: 1 addition & 1 deletion colour/plotting/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@
# affecting *Matplotplib* ones.
for _scaling, _value in CONSTANTS_COLOUR_STYLE.font.scaling.items():
matplotlib.font_manager.font_scalings[
f'{_scaling.replace("_", "-")}-colour-science'
f"{_scaling.replace('_', '-')}-colour-science"
] = _value

del _scaling, _value
Expand Down
3 changes: 1 addition & 2 deletions colour/plotting/quality.py
Original file line number Diff line number Diff line change
Expand Up @@ -490,8 +490,7 @@ def plot_multi_sds_colour_quality_scales_bars(
_figure, axes = plot_colour_quality_bars(specifications, **settings)

title = (
f"Colour Quality Scale - "
f"{', '.join([sd.display_name for sd in sds_converted])}"
f"Colour Quality Scale - {', '.join([sd.display_name for sd in sds_converted])}"
)

settings = {"axes": axes, "title": title}
Expand Down
2 changes: 1 addition & 1 deletion colour/plotting/temperature.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,7 +512,7 @@ def plot_planckian_locus(
axes.text(
lines_itl[i][-1, 0],
lines_itl[i][-1, 1],
f'{as_int_scalar(label)}{"M" if planckian_locus_mireds else "K"}',
f"{as_int_scalar(label)}{'M' if planckian_locus_mireds else 'K'}",
clip_on=True,
ha="left",
va="bottom",
Expand Down
3 changes: 1 addition & 2 deletions colour/utilities/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -741,8 +741,7 @@ def node(self, value: PortNode | None) -> None:

attest(
value is None or isinstance(value, PortNode),
f'"node" property: "{value}" is not "None" or '
f'its type is not "PortNode"!',
f'"node" property: "{value}" is not "None" or its type is not "PortNode"!',
)

self._node = value
Expand Down
8 changes: 4 additions & 4 deletions colour/utilities/verbose.py
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,9 @@ def inner(text: str) -> str:
"""Format and pads inner text for the message box."""

return (
f'*{" " * padding}'
f'{text}{" " * (width - len(text) - padding * 2 - 2)}'
f'{" " * padding}*'
f"*{' ' * padding}"
f"{text}{' ' * (width - len(text) - padding * 2 - 2)}"
f"{' ' * padding}*"
)

print_callable("=" * width)
Expand Down Expand Up @@ -322,7 +322,7 @@ def warning(*args: Any, **kwargs: Any) -> None:

kwargs["category"] = kwargs.get("category", ColourWarning)

warn(*args, **kwargs) # noqa: B028
warn(*args, **kwargs)


def runtime_warning(*args: Any, **kwargs: Any) -> None:
Expand Down
Loading