Yapf ~0.28.0~ 0.31.0 is still producing flake8 incompatible formatting.
Hi,
This directly relates to #694 which has been closed but is not fixed thus I open a new issue. I tried with 0.28.0 and I still have similar issues. Running yapf -ri on https://github.com/colour-science/colour/tree/46917f2b3ffefd7dd140384141302e3f87a69e99/colour/volume:
(colour-3.7) Kali:colour kelsolaar$ yapf -v
yapf 0.28.0
(colour-3.7) Kali:colour kelsolaar$ yapf -ri colour/volume/
(colour-3.7) Kali:colour kelsolaar$ flake8 colour
colour/volume/rgb.py:75:5: E131 continuation line unaligned for hanging indent
colour/volume/rgb.py:194:5: E131 continuation line unaligned for hanging indent
And here is the diff:
diff --git a/colour/volume/pointer_gamut.py b/colour/volume/pointer_gamut.py
index 3c3acacc..d4e7fa23 100644
--- a/colour/volume/pointer_gamut.py
+++ b/colour/volume/pointer_gamut.py
@@ -64,7 +64,7 @@ def is_within_pointer_gamut(XYZ, tolerance=None):
array([ True, False], dtype=bool)
"""
- XYZ_p = Lab_to_XYZ(
- LCHab_to_Lab(POINTER_GAMUT_DATA), POINTER_GAMUT_ILLUMINANT)
+ XYZ_p = Lab_to_XYZ(LCHab_to_Lab(POINTER_GAMUT_DATA),
+ POINTER_GAMUT_ILLUMINANT)
return is_within_mesh_volume(XYZ, XYZ_p, tolerance)
diff --git a/colour/volume/rgb.py b/colour/volume/rgb.py
index 1ad9d1b3..b5aa7ee1 100644
--- a/colour/volume/rgb.py
+++ b/colour/volume/rgb.py
@@ -71,8 +71,8 @@ def sample_RGB_colourspace_volume_MonteCarlo(
colourspace,
samples=10e6,
limits=np.array([[0, 100], [-150, 150], [-150, 150]]),
- illuminant_Lab=ILLUMINANTS['CIE 1931 2 Degree Standard Observer'][
- 'D65'],
+ illuminant_Lab=ILLUMINANTS['CIE 1931 2 Degree Standard Observer']
+ ['D65'],
chromatic_adaptation_method='CAT02',
random_generator=random_triplet_generator,
random_state=None):
@@ -190,8 +190,8 @@ def RGB_colourspace_volume_MonteCarlo(
colourspace,
samples=10e6,
limits=np.array([[0, 100], [-150, 150], [-150, 150]], dtype=np.float),
- illuminant_Lab=ILLUMINANTS['CIE 1931 2 Degree Standard Observer'][
- 'D65'],
+ illuminant_Lab=ILLUMINANTS['CIE 1931 2 Degree Standard Observer']
+ ['D65'],
chromatic_adaptation_method='CAT02',
random_generator=random_triplet_generator,
random_state=None):
diff --git a/colour/volume/spectrum.py b/colour/volume/spectrum.py
index 5b4c84b7..ca6f68c5 100644
--- a/colour/volume/spectrum.py
+++ b/colour/volume/spectrum.py
@@ -207,8 +207,10 @@ def XYZ_outer_surface(
values.append(
NearestNeighbourInterpolator(wavelengths, wave)(domain))
- XYZ = multi_sds_to_XYZ_integration(
- values, cmfs, illuminant, shape=DEFAULT_SPECTRAL_SHAPE)
+ XYZ = multi_sds_to_XYZ_integration(values,
+ cmfs,
+ illuminant,
+ shape=DEFAULT_SPECTRAL_SHAPE)
XYZ = XYZ / np.max(XYZ[-1, 1])
diff --git a/colour/volume/tests/test_macadam_limits.py b/colour/volume/tests/test_macadam_limits.py
index 2c678261..a248e782 100644
--- a/colour/volume/tests/test_macadam_limits.py
+++ b/colour/volume/tests/test_macadam_limits.py
@@ -27,7 +27,6 @@ class TestIsWithinMacadamLimits(unittest.TestCase):
Defines :func:`colour.volume.macadam_limits.is_within_macadam_limits`
definition unit tests methods.
"""
-
def test_is_within_macadam_limits(self):
"""
Tests :func:`colour.volume.macadam_limits.is_within_macadam_limits`
diff --git a/colour/volume/tests/test_mesh.py b/colour/volume/tests/test_mesh.py
index 79e91676..3932df58 100644
--- a/colour/volume/tests/test_mesh.py
+++ b/colour/volume/tests/test_mesh.py
@@ -27,7 +27,6 @@ class TestIsWithinMeshVolume(unittest.TestCase):
Defines :func:`colour.volume.mesh.is_within_mesh_volume` definition unit
tests methods.
"""
-
def setUp(self):
"""
Initialises common tests attributes.
@@ -47,20 +46,20 @@ class TestIsWithinMeshVolume(unittest.TestCase):
"""
self.assertTrue(
- is_within_mesh_volume(
- np.array([0.0005, 0.0031, 0.0010]), self._mesh))
+ is_within_mesh_volume(np.array([0.0005, 0.0031, 0.0010]),
+ self._mesh))
self.assertFalse(
- is_within_mesh_volume(
- np.array([0.3205, 0.4131, 0.5100]), self._mesh))
+ is_within_mesh_volume(np.array([0.3205, 0.4131, 0.5100]),
+ self._mesh))
self.assertTrue(
- is_within_mesh_volume(
- np.array([0.0025, 0.0088, 0.0340]), self._mesh))
+ is_within_mesh_volume(np.array([0.0025, 0.0088, 0.0340]),
+ self._mesh))
self.assertFalse(
- is_within_mesh_volume(
- np.array([0.4325, 0.3788, 0.1034]), self._mesh))
+ is_within_mesh_volume(np.array([0.4325, 0.3788, 0.1034]),
+ self._mesh))
def test_n_dimensional_is_within_mesh_volume(self):
"""
diff --git a/colour/volume/tests/test_pointer_gamut.py b/colour/volume/tests/test_pointer_gamut.py
index ef7e1d47..eceb85b1 100644
--- a/colour/volume/tests/test_pointer_gamut.py
+++ b/colour/volume/tests/test_pointer_gamut.py
@@ -27,7 +27,6 @@ class TestIsWithinPointerGamut(unittest.TestCase):
Defines :func:`colour.volume.pointer_gamut.is_within_pointer_gamut`
definition unit tests methods.
"""
-
def test_is_within_pointer_gamut(self):
"""
Tests :func:`colour.volume.pointer_gamut.is_within_pointer_gamut`
diff --git a/colour/volume/tests/test_rgb.py b/colour/volume/tests/test_rgb.py
index f047b9a1..23b94b25 100644
--- a/colour/volume/tests/test_rgb.py
+++ b/colour/volume/tests/test_rgb.py
@@ -53,7 +53,6 @@ class TestRGB_colourspaceLimits(unittest.TestCase):
Defines :func:`colour.volume.rgb.RGB_colourspace_limits` definition unit
tests methods.
"""
-
def test_RGB_colourspace_limits(self):
"""
Tests :func:`colour.volume.rgb.RGB_colourspace_limits` definition.
@@ -96,7 +95,6 @@ class TestRGB_colourspaceVolumeMonteCarlo(unittest.TestCase):
----------
:cite:`Laurent2012a`
"""
-
@disable_multiprocessing()
def test_RGB_colourspace_volume_MonteCarlo(self):
"""
@@ -104,12 +102,11 @@ class TestRGB_colourspaceVolumeMonteCarlo(unittest.TestCase):
definition.
"""
- self.assertAlmostEqual(
- RGB_colourspace_volume_MonteCarlo(
- BT709_COLOURSPACE, 10e3, random_state=np.random.RandomState(2))
- * 1e-6,
- 821700.0 * 1e-6,
- places=1)
+ self.assertAlmostEqual(RGB_colourspace_volume_MonteCarlo(
+ BT709_COLOURSPACE, 10e3, random_state=np.random.RandomState(2)) *
+ 1e-6,
+ 821700.0 * 1e-6,
+ places=1)
class TestRGB_colourspace_volume_coverage_MonteCarlo(unittest.TestCase):
@@ -121,7 +118,6 @@ RGB_colourspace_volume_coverage_MonteCarlo` definition unit tests methods.
----------
:cite:`Laurent2012a`
"""
-
def test_RGB_colourspace_volume_coverage_MonteCarlo(self):
"""
Tests :func:`colour.volume.rgb.\
@@ -148,7 +144,6 @@ RGB_colourspace_pointer_gamut_coverage_MonteCarlo` definition unit tests
----------
:cite:`Laurent2012a`
"""
-
def test_RGB_colourspace_pointer_gamut_coverage_MonteCarlo(self):
"""
Tests :func:`colour.volume.rgb.\
@@ -173,7 +168,6 @@ RGB_colourspace_visible_spectrum_coverage_MonteCarlo` definition unit tests
----------
:cite:`Laurent2012a`
"""
-
def test_RGB_colourspace_visible_spectrum_coverage_MonteCarlo(self):
"""
Tests :func:`colour.volume.rgb.\
diff --git a/colour/volume/tests/test_spectrum.py b/colour/volume/tests/test_spectrum.py
index f7aeb67a..2328321e 100644
--- a/colour/volume/tests/test_spectrum.py
+++ b/colour/volume/tests/test_spectrum.py
@@ -31,7 +31,6 @@ class TestGeneratePulseWaves(unittest.TestCase):
Defines :func:`colour.volume.spectrum.generate_pulse_waves`
definition unit tests methods.
"""
-
def test_generate_pulse_waves(self):
"""
Tests :func:`colour.volume.spectrum.generate_pulse_waves`
@@ -71,7 +70,6 @@ class TestXYZOuterSurface(unittest.TestCase):
Defines :func:`colour.volume.spectrum.XYZ_outer_surface`
definition unit tests methods.
"""
-
def test_XYZ_outer_surface(self):
"""
Tests :func:`colour.volume.spectrum.XYZ_outer_surface`
@@ -122,7 +120,6 @@ class TestIsWithinVisibleSpectrum(unittest.TestCase):
Defines :func:`colour.volume.spectrum.is_within_visible_spectrum`
definition unit tests methods.
"""
-
def test_is_within_visible_spectrum(self):
"""
Tests :func:`colour.volume.spectrum.is_within_visible_spectrum`
Another thing I notice is that some line returns are being removed which produces rather unelegant formatting, ~I will open a new issue for that~, see #744.
Cheers,
Thomas
For the lines between the class docstring and the first method, set BLANK_LINE_BEFORE_NESTED_CLASS_OR_DEF = True. It's off by default for PEP8.
The array subscript thing is concerning.
Hello,
I tried to update to 0.31.0, ran it on all our codebase and it still generates incompatible formatting:
colour/colorimetry/datasets/lefs.py:2361:80: E501 line too long (80 > 79 characters)
colour/colorimetry/datasets/cmfs.py:3213:80: E501 line too long (80 > 79 characters)
colour/colorimetry/datasets/cmfs.py:3225:80: E501 line too long (80 > 79 characters)
colour/models/din99.py:231:5: E131 continuation line unaligned for hanging indent
colour/models/din99.py:304:5: E131 continuation line unaligned for hanging indent
colour/models/hdr_cie_lab.py:125:5: E131 continuation line unaligned for hanging indent
colour/models/hdr_cie_lab.py:223:5: E131 continuation line unaligned for hanging indent
colour/models/cie_xyy.py:47:5: E131 continuation line unaligned for hanging indent
colour/models/cie_xyy.py:47:5: E125 continuation line with same indent as next logical line
colour/models/cie_lab.py:40:5: E131 continuation line unaligned for hanging indent
colour/models/cie_lab.py:40:5: E125 continuation line with same indent as next logical line
colour/models/cie_lab.py:111:5: E131 continuation line unaligned for hanging indent
colour/models/cie_lab.py:111:5: E125 continuation line with same indent as next logical line
colour/models/hunter_lab.py:82:5: E129 visually indented line with same indent as next logical line
colour/models/hunter_lab.py:158:5: E129 visually indented line with same indent as next logical line
colour/models/cie_uvw.py:37:5: E131 continuation line unaligned for hanging indent
colour/models/cie_uvw.py:37:5: E125 continuation line with same indent as next logical line
colour/models/cie_uvw.py:109:5: E131 continuation line unaligned for hanging indent
colour/models/cie_uvw.py:109:5: E125 continuation line with same indent as next logical line
colour/models/hunter_rdab.py:38:5: E129 visually indented line with same indent as next logical line
colour/models/hunter_rdab.py:116:5: E129 visually indented line with same indent as next logical line
colour/models/cie_luv.py:54:5: E131 continuation line unaligned for hanging indent
colour/models/cie_luv.py:54:5: E125 continuation line with same indent as next logical line
colour/models/cie_luv.py:126:5: E131 continuation line unaligned for hanging indent
colour/models/cie_luv.py:126:5: E125 continuation line with same indent as next logical line
colour/models/rgb/ictcp.py:346:5: E131 continuation line unaligned for hanging indent
colour/models/rgb/ictcp.py:465:5: E131 continuation line unaligned for hanging indent
colour/models/rgb/common.py:25:5: E131 continuation line unaligned for hanging indent
colour/models/rgb/common.py:89:5: E131 continuation line unaligned for hanging indent
colour/volume/rgb.py:67:5: E131 continuation line unaligned for hanging indent
colour/volume/rgb.py:193:5: E131 continuation line unaligned for hanging indent
Something I did not noticed before is that we get lines that are too long now:
diff --git a/colour/colorimetry/datasets/lefs.py b/colour/colorimetry/datasets/lefs.py
index 13b184596..4067d7441 100644
--- a/colour/colorimetry/datasets/lefs.py
+++ b/colour/colorimetry/datasets/lefs.py
@@ -2342,27 +2342,23 @@ DATA_LEFS_PHOTOPIC = {
SDS_LEFS_PHOTOPIC = LazyCaseInsensitiveMapping({
'CIE 1924 Photopic Standard Observer':
- partial(
- SpectralDistribution,
- DATA_LEFS_PHOTOPIC['CIE 1924 Photopic Standard Observer'],
- name='CIE 1924 Photopic Standard Observer'),
+ partial(SpectralDistribution,
+ DATA_LEFS_PHOTOPIC['CIE 1924 Photopic Standard Observer'],
+ name='CIE 1924 Photopic Standard Observer'),
'Judd Modified CIE 1951 Photopic Standard Observer':
- partial(
- SpectralDistribution,
- DATA_LEFS_PHOTOPIC[
- 'Judd Modified CIE 1951 Photopic Standard Observer'],
- name='Judd Modified CIE 1951 Photopic Standard Observer'),
+ partial(SpectralDistribution,
+ DATA_LEFS_PHOTOPIC[
+ 'Judd Modified CIE 1951 Photopic Standard Observer'],
+ name='Judd Modified CIE 1951 Photopic Standard Observer'),
'Judd-Vos Modified CIE 1978 Photopic Standard Observer':
- partial(
- SpectralDistribution,
- DATA_LEFS_PHOTOPIC[
- 'Judd-Vos Modified CIE 1978 Photopic Standard Observer'],
- name='Judd-Vos Modified CIE 1978 Photopic Standard Observer'),
+ partial(SpectralDistribution,
+ DATA_LEFS_PHOTOPIC[
+ 'Judd-Vos Modified CIE 1978 Photopic Standard Observer'],
+ name='Judd-Vos Modified CIE 1978 Photopic Standard Observer'),
'CIE 1964 Photopic 10 Degree Standard Observer':
partial(
SpectralDistribution,
- DATA_LEFS_PHOTOPIC[
- 'CIE 1964 Photopic 10 Degree Standard Observer'],
+ DATA_LEFS_PHOTOPIC['CIE 1964 Photopic 10 Degree Standard Observer'],
name='CIE 1964 Photopic 10 Degree Standard Observer',
strict_name='CIE 1964 Photopic 10$^\\circ$ Standard Observer'),
'CIE 2008 2 Degree Physiologically Relevant LEF':
@@ -2813,10 +2809,9 @@ DATA_LEFS_SCOTOPIC = {
SDS_LEFS_SCOTOPIC = LazyCaseInsensitiveMapping({
'CIE 1951 Scotopic Standard Observer':
- partial(
- SpectralDistribution,
- DATA_LEFS_SCOTOPIC['CIE 1951 Scotopic Standard Observer'],
- name='CIE 1951 Scotopic Standard Observer')
+ partial(SpectralDistribution,
+ DATA_LEFS_SCOTOPIC['CIE 1951 Scotopic Standard Observer'],
+ name='CIE 1951 Scotopic Standard Observer')
})
SDS_LEFS_SCOTOPIC.__doc__ = """
Spectral distributions of the scotopic luminous efficiency functions.
and the array subscripts are still sometimes pushed next line:
diff --git a/colour/models/din99.py b/colour/models/din99.py
index 06b77e4e0..7d0a16a1e 100644
--- a/colour/models/din99.py
+++ b/colour/models/din99.py
@@ -225,12 +225,13 @@ def DIN99_to_Lab(Lab_99, k_E=1, k_CH=1, method='DIN99'):
return from_range_100(Lab)
-def XYZ_to_DIN99(XYZ,
- illuminant=CCS_ILLUMINANTS[
- 'CIE 1931 2 Degree Standard Observer']['D65'],
- k_E=1,
- k_CH=1,
- method='DIN99'):
+def XYZ_to_DIN99(
+ XYZ,
+ illuminant=CCS_ILLUMINANTS['CIE 1931 2 Degree Standard Observer']
+ ['D65'],
+ k_E=1,
+ k_CH=1,
+ method='DIN99'):
"""
Converts from *CIE XYZ* tristimulus values to *DIN99* colourspace or
one of the *DIN99b*, *DIN99c*, *DIN99d* refined formulas according
@@ -297,12 +298,13 @@ def XYZ_to_DIN99(XYZ,
return Lab_to_DIN99(Lab, k_E, k_CH, method)
-def DIN99_to_XYZ(Lab_99,
- illuminant=CCS_ILLUMINANTS[
- 'CIE 1931 2 Degree Standard Observer']['D65'],
- k_E=1,
- k_CH=1,
- method='DIN99'):
+def DIN99_to_XYZ(
+ Lab_99,
+ illuminant=CCS_ILLUMINANTS['CIE 1931 2 Degree Standard Observer']
+ ['D65'],
+ k_E=1,
+ k_CH=1,
+ method='DIN99'):
"""
Converts from *DIN99* colourspace or one of the *DIN99b*, *DIN99c*,
*DIN99d* refined formulas according to *Cui et al. (2002)* to *CIE XYZ*
For the context, this regression was introduced sometimes between 0.23.0 and 0.24.0 as highlighted in #694.