Repository navigation
fix ruff rule B007 violation in astropy/modeling - #17860
Conversation
|
Thank you for your contribution to Astropy! 🌌 This checklist is meant to remind the package maintainers who will review this pull request of some common things to look for.
|
| for i in range(1, self.niter + 1): | ||
| n=i |
|
Thanks for the PR @kangqiwang. There are sone good opportunities to further simplify the code. |
| for i in range(1, self.niter + 1): | ||
| n=i |
There was a problem hiding this comment.
shouldn't this be
| for i in range(1, self.niter + 1): | |
| n=i | |
| for _ in range(1, self.niter + 1): |
?
There was a problem hiding this comment.
The numbers of loops executed is recorded and there is a possibility of breaking early, but you have to go all the way down to line 1109 (or 1108 in main) to see that. I would rename n to niter and replace
| for i in range(1, self.niter + 1): | |
| n=i | |
| for _ in range(self.niter): | |
| niter += 1 |
Then it would be clearer that niter is a counter that will be used after the loop, not just a loop variable.
5d79957 to
dfeaa97
Compare
|
I fixed formatting issues and a (spurious) merge conflict. Let's get this in. Thanks @kangqiwang |
Description
This pull request is to address to split pull request #17844 , and it ensure compliance of
astropy/modelingto Ruff rule unused-loop-control-variable (B007)fixes partially #14818
Fixes #