Skip to content

Comments

Fix linter#127

Merged
efiring merged 4 commits intoTEOS-10:mainfrom
ocefpaf:fix_linter
Apr 7, 2023
Merged

Fix linter#127
efiring merged 4 commits intoTEOS-10:mainfrom
ocefpaf:fix_linter

Conversation

@ocefpaf
Copy link
Member

@ocefpaf ocefpaf commented Apr 4, 2023

Merge only after #126.

This one is ready for review!

@ocefpaf ocefpaf mentioned this pull request Apr 4, 2023
@ocefpaf ocefpaf marked this pull request as ready for review April 5, 2023 12:16
Copy link
Member

@efiring efiring left a comment

Choose a reason for hiding this comment

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

Minor questions; overall, I like the cleanups.

if lon.shape != lat.shape or lon.ndim != 1:
raise ValueError('lon, lat must be 1-D and matching; found shapes'
' %s and %s' % (lon.shape, lat.shape))
' {} and {}'.format(lon.shape, lat.shape))
Copy link
Member

Choose a reason for hiding this comment

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

Might as well go all the way to an f-string.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do. I'm not sure why pyupgrade, even though it is set to py38, stopped at .format.

' {} and {}'.format(lon.shape, lat.shape))

if geo_strf.ndim not in (1, 2):
raise ValueError('geo_strf must be 1-D or 2-d; found shape %s'
Copy link
Member

Choose a reason for hiding this comment

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

I wonder why the old percent syntax is changed above, but not here?
There's actually nothing wrong with the old syntax; it isn't going to go
away. But in most cases, f-strings are more readable. I would certainly
use them for new code.

Copy link
Member

Choose a reason for hiding this comment

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

This comment somehow got connected to the wrong line. A few lines below here there is an unchanged line that has the percent syntax, and presumably ruff missed it.

Copy link
Member Author

Choose a reason for hiding this comment

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

Probably a bug in pyupgrade via ruff. I'll investigate and report upstream.

Copy link
Member Author

Choose a reason for hiding this comment

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

Looks like we are in the situation in the note here: https://github.com/asottile/pyupgrade#f-strings

pyproject.toml Outdated
]

"gsw/_utilities.py" = [
"B904",
Copy link
Member

Choose a reason for hiding this comment

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

For each of these skips, please add a short comment identifying what the rule addresses.

Copy link
Member Author

Choose a reason for hiding this comment

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

Done!

sphinx
sphinx_rtd_theme
twine
xarray
Copy link
Member Author

Choose a reason for hiding this comment

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

@DocOtak xarray is not compatible with pandas>=2 yet. I don't think we miss a lot b/c the tests are already on an import_skip and I believe you do have better testing in gsw_xarray upstream, right?

Copy link
Contributor

Choose a reason for hiding this comment

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

We test the full (apparent) API surface of GSW-Python in in gsw_xarray, so I wouldn't be too worried about breakages.

@ocefpaf ocefpaf requested a review from efiring April 6, 2023 18:56
@efiring efiring merged commit dc77e96 into TEOS-10:main Apr 7, 2023
@ocefpaf ocefpaf deleted the fix_linter branch April 7, 2023 19:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants