-
Notifications
You must be signed in to change notification settings - Fork 89
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
chore: ruff rewrite dicts #2183
Conversation
Codecov Report
Additional details and impacted files
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The dict constructor was only ever used in the entry-point from operations to their implementation functions. (See where the diffs are!)
The choice of dict constructor over built-in syntax was so that the function argument names would show up in the same color as they are in the entry-point function and the implementation function (as Python identifiers, not as strings). So there was a logic to it.
But activating C408 means that other instances of dict constructors can't accidentally slip in, in the future, and there's value in that.
I'm okay with making this change.
We can deactivate it for a specific subset of files (assuming it can be matched on) if you'd prefer. Actually, could |
In this case, I think we'd sooner replace the need to setup the context manager entirely with a decorator. We just haven't gotten around to it yet :) |
The built-in syntax is preferable to passing keywords to the dict constructor, which wastes a function call. Besides being more consistent and recognisable, it is also faster:
This removes the ignoring of
"C408"
.