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

[WIP][MAINT] implement walrus operator? #4202

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

Remi-Gau
Copy link
Collaborator

  • Closes none

Changes proposed in this pull request:

  • add hook to implement walrus operator
  • run all pre-commit hooks

@Remi-Gau Remi-Gau marked this pull request as draft January 10, 2024 14:13
Copy link
Contributor

👋 @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.

nilearn/datasets/func.py Outdated Show resolved Hide resolved
nilearn/datasets/func.py Outdated Show resolved Hide resolved
@Remi-Gau
Copy link
Collaborator Author

walrus operator is a python 3.8 feature so just adding a pre-commit hook to enforce it given that we have dropped python 3.7

Curious to see how others feel about it.

@Remi-Gau Remi-Gau changed the title implement walrus operator [WIP][MAINT] implement walrus operator Jan 10, 2024
Copy link

codecov bot commented Jan 10, 2024

Codecov Report

Attention: 2 lines in your changes are missing coverage. Please review.

Comparison is base (6764c9e) 92.09% compared to head (78581c9) 91.88%.
Report is 15 commits behind head on main.

Files Patch % Lines
nilearn/datasets/func.py 50.00% 0 Missing and 2 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4202      +/-   ##
==========================================
- Coverage   92.09%   91.88%   -0.22%     
==========================================
  Files         144      144              
  Lines       16366    16348      -18     
  Branches     3426     3164     -262     
==========================================
- Hits        15073    15021      -52     
- Misses        754      785      +31     
- Partials      539      542       +3     
Flag Coverage Δ
macos-latest_3.10_test_plotting ?
macos-latest_3.11_test_plotting ?
macos-latest_3.12_test_plotting 91.88% <88.88%> (-0.01%) ⬇️
macos-latest_3.8_test_plotting ?
macos-latest_3.9_test_plotting ?
ubuntu-latest_3.10_test_plotting ?
ubuntu-latest_3.11_test_plotting ?
ubuntu-latest_3.12_test_plotting ?
ubuntu-latest_3.12_test_pre ?
ubuntu-latest_3.8_test_min ?
ubuntu-latest_3.8_test_plot_min ?
ubuntu-latest_3.8_test_plotting ?
ubuntu-latest_3.9_test_plotting ?
windows-latest_3.10_test_plotting ?
windows-latest_3.11_test_plotting ?
windows-latest_3.12_test_plotting ?
windows-latest_3.8_test_plotting ?
windows-latest_3.9_test_plotting ?

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ymzayek
Copy link
Member

ymzayek commented Jan 11, 2024

I like it but some of its effects that may not be clear makes me hesitant about enforcing it. No strong opinion though. Here's this blog post about it: https://martinheinz.dev/blog/79

@bthirion
Copy link
Member

No strong feeling about this. We should follow what the majority of the community considers best practices.

@Remi-Gau
Copy link
Collaborator Author

this is defo not urgent so we can wait to get more feedback

@jeromedockes
Copy link
Member

weak -1 for me. even though it's been around for a few releases I don't see the walrus operator being used that often; I wouldn't be surprised if some contributors don't know what it is; the updated code in the diff is not really better than the old one so I don't see a reason for the change.

As 3.7 support is dropped I don't mind new code using that operator when the contributor wants to use it, but I don't see the logic behind systematically enforcing its use wherever it could possibly be applied

@jeromedockes
Copy link
Member

more generally I would really like to avoid going overboard with the precommit and linting stuff and only enforce coding style rules that actually make the codebase easier to maintain or contribute to (including for new contributors)

@Remi-Gau Remi-Gau changed the title [WIP][MAINT] implement walrus operator [WIP][MAINT] implement walrus operator? Jan 22, 2024
@Remi-Gau Remi-Gau added the Discussion This issue is used to hold a general discussion on a specific topic where community feedback is desi label Jan 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Discussion This issue is used to hold a general discussion on a specific topic where community feedback is desi
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants