Visitar URL original
Use `ruff` and `refurb` on remainder of `plasmapy` by namurphy · Pull Request #1853 · PlasmaPy/PlasmaPy · GitHub
Skip to content

Use ruff and refurb on remainder of plasmapy - #1853

Merged
StanczakDominik merged 16 commits into
PlasmaPy:mainfrom
namurphy:refurb-remainder
Dec 23, 2022
Merged

StanczakDominik merged 16 commits into
PlasmaPy:mainfrom
namurphy:refurb-remainder

Conversation

@namurphy

Copy link
Copy Markdown
Member

This PR applies changes from ruff and refurb on a few other subpackages. This follows up on #1845, #1846, and #1847.

@github-actions

Copy link
Copy Markdown

Thank you for contributing to PlasmaPy! The project's future depends deeply on contributors like you, so we deeply appreciate it! 🌱 The following checklist will be used by the code reviewer to help guide the code review process.

  • Overall
    • Does the PR do what it intends to do?
    • Except for very minor changes, is a changelog entry included and consistent with the changelog guide?
    • Are the continuous integration checks passing? (Most linter problems can be automagically fixed by commenting on this PR with pre-commit.ci autofix.)
  • Code
    • Is new/updated code understandable and consistent with the coding guide?
    • Are there ways to greatly simplify the implementation?
    • Are there any large functions that should be split up into shorter functions?
  • Tests
    • Are tests added/updated as required, and consistent with the testing guide?
    • Are the tests understandable?
    • Do the tests cover all important cases?
  • Docs
    • Are docs added/updated as required, and consistent with the doc guide?
    • Are the docs understandable?
    • Do the docs show up correctly in the preview, including Jupyter notebooks?

@codecov

codecov Bot commented Dec 22, 2022 •

Copy link
Copy Markdown

Codecov Report

Base: 98.31% // Head: 98.31% // Decreases project coverage by -0.00% ⚠️

Coverage data is based on head (2d53e13) compared to base (5ba8f06).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1853      +/-   ##
==========================================
- Coverage   98.31%   98.31%   -0.01%     
==========================================
  Files          95       95              
  Lines        8378     8372       -6     
==========================================
- Hits         8237     8231       -6     
  Misses        141      141              
Impacted Files Coverage Δ
plasmapy/analysis/fit_functions.py 100.00% <100.00%> (ø)
plasmapy/analysis/nullpoint.py 98.53% <100.00%> (ø)
...mapy/analysis/swept_langmuir/floating_potential.py 100.00% <100.00%> (ø)
.../analysis/swept_langmuir/ion_saturation_current.py 100.00% <100.00%> (ø)
...rged_particle_radiography/synthetic_radiography.py 99.75% <100.00%> (ø)
plasmapy/dispersion/analytical/two_fluid_.py 100.00% <100.00%> (ø)
plasmapy/dispersion/numerical/hollweg_.py 100.00% <100.00%> (ø)
plasmapy/plasma/grids.py 99.33% <100.00%> (-0.01%) ⬇️
plasmapy/plasma/plasma_base.py 80.76% <100.00%> (ø)

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Comment on lines -58 to -65
vspace1_args = {
"x_range": [0, 10],
"y_range": [0, 10],
"z_range": [0, 10],
"precision": [10 / 46, 10 / 46, 10 / 46],
"func": vspace_func_1,
}
vspace1 = _vector_space(**vspace1_args)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This wasn't being used later.

W = 15e6

l = 10
l = 10 # noqa: E741

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The E741 code corresponds to potentially ambiguous variable names, like l which can be confused with 1.

wavelengths = (wavelengths * u.m).to(u.nm)

true_params = copy.deepcopy(params)
true_params = copy.deepcopy(params) # noqa: F841

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

true_params isn't used later, but it could be helpful using the pytest flag to show local variables.

Comment thread plasmapy/plasma/grids.py
Comment on lines -1443 to +1445
output = []
for arg in range(len(args)):
output.append(vals[:, arg] * self._interp_units[arg])
output = [vals[:, arg] * self._interp_units[arg] for arg in range(len(args))]

if len(output) == 1:
return output[0]
else:
return tuple(output)
return output[0] if len(output) == 1 else tuple(output)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Sourcery helped me out with these ones.

(cp_candidates[threshold_indices] + 1, [cp_candidates[-1] + 1])
)
rtn_extras["islands"] = [
rtn_extras["islands"] = [ # noqa: FURB140

@namurphy namurphy Dec 22, 2022 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This one was to use itertools.starmap, which started to make my brain hurt.

@namurphy
namurphy marked this pull request as ready for review December 23, 2022 00:40
@namurphy
namurphy requested review from a team and rocco8773 as code owners December 23, 2022 00:40
@namurphy namurphy added the refactoring ♻️ Improving an implementation without adding new functionality label Dec 23, 2022
@StanczakDominik
StanczakDominik merged commit 276c70f into PlasmaPy:main Dec 23, 2022
@namurphy
namurphy deleted the refurb-remainder branch December 23, 2022 07:01
@namurphy namurphy added the linters Code linters and autoformatters label May 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

linters Code linters and autoformatters refactoring ♻️ Improving an implementation without adding new functionality

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants