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

[lint] organizes python imports #14260

Merged
merged 3 commits into from
Mar 13, 2024

Conversation

iris-garden
Copy link
Contributor

No description provided.

@iris-garden iris-garden force-pushed the lint/just-imports branch 3 times, most recently from 1e82307 to f757324 Compare February 23, 2024 18:53
@iris-garden iris-garden changed the title lint wip [lint] organizes python imports Feb 23, 2024
@iris-garden iris-garden force-pushed the lint/just-imports branch 3 times, most recently from 89179c4 to b33cc85 Compare February 29, 2024 16:54
Copy link
Contributor

@daniel-goldstein daniel-goldstein left a comment

Choose a reason for hiding this comment

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

requesting changes to move this off my queue

Copy link
Contributor

@daniel-goldstein daniel-goldstein left a comment

Choose a reason for hiding this comment

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

This is great! Just a couple tiny notes

@@ -1,5 +1,4 @@
import warnings
from ..aiocloud.aiogoogle import * # noqa: F403
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this is not quite right. This package was moved but this line exists to re-export those objects under the old package name. The proper way to do this is probably to put all those imports into __ALL__.

Copy link
Contributor

Choose a reason for hiding this comment

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

If doing so is painful, we can probably remove this file at this point (it's been a while), but let's do that as a separate PR.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

updated! i just used the __all__ list from aiocloud/aiogoogle/__init__.py to decide what to include, if that seems good

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm hesitant about this because now it needs to be kept in sync with aiocloud.aiogoogle. Why did ruff complain about the star import in the first place? Shouldn't it respect the noqa?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

that.....is a very good point. i reverted this file to the version on main and it does not, in fact, complain; it must have at some point? but honestly i don't remember 😅

@@ -1881,6 +1890,7 @@ def write_file(n, n_rows=5):
out.write('\t')
out.write(str(i % 2 == 0))

widths = [1 << k for k in range(8, 14)]
Copy link
Contributor

Choose a reason for hiding this comment

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

huh, where's this from?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is from dan's PR for linting the tests, we had talked about it at standup at some point; ruff complains that widths is undefined otherwise. we can split this off into a tiny PR and just add an ignore for the error if that works better, just lmk!

Copy link
Contributor

Choose a reason for hiding this comment

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

I see, that comes from #7416 and is a historical reference that is unused. Ok we can just keep it as it is in this PR.

@@ -13,6 +13,31 @@ ignore = [
"PLR0913", # Too many arguments to function call
"PLC1901", # `<VAR> != ''` can be simplified to `<VAR>` as an empty string is falsey
"PLR2004", # Magic value used in comparison
"F541",
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you leave a comment here that clarifies that we intend to eliminate these added rules as opposed to the existing ones which we indefinitely turned off

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added!

Copy link
Contributor

@daniel-goldstein daniel-goldstein left a comment

Choose a reason for hiding this comment

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

One last question

@@ -1,5 +1,4 @@
import warnings
from ..aiocloud.aiogoogle import * # noqa: F403
Copy link
Contributor

Choose a reason for hiding this comment

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

I'm hesitant about this because now it needs to be kept in sync with aiocloud.aiogoogle. Why did ruff complain about the star import in the first place? Shouldn't it respect the noqa?

Copy link
Contributor

@daniel-goldstein daniel-goldstein left a comment

Choose a reason for hiding this comment

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

Looking forward to never worrying about imports ever again 😌

@hail-ci-robot hail-ci-robot merged commit 01a6a6a into hail-is:main Mar 13, 2024
2 checks passed
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