Skip to content

Commit 4768f98

Browse files
committed
Merge branch 'feature/v0.4.3' into develop
2 parents 3f93827 + e846955 commit 4768f98

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+263
-360
lines changed

.pre-commit-config.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
repos:
22
- repo: https://github.com/ikamensh/flynt/
3-
rev: '0.77'
3+
rev: '1.0.1'
44
hooks:
55
- id: flynt
66
- repo: https://github.com/charliermarsh/ruff-pre-commit
7-
rev: 'v0.0.239'
7+
rev: 'v0.0.280'
88
hooks:
99
- id: ruff
1010
- repo: https://github.com/psf/black
11-
rev: 22.10.0
11+
rev: 23.7.0
1212
hooks:
1313
- id: black
1414
language_version: python3.9

colour/algebra/common.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ def set_sdiv_mode(
143143
raise
144144
"""
145145

146-
global _SDIV_MODE
146+
global _SDIV_MODE # noqa: PLW0603
147147

148148
_SDIV_MODE = cast(
149149
Literal[
@@ -397,7 +397,7 @@ def set_spow_enable(enable: bool):
397397
False
398398
"""
399399

400-
global _SPOW_ENABLED
400+
global _SPOW_ENABLED # noqa: PLW0603
401401

402402
_SPOW_ENABLED = enable
403403

colour/algebra/prng.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
Defines the random number generator objects:
66
77
- :func:`colour.algebra.random_triplet_generator`
8+
89
References
910
----------
1011
- :cite:`Laurent2012a` : Laurent. (2012). Reproducibility of python

colour/appearance/tests/test_llab.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,6 @@ def test_XYZ_to_LLAB(self):
5151
"colour.appearance.llab.MATRIX_RGB_TO_XYZ_LLAB",
5252
np.around(np.linalg.inv(llab.MATRIX_XYZ_TO_RGB_LLAB), decimals=4),
5353
):
54-
5554
XYZ = np.array([19.01, 20.00, 21.78])
5655
XYZ_0 = np.array([95.05, 100.00, 108.88])
5756
Y_b = 20

colour/blindness/machado2009.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ def matrix_RGB_to_WSYBRG(
111111
WSYBRG = vector_dot(MATRIX_LMS_TO_WSYBRG, cmfs.values)
112112
WS, YB, RG = tsplit(WSYBRG)
113113

114-
# pylint: disable=E1102
115114
primaries = reshape_msds(
116115
primaries,
117116
cmfs.shape,
@@ -304,7 +303,6 @@ def matrix_anomalous_trichromacy_Machado2009(
304303
"""
305304

306305
if cmfs.shape.interval != 1:
307-
# pylint: disable=E1102
308306
cmfs = reshape_msds(
309307
cmfs,
310308
SpectralShape(cmfs.shape.start, cmfs.shape.end, 1),

colour/characterisation/aces_it.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ def read_training_data_rawtoaces_v1() -> MultiSpectralDistributions:
337337
190
338338
"""
339339

340-
global _TRAINING_DATA_RAWTOACES_V1
340+
global _TRAINING_DATA_RAWTOACES_V1 # noqa: PLW0603
341341

342342
if _TRAINING_DATA_RAWTOACES_V1 is not None:
343343
training_data = _TRAINING_DATA_RAWTOACES_V1
@@ -391,7 +391,7 @@ def generate_illuminants_rawtoaces_v1() -> CanonicalMapping:
391391
'D80', 'D85', 'D90', 'D95', 'iso7589']
392392
"""
393393

394-
global _ILLUMINANTS_RAWTOACES_V1
394+
global _ILLUMINANTS_RAWTOACES_V1 # noqa: PLW0603
395395

396396
if _ILLUMINANTS_RAWTOACES_V1 is not None:
397397
illuminants = _ILLUMINANTS_RAWTOACES_V1
@@ -647,7 +647,6 @@ def training_data_sds_to_RGB(
647647
runtime_warning(
648648
f'Aligning "{training_data.name}" training data shape to "{shape}".'
649649
)
650-
# pylint: disable=E1102
651650
training_data = reshape_msds(training_data, shape, copy=False)
652651

653652
RGB_w = white_balance_multipliers(sensitivities, illuminant)
@@ -739,7 +738,6 @@ def training_data_sds_to_XYZ(
739738
runtime_warning(
740739
f'Aligning "{training_data.name}" training data shape to "{shape}".'
741740
)
742-
# pylint: disable=E1102
743741
training_data = reshape_msds(training_data, shape, copy=False)
744742

745743
XYZ = np.dot(
@@ -1154,14 +1152,12 @@ def matrix_idt(
11541152
runtime_warning(
11551153
f'Aligning "{sensitivities.name}" sensitivities shape to "{shape}".'
11561154
)
1157-
# pylint: disable=E1102
11581155
sensitivities = reshape_msds(sensitivities, shape, copy=False)
11591156

11601157
if training_data.shape != shape:
11611158
runtime_warning(
11621159
f'Aligning "{training_data.name}" training data shape to "{shape}".'
11631160
)
1164-
# pylint: disable=E1102
11651161
training_data = reshape_msds(training_data, shape, copy=False)
11661162

11671163
illuminant = normalise_illuminant(illuminant, sensitivities)

colour/characterisation/cameras.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,16 +25,13 @@
2525
)
2626
from colour.utilities import is_pandas_installed
2727

28-
if TYPE_CHECKING:
28+
if TYPE_CHECKING or is_pandas_installed():
2929
from pandas import DataFrame, Series # pragma: no cover
30-
else:
31-
if is_pandas_installed():
32-
from pandas import DataFrame, Series
33-
else: # pragma: no cover
34-
from unittest import mock
30+
else: # pragma: no cover
31+
from unittest import mock
3532

36-
DataFrame = mock.MagicMock()
37-
Series = mock.MagicMock()
33+
DataFrame = mock.MagicMock()
34+
Series = mock.MagicMock()
3835

3936
__author__ = "Colour Developers"
4037
__copyright__ = "Copyright 2013 Colour Developers"

colour/characterisation/correction.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ def matrix_augmented_Cheung2004(
168168
f"{closest_terms} terms!"
169169
)
170170

171-
if terms == 3:
171+
if terms == 3: # noqa: RET503
172172
return RGB
173173
elif terms == 4:
174174
return tstack([R, G, B, tail])
@@ -376,7 +376,7 @@ def matrix_augmented_Cheung2004(
376376
R * G * B**2,
377377
]
378378
)
379-
elif terms == 35: # noqa: RET503
379+
elif terms == 35:
380380
return tstack(
381381
[
382382
R,
@@ -468,7 +468,7 @@ def polynomial_expansion_Finlayson2015(
468468
f"{closest_degree} degree!"
469469
)
470470

471-
if degree == 1:
471+
if degree == 1: # noqa: RET503
472472
return RGB
473473
elif degree == 2:
474474
if root_polynomial_expansion:
@@ -540,7 +540,7 @@ def polynomial_expansion_Finlayson2015(
540540
R * G * B,
541541
]
542542
)
543-
elif degree == 4: # noqa: RET503
543+
elif degree == 4:
544544
if root_polynomial_expansion:
545545
return tstack(
546546
[

colour/characterisation/displays.py

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,13 @@
2626
)
2727
from colour.utilities import is_pandas_installed
2828

29-
if TYPE_CHECKING:
29+
if TYPE_CHECKING or is_pandas_installed():
3030
from pandas import DataFrame, Series # pragma: no cover
31-
else:
32-
if is_pandas_installed():
33-
from pandas import DataFrame, Series
34-
else: # pragma: no cover
35-
from unittest import mock
31+
else: # pragma: no cover
32+
from unittest import mock
3633

37-
DataFrame = mock.MagicMock()
38-
Series = mock.MagicMock()
34+
DataFrame = mock.MagicMock()
35+
Series = mock.MagicMock()
3936

4037
__author__ = "Colour Developers"
4138
__copyright__ = "Copyright 2013 Colour Developers"

colour/characterisation/tests/test_aces_it.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1124,7 +1124,6 @@ def test_matrix_idt(self):
11241124
SDS_COLOURCHECKERS["BabelColor Average"].values()
11251125
)
11261126

1127-
# pylint: disable=E1102
11281127
np.testing.assert_allclose(
11291128
matrix_idt(
11301129
reshape_msds(

0 commit comments

Comments
 (0)