Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[MAINT] refactor nilearn/maskers (sourcery, f-strings) #3685

Merged
merged 4 commits into from Jun 13, 2023

Conversation

Remi-Gau
Copy link
Collaborator

Relates to #2528

Changes proposed in this pull request:

  • apply sourcery refactoring suggestions
  • use f strings everywhere

@github-actions
Copy link
Contributor

github-actions bot commented Apr 13, 2023

👋 @Remi-Gau Thanks for creating a PR!

Until this PR is ready for review, you can include the [WIP] tag in its title, or leave it as a github draft.

Please make sure it is compliant with our contributing guidelines. In particular, be sure it checks the boxes listed below.

  • PR has an interpretable title.
  • PR links to Github issue with mention Closes #XXXX (see our documentation on PR structure)
  • Code is PEP8-compliant (see our documentation on coding style)
  • Changelog or what's new entry in doc/changes/latest.rst (see our documentation on PR structure)

For new features:

  • There is at least one unit test per new function / class (see our documentation on testing)
  • The new feature is demoed in at least one relevant example.

For bug fixes:

  • There is at least one test that would fail under the original bug conditions.

We will review it as quick as possible, feel free to ping us with questions if needed.

@Remi-Gau Remi-Gau added this to In progress in R&R (reformat and refactor) Apr 13, 2023
@codecov
Copy link

codecov bot commented Apr 13, 2023

Codecov Report

Merging #3685 (9568c7c) into main (442133d) will decrease coverage by 0.01%.
The diff coverage is 93.84%.

@@            Coverage Diff             @@
##             main    #3685      +/-   ##
==========================================
- Coverage   91.60%   91.60%   -0.01%     
==========================================
  Files         139      139              
  Lines       16596    16589       -7     
  Branches     3243     3242       -1     
==========================================
- Hits        15203    15196       -7     
  Misses       1390     1390              
  Partials        3        3              
Impacted Files Coverage Δ
nilearn/maskers/nifti_spheres_masker.py 96.57% <50.00%> (ø)
nilearn/maskers/base_masker.py 92.30% <85.71%> (ø)
nilearn/maskers/nifti_masker.py 91.66% <87.50%> (-0.18%) ⬇️
nilearn/maskers/_masker_validation.py 100.00% <100.00%> (ø)
nilearn/maskers/nifti_labels_masker.py 93.64% <100.00%> (-0.08%) ⬇️
nilearn/maskers/nifti_maps_masker.py 97.70% <100.00%> (-0.03%) ⬇️

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@Remi-Gau Remi-Gau marked this pull request as ready for review April 18, 2023 07:44
Copy link
Member

@bthirion bthirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM otherwise

return self.fit(**fit_params).transform(X, confounds=confounds,
sample_mask=sample_mask
)

Copy link
Member

@bthirion bthirion Apr 18, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a bit unsure here, because the new code does not result exactly in the same calls, and it is not covered by tests...

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe in such cases it might be better to increase test coverage before refactoring when there is a big amount of untested lines

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

you read my mind

Co-authored-by: Yasmin <63292494+ymzayek@users.noreply.github.com>
Copy link
Member

@bthirion bthirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The changes LGTM, but shouldn't we take care of the tests ?

@Remi-Gau
Copy link
Collaborator Author

The changes LGTM, but shouldn't we take care of the tests ?

did you mean:

  • improving test coverage, or
  • refactor the tests, or
  • something else entirely?

@ymzayek
Copy link
Member

ymzayek commented Jun 12, 2023

@Remi-Gau how do you want to proceed with this? Should we merge #3721 first, then rebase this on main and see if any tests break with the refactoring?

@Remi-Gau
Copy link
Collaborator Author

@Remi-Gau how do you want to proceed with this? Should we merge #3721 first, then rebase this on main and see if any tests break with the refactoring?

Yes let's do this.
Will make sure that #3721 is all green first.

Copy link
Member

@bthirion bthirion left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't spot any issue.

Copy link
Member

@ymzayek ymzayek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM as well!

@Remi-Gau
Copy link
Collaborator Author

Thanks for the reviews.
Merging

@Remi-Gau Remi-Gau merged commit 37333f4 into nilearn:main Jun 13, 2023
29 checks passed
@Remi-Gau Remi-Gau deleted the maint-masksers_f_string_sourcery branch June 13, 2023 09:02
@Remi-Gau Remi-Gau moved this from In progress to Done in R&R (reformat and refactor) Jun 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants