Skip to content

MAINT: Enable linting with ruff E501#31117

Open
nakul-krishnakumar wants to merge 4 commits intonumpy:mainfrom
nakul-krishnakumar:ruff-lint-e501-2
Open

MAINT: Enable linting with ruff E501#31117
nakul-krishnakumar wants to merge 4 commits intonumpy:mainfrom
nakul-krishnakumar:ruff-lint-e501-2

Conversation

@nakul-krishnakumar
Copy link
Copy Markdown
Contributor

PR summary

#28947

This PR fixes the E501 (line too long) style errors in the following files:

numpy/_core/_add_newdocs.py
numpy/_core/_add_newdocs_scalars.py

Only formatting improvements were done to meet the style guidelines.
I have used # noqa: E501 for specific doctest lines

AI Disclosure

Comment thread numpy/_core/_add_newdocs.py Outdated
Co-authored-by: Nakul Krishnakumar <nakulkrishnakumar86@gmail.com>
Comment thread numpy/_core/_add_newdocs.py Outdated
for NumPy bug-fix releases. All other API is tied to the experimental
API versioning.

except all references and examples related to the `optimize` argument (v 0.12.0)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

?

Copy link
Copy Markdown
Contributor Author

@nakul-krishnakumar nakul-krishnakumar Apr 2, 2026

Choose a reason for hiding this comment

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

I actually do not know why it shows that but I did not change it.
My PR branch: https://github.com/nakul-krishnakumar/numpy/blob/c5c2ee9fb4dee869b363bf802d86d29bb89bfe69/numpy/_core/_add_newdocs.py#L5983

Comment thread numpy/_core/_add_newdocs.py Outdated
Co-authored-by: Pieter Eendebak <pieter.eendebak@gmail.com>
@charris
Copy link
Copy Markdown
Member

charris commented Apr 11, 2026

Needs rebase.

*This documentation shadows that of the native python implementation of the `einsum`
function,
except all references and examples related to the `optimize` argument (v 0.12.0)
have been removed.*
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Be best to reformat this to get rid of the very short lines.

Copy link
Copy Markdown
Contributor Author

@nakul-krishnakumar nakul-krishnakumar Apr 12, 2026

Choose a reason for hiding this comment

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

Okay I will reformat it. My previous approach was to fit all the words possible in an 88 char length line and then use a newline.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It is the mix of line lengths within a paragraph that is bothersome. The last line can short, of course. Your editor should be able to do that.

Comment thread numpy/_core/_add_newdocs.py
for NumPy bug-fix releases. All other API is tied to the experimental
API versioning.

The reason for the split call is that cast information is required to
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

If you are going to do this, best to reformat all the lines to more or less equalize the line length.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Even the lines that are currently under 88 characters? Wouldn’t that make this file styled differently from other similar .py files that still contain lines under 88 characters?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The exact length does not matter that much, it is just easier to read if it isn't chopped up. I tend to keep things a bit shorter than maximum. Readability is the main consideration.

@nakul-krishnakumar
Copy link
Copy Markdown
Contributor Author

@charris Any updates on the above queries?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants