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

Added __str__ method to CustomParticle class. #2702

Merged
merged 9 commits into from
May 28, 2024

Conversation

Quettle
Copy link
Contributor

@Quettle Quettle commented May 24, 2024

Description

Adds the method __str__ that calls the symbol getter of the CustomParticle class.

Motivation and context

This makes the behavior of custom particle instances consistent with that of other particle objects, With a fallback to the repr if no symbol was provided.

Related issues

Closes #2701

Copy link

Thank you for submitting a pull request (PR) to PlasmaPy! ✨ The future of the project depends on contributors like you, so we deeply appreciate it! 🌱

Our contributor guide has information on:

Important

PlasmaPy recently switched to an src layout. The source code previously in plasmapy/ is now in src/plasmapy/. Tests are now in tests/. If you have previously done an editable installation, it will likely need to be re-done (i.e., with pip install -e .[tests,docs] in the top-level directory of the repository). The former plasmapy/ directory will need to be deleted manually in old clones because git does not track directories.

The bottom of this page shows several checks that are run for every PR. Don't worry if something broke! We break stuff all the time. 😺 Click on "Details" to learn why a check didn't pass. Please also feel free to ask for help. We do that all the time as well. 🌸 You can find us in our chat room or weekly community meeting & office hours. Here are some tips:

  • Try fixing CI / Python 3.12 test failures first.
  • Most pre-commit.ci - pr failures can be automagically fixed by commenting pre-commit.ci autofix below, followed by a git pull to bring the changes back to your computer. Please also see our pre-commit troubleshooting guide.
  • If pre-commit.ci - pr says that a function is too long or complex, try breaking up that function into multiple short functions that each do one thing. See also these tips on writing clean scientific software.
  • If the CI / Documentation check ends with a cryptic error message, check out our documentation troubleshooting guide.
  • For a documentation preview, click on Details next to docs/readthedocs.org:plasmapy.

If this PR is marked as ready for review, someone should stop by to provide a code review and offer suggestions soon. ✅ If you don't get a review within a few days, please feel free to send us a reminder.

Please also use SI units within PlasmaPy, except when there is strong justification otherwise or in some examples.

We thank you once again!

@github-actions github-actions bot added plasmapy.particles Related to the plasmapy.particles subpackage testing python Pull requests that update Python code labels May 24, 2024
Copy link

codecov bot commented May 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.23%. Comparing base (534b8e9) to head (a5ed75b).
Report is 1 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2702      +/-   ##
==========================================
- Coverage   95.25%   95.23%   -0.02%     
==========================================
  Files         104      104              
  Lines        9435     9399      -36     
  Branches     2159     2155       -4     
==========================================
- Hits         8987     8951      -36     
  Misses        272      272              
  Partials      176      176              

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

@github-actions github-actions bot added the breaking change For breaking changes, excluding deprecations and planned removals label May 24, 2024
@Quettle Quettle marked this pull request as ready for review May 24, 2024 12:16
@Quettle Quettle requested a review from a team as a code owner May 24, 2024 12:16
@Quettle Quettle requested review from pheuer and removed request for a team May 24, 2024 12:16
Copy link
Member

@namurphy namurphy left a comment

Choose a reason for hiding this comment

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

Thank you for adding this! It will be helpful to have CustomParticle and Particle objects behave the same when provided to repr. I have some minor suggestions and otherwise we can probably get this in pretty quickly. Thank you again!

@namurphy namurphy removed the request for review from pheuer May 24, 2024 15:32
Copy link
Member

@namurphy namurphy left a comment

Choose a reason for hiding this comment

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

LGTM! 🚀 Thank you for doing this! 🙏🏻

@namurphy namurphy enabled auto-merge (squash) May 28, 2024 21:40
@namurphy namurphy merged commit d024a2e into PlasmaPy:main May 28, 2024
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking change For breaking changes, excluding deprecations and planned removals plasmapy.particles Related to the plasmapy.particles subpackage python Pull requests that update Python code testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Adding __str__ to CustomParticle.
2 participants