Skip to content

Commit

Permalink
Disable various "Pylint" "E1102" false-positives.
Browse files Browse the repository at this point in the history
  • Loading branch information
KelSolaar committed Aug 1, 2021
1 parent b1d41e8 commit cac282f
Show file tree
Hide file tree
Showing 18 changed files with 49 additions and 0 deletions.
2 changes: 2 additions & 0 deletions colour/blindness/machado2009.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ def matrix_RGB_to_WSYBRG(cmfs, primaries):
WSYBRG = vector_dot(MATRIX_LMS_TO_WSYBRG, cmfs.values)
WS, YB, RG = tsplit(WSYBRG)

# pylint: disable=E1102
primaries = reshape_msds(
primaries,
cmfs.shape,
Expand Down Expand Up @@ -278,6 +279,7 @@ def matrix_anomalous_trichromacy_Machado2009(cmfs, primaries, d_LMS):
"""

if cmfs.shape.interval != 1:
# pylint: disable=E1102
cmfs = reshape_msds(cmfs, SpectralShape(interval=1), 'Interpolate')

M_n = matrix_RGB_to_WSYBRG(cmfs, primaries)
Expand Down
5 changes: 5 additions & 0 deletions colour/characterisation/aces_it.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,6 +537,7 @@ def training_data_sds_to_RGB(training_data, sensitivities, illuminant):
if training_data.shape != shape:
runtime_warning('Aligning "{0}" training data shape to "{1}".'.format(
training_data.name, shape))
# pylint: disable=E1102
training_data = reshape_msds(training_data, shape)

RGB_w = white_balance_multipliers(sensitivities, illuminant)
Expand Down Expand Up @@ -610,6 +611,7 @@ def training_data_sds_to_XYZ(training_data,
if training_data.shape != shape:
runtime_warning('Aligning "{0}" training data shape to "{1}".'.format(
training_data.name, shape))
# pylint: disable=E1102
training_data = reshape_msds(training_data, shape)

XYZ = np.dot(
Expand Down Expand Up @@ -822,6 +824,7 @@ def matrix_idt(sensitivities,
training_data = read_training_data_rawtoaces_v1()

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER['CIE 1931 2 Degree Standard Observer'],
SPECTRAL_SHAPE_RAWTOACES)
Expand All @@ -830,6 +833,7 @@ def matrix_idt(sensitivities,
if sensitivities.shape != shape:
runtime_warning('Aligning "{0}" sensitivities shape to "{1}".'.format(
sensitivities.name, shape))
# pylint: disable=E1102
sensitivities = reshape_msds(sensitivities, shape)

if illuminant.shape != shape:
Expand All @@ -840,6 +844,7 @@ def matrix_idt(sensitivities,
if training_data.shape != shape:
runtime_warning('Aligning "{0}" training data shape to "{1}".'.format(
training_data.name, shape))
# pylint: disable=E1102
training_data = reshape_msds(training_data, shape)

illuminant = normalise_illuminant(illuminant, sensitivities)
Expand Down
2 changes: 2 additions & 0 deletions colour/colorimetry/tests/test_spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -1684,6 +1684,7 @@ def test_interpolate(self):
MultiSpectralDistributions.interpolate` method.
"""

# pylint: disable=E1102
msds = reshape_msds(
self._sample_msds, SpectralShape(interval=1), 'Interpolate')
for signal in msds.signals.values():
Expand All @@ -1696,6 +1697,7 @@ def test_interpolate(self):
if LooseVersion(scipy.__version__) < LooseVersion('0.19.0'):
return # pragma: no cover

# pylint: disable=E1102
msds = reshape_msds(
self._non_uniform_sample_msds,
SpectralShape(interval=1),
Expand Down
2 changes: 2 additions & 0 deletions colour/colorimetry/tests/test_tristimulus_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,7 @@ def test_raise_exception_tristimulus_weighting_factors_ASTME2022(self):
shape = SpectralShape(360, 830, 10)
cmfs_1 = MSDS_CMFS_STANDARD_OBSERVER[
'CIE 1964 10 Degree Standard Observer']
# pylint: disable=E1102
cmfs_2 = reshape_msds(cmfs_1, shape)
A_1 = sd_CIE_standard_illuminant_A(cmfs_1.shape)
A_2 = sd_CIE_standard_illuminant_A(cmfs_2.shape)
Expand Down Expand Up @@ -1116,6 +1117,7 @@ def test_msds_to_XYZ_ASTME308(self):

cmfs = MSDS_CMFS_STANDARD_OBSERVER[
'CIE 1931 2 Degree Standard Observer']
# pylint: disable=E1102
msds = reshape_msds(MSDS_TWO, SpectralShape(400, 700, 20))
np.testing.assert_almost_equal(
msds_to_XYZ_ASTME308(msds, cmfs, SDS_ILLUMINANTS['D65']),
Expand Down
11 changes: 11 additions & 0 deletions colour/colorimetry/tristimulus_values.py
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ def sd_to_XYZ_integration(sd, cmfs=None, illuminant=None, k=None):
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_DEFAULT)

Expand Down Expand Up @@ -592,6 +593,7 @@ def sd_to_XYZ_tristimulus_weighting_factors_ASTME308(sd,
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_ASTME308, 'Trim')

Expand All @@ -601,6 +603,7 @@ def sd_to_XYZ_tristimulus_weighting_factors_ASTME308(sd,
if cmfs.shape.interval != 1:
runtime_warning('Interpolating "{0}" cmfs to 1nm interval.'.format(
cmfs.name))
# pylint: disable=E1102
cmfs = reshape_msds(cmfs, SpectralShape(interval=1), 'Interpolate')

if illuminant.shape != cmfs.shape:
Expand Down Expand Up @@ -726,6 +729,7 @@ def sd_to_XYZ_ASTME308(sd,
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_ASTME308, 'Trim')

Expand All @@ -739,13 +743,15 @@ def sd_to_XYZ_ASTME308(sd,
'with measurement interval of 1, 5, 10 or 20nm!')

if use_practice_range:
# pylint: disable=E1102
cmfs = reshape_msds(cmfs, SPECTRAL_SHAPE_ASTME308, 'Trim')

method = sd_to_XYZ_tristimulus_weighting_factors_ASTME308
if sd.shape.interval == 1:
method = sd_to_XYZ_integration
elif sd.shape.interval == 5 and mi_5nm_omission_method:
if cmfs.shape.interval != 5:
# pylint: disable=E1102
cmfs = reshape_msds(cmfs, SpectralShape(interval=5), 'Interpolate')
method = sd_to_XYZ_integration
elif sd.shape.interval == 20 and mi_20nm_interpolation_method:
Expand Down Expand Up @@ -917,6 +923,7 @@ def sd_to_XYZ(sd,
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_DEFAULT)

Expand Down Expand Up @@ -1085,6 +1092,7 @@ class instance or an *array_like* in which case the ``shape`` must be
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_DEFAULT)

Expand All @@ -1108,6 +1116,7 @@ class instance or an *array_like* in which case the ``shape`` must be
if cmfs.shape != shape:
runtime_warning('Aligning "{0}" cmfs shape to "{1}".'.format(
cmfs.name, shape))
# pylint: disable=E1102
cmfs = reshape_msds(cmfs, shape)

if illuminant.shape != shape:
Expand Down Expand Up @@ -1246,6 +1255,7 @@ def msds_to_XYZ_ASTME308(msds,
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_ASTME308, 'Trim')

Expand Down Expand Up @@ -1448,6 +1458,7 @@ def msds_to_XYZ(msds,
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_DEFAULT)

Expand Down
2 changes: 2 additions & 0 deletions colour/quality/cfi2017.py
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,12 @@ def colour_fidelity_index_CIE2017(sd_test, additional_data=False):

# NOTE: All computations except CCT calculation use the
# "CIE 1964 10 Degree Standard Observer".
# pylint: disable=E1102
cmfs_10 = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER['CIE 1964 10 Degree Standard Observer'],
shape)

# pylint: disable=E1102
sds_tcs = reshape_msds(load_TCS_CIE2017(shape), shape)

test_tcs_colorimetry_data = tcs_colorimetry_data(sd_test, sds_tcs, cmfs_10)
Expand Down
1 change: 1 addition & 0 deletions colour/quality/cqs.py
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,7 @@ def colour_quality_scale(sd_test, additional_data=False,

method = validate_method(method, COLOUR_QUALITY_SCALE_METHODS)

# pylint: disable=E1102
cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER['CIE 1931 2 Degree Standard Observer'],
SPECTRAL_SHAPE_DEFAULT)
Expand Down
1 change: 1 addition & 0 deletions colour/quality/cri.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,7 @@ def colour_rendering_index(sd_test, additional_data=False):
64.2337241...
"""

# pylint: disable=E1102
cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER['CIE 1931 2 Degree Standard Observer'],
SPECTRAL_SHAPE_DEFAULT)
Expand Down
3 changes: 3 additions & 0 deletions colour/recovery/jakob2019.py
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@ def find_coefficients_Jakob2019(XYZ,
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_JAKOB2019)

Expand Down Expand Up @@ -567,6 +568,7 @@ def XYZ_to_sd_Jakob2019(XYZ,
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_JAKOB2019)

Expand Down Expand Up @@ -829,6 +831,7 @@ def generate(self,
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_JAKOB2019)
Expand Down
1 change: 1 addition & 0 deletions colour/recovery/meng2015.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ def XYZ_to_sd_Meng2015(XYZ,
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER['CIE 1931 2 Degree Standard Observer'],
SPECTRAL_SHAPE_MENG2015, 'Trim')
Expand Down
2 changes: 2 additions & 0 deletions colour/recovery/otsu2018.py
Original file line number Diff line number Diff line change
Expand Up @@ -441,6 +441,7 @@ def XYZ_to_sd_Otsu2018(XYZ,
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_OTSU2018)

Expand Down Expand Up @@ -1261,6 +1262,7 @@ def __init__(self, reflectances, cmfs=None, illuminant=None):
self._reflectances = as_float_array(reflectances)

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_OTSU2018)
Expand Down
1 change: 1 addition & 0 deletions colour/recovery/tests/test__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ def setUp(self):
Initialises common tests attributes.
"""

# pylint: disable=E1102
self._cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER['CIE 1931 2 Degree Standard Observer'],
SpectralShape(360, 780, 10))
Expand Down
3 changes: 3 additions & 0 deletions colour/recovery/tests/test_jakob2019.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def setUp(self):
"""

self._shape = SPECTRAL_SHAPE_JAKOB2019
# pylint: disable=E1102
self._cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT], self._shape)

Expand Down Expand Up @@ -149,6 +150,7 @@ def setUp(self):
"""

