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

Improve type hint annotations to plasmapy.particles #2458

Merged
merged 18 commits into from Mar 5, 2024

Conversation

namurphy
Copy link
Member

@namurphy namurphy commented Jan 11, 2024

This PR is part of the process of adding & correcting type hints in plasmapy.particles, as a follow-up to my prior attempt in #2429.

I started this PR by using MonkeyType to generate type hints based on the types of variables while running pytest. I also made some manual updates following this.

@github-actions github-actions bot added the plasmapy.particles Related to the plasmapy.particles subpackage label Jan 11, 2024
Copy link

codecov bot commented Jan 11, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 96.93%. Comparing base (20e60aa) to head (427b86c).
Report is 57 commits behind head on main.

❗ Current head 427b86c differs from pull request most recent head 2ea880c. Consider uploading reports for the commit 2ea880c to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2458   +/-   ##
=======================================
  Coverage   96.93%   96.93%           
=======================================
  Files         104      104           
  Lines        9163     9165    +2     
=======================================
+ Hits         8882     8884    +2     
  Misses        281      281           

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

@namurphy namurphy changed the title Improve type hint annotations to plasmapy.particles.atomic Improve type hint annotations to plasmapy.particles Jan 12, 2024
@namurphy namurphy modified the milestone: v2024.1.0 Jan 17, 2024
@github-actions github-actions bot added plasmapy.plasma Related to the plasmapy.plasma subpackage plasmapy.formulary Related to the plasmapy.formulary subpackage plasmapy.formulary.quantum Related to the plasmapy.formulary.quantum module labels Feb 5, 2024
@namurphy namurphy added this to the Future milestone Feb 6, 2024


def _physical_particle_factory(
*args, **kwargs
*args: ParticleLike | u.Quantity | CustomParticle | Sequence[ParticleLike],
Copy link
Member Author

@namurphy namurphy Mar 4, 2024

Choose a reason for hiding this comment

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

I thought about creating a type alias variable for all of this since it gets repeated, but if we make _physical_particle_factory into a public function, the type alias variable would need to also be public so that the documentation build doesn't break...I think.

...since it was breaking the documentation build.
@namurphy namurphy marked this pull request as ready for review March 4, 2024 23:34
@namurphy namurphy requested a review from a team as a code owner March 4, 2024 23:34
@namurphy namurphy requested review from ejohnson-96 and removed request for a team March 4, 2024 23:34
@namurphy namurphy added the status: ready for review PRs that are ready for code review label Mar 5, 2024
Copy link
Contributor

@ejohnson-96 ejohnson-96 left a comment

Choose a reason for hiding this comment

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

👍

@namurphy namurphy merged commit d7b0c41 into PlasmaPy:main Mar 5, 2024
18 checks passed
@namurphy namurphy deleted the monkeytype-1 branch March 5, 2024 17:26
@github-actions github-actions bot removed the status: ready for review PRs that are ready for code review label Mar 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
plasmapy.formulary.quantum Related to the plasmapy.formulary.quantum module plasmapy.formulary Related to the plasmapy.formulary subpackage plasmapy.particles Related to the plasmapy.particles subpackage plasmapy.plasma Related to the plasmapy.plasma subpackage testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants