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

Support variable keys in static dictionary key rule #9411

Merged
merged 1 commit into from
Jan 6, 2024
Merged

Conversation

charliermarsh
Copy link
Member

Closes #9410.

@charliermarsh charliermarsh added the rule Implementing or modifying a lint rule label Jan 6, 2024
@charliermarsh charliermarsh enabled auto-merge (squash) January 6, 2024 20:38
@charliermarsh charliermarsh merged commit 701697c into main Jan 6, 2024
16 checks passed
@charliermarsh charliermarsh deleted the charlie/B branch January 6, 2024 20:44
Copy link
Contributor

github-actions bot commented Jan 6, 2024

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

Formatter (stable)

✅ ecosystem check detected no format changes.

Formatter (preview)

✅ ecosystem check detected no format changes.

{(1, "a"): value.upper() for value in data} # constant tuple
{(1, "a"): value.upper() for value in data} # Constant tuple
{constant: value.upper() for value in data}
{constant + constant: value.upper() for value in data}
Copy link
Contributor

Choose a reason for hiding this comment

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

awesome 🎉, so quick :)

I dont know if this is a common use case but I guess one case not covered here is if the key in an attr.
e.g.

{SomeClass.CONSTANT: val for val in data}
{Some.Class.CONSTANT: val for val in data}

Copy link
Member Author

Choose a reason for hiding this comment

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

Good call, let me test that!

Copy link
Member Author

Choose a reason for hiding this comment

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

See: #9416

Copy link
Contributor

Choose a reason for hiding this comment

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

Awesome

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
rule Implementing or modifying a lint rule
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Implement more flake8-bugbear rules
2 participants