Skip to content

Commit

Permalink
[FMT] apply black to plotting - part 2 (#3810)
Browse files Browse the repository at this point in the history
* apply black

* apply black

* Apply suggestions from code review

* fixes extra spaces from black

* Apply suggestions from code review
  • Loading branch information
Remi-Gau committed Jul 5, 2023
1 parent e65624b commit 787d662
Show file tree
Hide file tree
Showing 14 changed files with 615 additions and 430 deletions.
6 changes: 0 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,7 @@ exclude: |
| nilearn/maskers/nifti_labels_masker.py
| nilearn/plotting/displays/_axes.py
| nilearn/plotting/glass_brain.py
| nilearn/plotting/html_connectome.py
| nilearn/plotting/html_surface.py
| nilearn/plotting/find_cuts.py
| nilearn/plotting/html_stat_map.py
| nilearn/plotting/img_plotting.py
| nilearn/plotting/matrix_plotting.py
| nilearn/plotting/js_plotting_utils.py
Expand All @@ -56,9 +53,6 @@ exclude: |
| nilearn/plotting/tests/test_img_plotting/test_plot_stat_map.py
| nilearn/plotting/tests/test_img_plotting/test_plot_markers.py
| nilearn/plotting/tests/test_img_plotting/test_plot_connectome.py
| nilearn/plotting/tests/test_js_plotting_utils.py
| nilearn/plotting/tests/test_matplotlib_backend.py
| nilearn/plotting/tests/test_matrix_plotting.py
| nilearn/plotting/tests/test_surf_plotting.py
| nilearn/surface/surface.py
| nilearn/surface/tests/test_surface.py
Expand Down
2 changes: 1 addition & 1 deletion nilearn/_utils/tests/test_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,6 @@ def test_compare_version(version_a, operator, version_b):
def test_compare_version_error():
with pytest.raises(
ValueError,
match="'_compare_version' received an " "unexpected operator <>.",
match="'_compare_version' received an unexpected operator <>.",
):
helpers._compare_version("0.1.0", "<>", "1.1.0")
6 changes: 2 additions & 4 deletions nilearn/_utils/tests/test_niimg_conversions.py
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,7 @@ def test_repr_niimgs(tmp_path):
# Lists longer than 3
# Small names - Explicit shortening
long_list_small_names = ["test", "retest", "reretest", "rereretest"]
shortened_rep_long_list_small_names = (
"[test,\n" " ...\n" " rereretest]"
)
shortened_rep_long_list_small_names = "[test,\n ...\n rereretest]"

assert (
_utils._repr_niimgs(long_list_small_names, shorten=True)
Expand All @@ -490,7 +488,7 @@ def test_repr_niimgs(tmp_path):

# Small names - Force full display
long_rep_long_list_small_names = (
"[test,\n" " retest,\n" " reretest,\n" " rereretest]"
"[test,\n retest,\n reretest,\n rereretest]"
)

assert (
Expand Down
2 changes: 1 addition & 1 deletion nilearn/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def test_behavior_when_user_provides_int64_img():
"""
forbidden_types = (np.int64, np.uint64)
error_msg = (
"Creating or saving an image " "containing 64-bit ints is forbidden."
"Creating or saving an image containing 64-bit ints is forbidden."
)

to_filename = nibabel.nifti1.Nifti1Image.to_filename
Expand Down
2 changes: 1 addition & 1 deletion nilearn/datasets/atlas.py
Original file line number Diff line number Diff line change
Expand Up @@ -2143,7 +2143,7 @@ def fetch_atlas_schaefer_2018(
files = []
labels_file_template = "Schaefer2018_{}Parcels_{}Networks_order.txt"
img_file_template = (
"Schaefer2018_{}Parcels_" "{}Networks_order_FSLMNI152_{}mm.nii.gz"
"Schaefer2018_{}Parcels_{}Networks_order_FSLMNI152_{}mm.nii.gz"
)
for f in [
labels_file_template.format(n_rois, yeo_networks),
Expand Down
2 changes: 1 addition & 1 deletion nilearn/image/tests/test_image.py
Original file line number Diff line number Diff line change
Expand Up @@ -552,7 +552,7 @@ def test_index_img_error_4D(affine):
]:
with pytest.raises(
IndexError,
match="out of bounds|invalid index|out of range|" "boolean index",
match="out of bounds|invalid index|out of range|boolean index",
):
index_img(img_4d, i)

Expand Down
2 changes: 1 addition & 1 deletion nilearn/interfaces/tests/test_bids.py
Original file line number Diff line number Diff line change
Expand Up @@ -275,7 +275,7 @@ def test_get_bids_files():
n_ses=2,
tasks=["localizer", "main"],
n_runs=[1, 3],
confounds_tag="desc-confounds_" "regressors",
confounds_tag="desc-confounds_regressors",
)
# 80 counfonds (4 runs per ses & sub), testing `fmriprep` >= 20.2 path
selection = get_bids_files(
Expand Down

0 comments on commit 787d662

Please sign in to comment.