google / google/yapf

Yapf ~0.28.0~ 0.31.0 is still producing flake8 incompatible formatting.

Open
#765 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14k
Forks
904
PR merge metrics
No merged PRs in 30d

Description

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:

```bash
(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
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

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.