self._shape = SPECTRAL_SHAPE_JAKOB2019
# pylint: disable=E1102
self._cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT], self._shape)
self._sd_D65 = reshape_sd(SDS_ILLUMINANTS[_ILLUMINANT_DEFAULT],
Expand Down Expand Up @@ -206,6 +208,7 @@ def setUp(self):
self._RGB_colourspace = RGB_COLOURSPACE_sRGB

self._shape = SPECTRAL_SHAPE_JAKOB2019
# pylint: disable=E1102
self._cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT], self._shape)

Expand Down
1 change: 1 addition & 0 deletions colour/recovery/tests/test_mallett2019.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ def __init__(self):
Initialises common tests attributes for the mixin.
"""

# pylint: disable=E1102
self._cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER['CIE 1931 2 Degree Standard Observer'],
SpectralShape(360, 780, 10))
Expand Down
2 changes: 2 additions & 0 deletions colour/recovery/tests/test_meng2015.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def setUp(self):
Initialises common tests attributes.
"""

# pylint: disable=E1102
self._cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER['CIE 1931 2 Degree Standard Observer'],
SpectralShape(360, 780, 10))
Expand Down Expand Up @@ -72,6 +73,7 @@ def test_XYZ_to_sd_Meng2015(self):
decimal=7)

shape = SpectralShape(400, 700, 5)
# pylint: disable=E1102
cmfs = reshape_msds(self._cmfs, shape)
np.testing.assert_almost_equal(
sd_to_XYZ_integration(
Expand Down
2 changes: 2 additions & 0 deletions colour/recovery/tests/test_otsu2018.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ def setUp(self):
"""

self._shape = SPECTRAL_SHAPE_OTSU2018
# pylint: disable=E1102
self._cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT], self._shape)

Expand Down Expand Up @@ -204,6 +205,7 @@ def setUp(self):
"""

self._shape = SPECTRAL_SHAPE_OTSU2018
# pylint: disable=E1102
self._cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT], self._shape)

Expand Down
6 changes: 6 additions & 0 deletions colour/temperature/ohno2013.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ def planckian_table(uv, cmfs, start, end, count):

ux, vx = uv

# pylint: disable=E1102
cmfs = reshape_msds(cmfs, SPECTRAL_SHAPE_DEFAULT, 'Trim')

shape = cmfs.shape
Expand Down Expand Up @@ -202,6 +203,7 @@ def _uv_to_CCT_Ohno2013(uv,
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_DEFAULT, 'Trim')

Expand Down Expand Up @@ -314,6 +316,7 @@ def uv_to_CCT_Ohno2013(uv,
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_DEFAULT, 'Trim')

Expand Down Expand Up @@ -348,11 +351,13 @@ def _CCT_to_uv_Ohno2013(CCT_D_uv, cmfs=None):
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_DEFAULT, 'Trim')

CCT, D_uv = tsplit(CCT_D_uv)

# pylint: disable=E1102
cmfs = reshape_msds(cmfs, SPECTRAL_SHAPE_DEFAULT, 'Trim')

shape = cmfs.shape
Expand Down Expand Up @@ -420,6 +425,7 @@ def CCT_to_uv_Ohno2013(CCT_D_uv, cmfs=None):
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(MSDS_CMFS_STANDARD_OBSERVER[_MSDS_CMFS_DEFAULT],
SPECTRAL_SHAPE_DEFAULT, 'Trim')

Expand Down
2 changes: 2 additions & 0 deletions colour/volume/spectrum.py
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,7 @@ def XYZ_outer_surface(cmfs=None,
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER['CIE 1931 2 Degree Standard Observer'],
SPECTRAL_SHAPE_OUTER_SURFACE_XYZ)
Expand Down Expand Up @@ -395,6 +396,7 @@ def is_within_visible_spectrum(XYZ,
"""

if cmfs is None:
# pylint: disable=E1102
cmfs = reshape_msds(
MSDS_CMFS_STANDARD_OBSERVER['CIE 1931 2 Degree Standard Observer'],
SPECTRAL_SHAPE_OUTER_SURFACE_XYZ)
Expand Down

0 comments on commit cac282f

Please sign in to comment.