diff --git a/examples/03_connectivity/plot_sphere_based_connectome.py b/examples/03_connectivity/plot_sphere_based_connectome.py index 8740979424..b3ba1a3593 100644 --- a/examples/03_connectivity/plot_sphere_based_connectome.py +++ b/examples/03_connectivity/plot_sphere_based_connectome.py @@ -52,7 +52,7 @@ 'Posterior Cingulate Cortex', 'Left Temporoparietal junction', 'Right Temporoparietal junction', - 'Medial prefrontal cortex' + 'Medial prefrontal cortex', ] ########################################################################## diff --git a/nilearn/plotting/img_plotting.py b/nilearn/plotting/img_plotting.py index 1bde5f1f01..52d7867fd5 100644 --- a/nilearn/plotting/img_plotting.py +++ b/nilearn/plotting/img_plotting.py @@ -1374,7 +1374,7 @@ def plot_connectome_strength(adjacency_matrix, node_coords, node_size="auto", adjacency_matrix = np.nan_to_num(adjacency_matrix) adjacency_matrix_shape = adjacency_matrix.shape - if (len(adjacency_matrix_shape) != 2 or + if (len(adjacency_matrix_shape) != 2 or # noqa: W504 adjacency_matrix_shape[0] != adjacency_matrix_shape[1]): raise ValueError( "'adjacency_matrix' is supposed to have shape (n, n)." @@ -1426,7 +1426,7 @@ def plot_connectome_strength(adjacency_matrix, node_coords, node_size="auto", ) # reduce alpha for the least strong regions color[-1] = ( - (region - strength_sorted.min()) * + (region - strength_sorted.min()) * # noqa: W504 (1 / (strength_sorted.max() - strength_sorted.min())) ) # make color to be a 2D array diff --git a/nilearn/plotting/tests/test_img_plotting.py b/nilearn/plotting/tests/test_img_plotting.py index 9ecd0f2f9b..28d138bb8b 100644 --- a/nilearn/plotting/tests/test_img_plotting.py +++ b/nilearn/plotting/tests/test_img_plotting.py @@ -578,7 +578,7 @@ def test_connectome_strength(): *args, output_file=filename, **kwargs ) assert_true(display is None) - assert_true(os.path.isfile(filename) and + assert_true(os.path.isfile(filename) and # noqa: W504 os.path.getsize(filename) > 0) finally: os.remove(filename) @@ -659,7 +659,8 @@ def test_plot_connectome_strength_exceptions(): node_coords[:, 2], **kwargs) wrong_adjacency_matrix = np.zeros((3, 3)) - assert_raises_regex(ValueError, r'Shape mismatch.+\(3L?, 3L?\).+\(2L?, 3L?\)', + assert_raises_regex(ValueError, + r'Shape mismatch.+\(3L?, 3L?\).+\(2L?, 3L?\)', plot_connectome_strength, wrong_adjacency_matrix, node_coords, **kwargs)