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

gh-248: fix all remaining possible ruff # noqa statements #394

Merged
merged 27 commits into from
Nov 7, 2024

Conversation

paddyroddy
Copy link
Member

Closes #248. Fixing all possible noqa statements. Leaving those that can't really be fixed, like too many function inputs. I expect some push back on these, so let's iterate.

@paddyroddy paddyroddy added enhancement New feature or request infrastructure Project infrastructure: dev tools, packaging, etc. labels Oct 30, 2024
@paddyroddy paddyroddy self-assigned this Oct 30, 2024
@paddyroddy paddyroddy marked this pull request as ready for review October 31, 2024 11:33
Comment on lines -194 to -195
# TODO(ntessore): missing spin-1 pixel window function here # noqa: FIX002
# https://github.com/glass-dev/glass/issues/243
Copy link
Member Author

Choose a reason for hiding this comment

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

Have just expanded the issue so we can remove FIX002

Copy link
Member

@Saransh-cpp Saransh-cpp left a comment

Choose a reason for hiding this comment

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

Thanks, @paddyroddy! Looks good to me 🙌🏼

glass/fields.py Outdated Show resolved Hide resolved
glass/lensing.py Show resolved Hide resolved
glass/fields.py Outdated Show resolved Hide resolved
glass/fields.py Outdated Show resolved Hide resolved
glass/galaxies.py Outdated Show resolved Hide resolved
glass/points.py Outdated
Comment on lines 282 to 284
assert np.sum(n[stop:]) == 0 # noqa: S101
if np.sum(n[stop:]) != 0:
msg = "The number of pixels sampled does not match the expected count."
raise ValueError(msg)
Copy link
Collaborator

Choose a reason for hiding this comment

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

This is also something that can only happen when something is intrinsically broken.

Is S101 really a helpful rule if it flags instances where an assert is definitely the right tool for the job?

Copy link
Member Author

@paddyroddy paddyroddy Nov 7, 2024

Choose a reason for hiding this comment

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

So it's if someone runs python -O in which case asserts will be removed https://docs.astral.sh/ruff/rules/assert

Copy link
Member Author

Choose a reason for hiding this comment

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

I can revert though

@paddyroddy
Copy link
Member Author

Have addressed @ntessore

Copy link
Collaborator

@ntessore ntessore left a comment

Choose a reason for hiding this comment

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

LGTM, excellent work!

@paddyroddy paddyroddy merged commit 9075c79 into main Nov 7, 2024
16 checks passed
@paddyroddy paddyroddy deleted the paddy/issue-248 branch November 7, 2024 20:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request infrastructure Project infrastructure: dev tools, packaging, etc.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Consider fixing most/all noqa: statements scattered throughout the code
3 participants