Skip to content

Commit

Permalink
[MAINT] fix flake8 (nilearn#3869)
Browse files Browse the repository at this point in the history
* fix flake8

* pacify the linting gods
  • Loading branch information
Remi-Gau authored Jul 31, 2023
1 parent dc247b5 commit a95149b
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions nilearn/glm/tests/test_first_level.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ def test_run_glm():
assert results[0.0].theta.shape == (q, n)
assert_almost_equal(results[0.0].theta.mean(), 0, 1)
assert_almost_equal(results[0.0].theta.var(), 1. / p, 1)
assert type(results[labels[0]].model) == OLSModel
assert isinstance(results[labels[0]].model, OLSModel)

# ar(1) case
labels, results = run_glm(Y, X, 'ar1')
Expand All @@ -332,15 +332,15 @@ def test_run_glm():
tmp = sum([val.theta.shape[1] for val in results.values()])
assert tmp == n
assert results[labels[0]].model.order == 1
assert type(results[labels[0]].model) == ARModel
assert isinstance(results[labels[0]].model, ARModel)

# ar(3) case
labels_ar3, results_ar3 = run_glm(Y, X, 'ar3', bins=10)
assert len(labels_ar3) == n
assert len(results_ar3.keys()) > 1
tmp = sum([val.theta.shape[1] for val in results_ar3.values()])
assert tmp == n
assert type(results_ar3[labels_ar3[0]].model) == ARModel
assert isinstance(results_ar3[labels_ar3[0]].model, ARModel)
assert results_ar3[labels_ar3[0]].model.order == 3
assert len(results_ar3[labels_ar3[0]].model.rho) == 3

Expand Down
2 changes: 1 addition & 1 deletion nilearn/maskers/tests/test_masker_validation.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ def test_check_embedded_nifti_masker():
masker = _check_embedded_nifti_masker(
owner, multi_subject=multi_subject
)
assert type(masker) == type(mask)
assert isinstance(masker, type(mask))
for param_key in masker.get_params():
if param_key not in [
"memory",
Expand Down
2 changes: 1 addition & 1 deletion nilearn/plotting/img_plotting.py
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,7 @@ class _MNI152Template(SpatialImage):
"""Constant pointing to the MNI152 Template provided by nilearn."""

data = None
affine = None
_affine = None
vmax = None
_shape = None
# Having a header is required by the load_niimg function
Expand Down
4 changes: 2 additions & 2 deletions nilearn/plotting/tests/test_html_surface.py
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ def test_one_mesh_info():
assert len(info['vertexcolor_left']) == len(surf_map)
cmax = np.max(np.abs(surf_map))
assert (info['cmin'], info['cmax']) == (-cmax, cmax)
assert type(info['cmax']) == float
assert isinstance(info['cmax'], float)
json.dumps(info)
assert info['black_bg']
assert not info['full_brain_mesh']
Expand All @@ -129,7 +129,7 @@ def test_full_brain_info():
assert info['cmin'] == - info['cmax']
assert info['full_brain_mesh']
assert not info['black_bg']
assert type(info['cmax']) == float
assert isinstance(info['cmax'], float)
json.dumps(info)
for hemi in ['left', 'right']:
mesh = surface.load_surf_mesh(surfaces[f'pial_{hemi}'])
Expand Down
4 changes: 2 additions & 2 deletions nilearn/reporting/glm_reporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,9 +438,9 @@ def _make_headings(contrasts, title, model):
If title is user-supplied, then subheading is empty string.
"""
if type(model) == glm.first_level.FirstLevelModel:
if isinstance(model, glm.first_level.FirstLevelModel):
model_type = "First Level Model"
elif type(model) == glm.second_level.SecondLevelModel:
elif isinstance(model, glm.second_level.SecondLevelModel):
model_type = "Second Level Model"

if title:
Expand Down

0 comments on commit a95149b

Please sign in to comment.