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

Fix for issue #4655 Removing mutable data structures and function calls as default arguments in the entire codebase #4810

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from

Conversation

tanishy7777
Copy link

@tanishy7777 tanishy7777 commented Nov 30, 2024

Fixes #4655

Changes made in this Pull Request:

  • Removing mutable data structures and function calls as default arguments in the entire codebase and initializing/calling them inside the function instead
  • There were 12 issues found using the ruff module(select = B006, B008 and ignore=E501) which were all fixed

PR Checklist

  • Tests
  • CHANGELOG updated?
  • Issue raised/referenced

Developers certificate of origin


📚 Documentation preview 📚: https://mdanalysis--4810.org.readthedocs.build/en/4810/

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

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

Hello there first time contributor! Welcome to the MDAnalysis community! We ask that all contributors abide by our Code of Conduct and that first time contributors introduce themselves on GitHub Discussions so we can get to know you. You can learn more about participating here. Please also add yourself to package/AUTHORS as part of this PR.

@tanishy7777
Copy link
Author

Before and after the changes were made (results below are from pytest tests in the testsuite)
Before
image

After the changes
image

Copy link

codecov bot commented Nov 30, 2024

Codecov Report

Attention: Patch coverage is 57.14286% with 12 lines in your changes missing coverage. Please review.

Project coverage is 86.37%. Comparing base (905f197) to head (dc712ac).
Report is 1 commits behind head on develop.

Files with missing lines Patch % Lines
package/MDAnalysis/analysis/encore/similarity.py 62.50% 0 Missing and 3 partials ⚠️
package/MDAnalysis/analysis/base.py 0.00% 1 Missing and 1 partial ⚠️
package/MDAnalysis/analysis/helix_analysis.py 66.66% 1 Missing and 1 partial ⚠️
package/MDAnalysis/core/universe.py 0.00% 2 Missing ⚠️
package/MDAnalysis/topology/ITPParser.py 33.33% 1 Missing and 1 partial ⚠️
package/MDAnalysis/analysis/align.py 66.66% 0 Missing and 1 partial ⚠️

❗ There is a different number of reports uploaded between BASE (905f197) and HEAD (dc712ac). Click for more details.

HEAD has 2 uploads less than BASE
Flag BASE (905f197) HEAD (dc712ac)
7 5
Additional details and impacted files
@@             Coverage Diff             @@
##           develop    #4810      +/-   ##
===========================================
- Coverage    93.68%   86.37%   -7.31%     
===========================================
  Files          177      189      +12     
  Lines        21742    22832    +1090     
  Branches      3055     3067      +12     
===========================================
- Hits         20369    19722     -647     
- Misses         927     2671    +1744     
+ Partials       446      439       -7     

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

Copy link
Member

@RMeli RMeli left a comment

Choose a reason for hiding this comment

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

Can you please detail how the error raised in #4810 (comment) is related to the changes?

package/CHANGELOG Outdated Show resolved Hide resolved
package/CHANGELOG Outdated Show resolved Hide resolved
package/MDAnalysis/analysis/helix_analysis.py Show resolved Hide resolved
@tanishy7777
Copy link
Author

tanishy7777 commented Dec 1, 2024

Can you please detail how the error raised in #4810 (comment) is related to the changes?

I am not sure why the error got resolved, but after making the changes it got solved.

According to the file test_encore from which the error was generated from, the function can result in failure sometimes because the function involves generating random numbers.

image

shortened the fixes in the changelog
using tuples instead of list for ref_axis
@tanishy7777
Copy link
Author

I have added the changes that you have mentioned @RMeli

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.

MAINT: a few mutable default arguments are back
2 participants