ruff - enable and fix selected RUF rules#7883
Conversation
|
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
|
@pavoljuhas I would like some input on this. It seems like this is one of those things that might not be wanted. Obviously this PR needs more work to move forward, but I wanted to call it out because it also might be a big changed for some people. A gist of the changes: and I guess the call outs are and some formatting weirdness: |
You'd need to use your judgement to accept or ignore such matches. In some cases the addition should be left as is for example for Same thing, it should be left alone from the linter POV. BTW, that code is a bit buggy so I will submit a separate PR for that soon.
I don't know where does that come from, perhaps some formatting feature in IDE? If you run formatter localy, make sure it is black-26.1.0. the black --check cirq-core/cirq/contrib/qasm_import/_parser_test.py does not complain.BTW, the iter(...) call on that line is redundant, because circuit.all_operations() is already iterator.Please correct and look out for similar ruff-generated fixes. |
|
Will be able to address the comments and pick this up within a week, I hope |
# Conflicts: # cirq-core/cirq/devices/grid_qubit.py # cirq-core/cirq/transformers/analytical_decompositions/three_qubit_decomposition.py # pyproject.toml
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #7883 +/- ##
==========================================
- Coverage 99.62% 99.62% -0.01%
==========================================
Files 1104 1104
Lines 99317 99322 +5
==========================================
+ Hits 98944 98947 +3
- Misses 373 375 +2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@pavoljuhas this looks to be the last part of #7505 (for now, i assume). feel free to flag me on anything you'd like me to update and I will get to it over the next few days |
Disable RUF005 locally instead.
And fix annotation for `observables_to_settings` which produces an iterator.
Keep iteration over all results from `Engine.run` so that the run is completely finished as before.
Block-disables are by default reversed after their block.
Their items can be star-expanded without collecting in temporary container.
pavoljuhas
left a comment
There was a problem hiding this comment.
LGTM with a couple of tweaks pushed in.
Thank you for chipping away this stone!
Adding checks for #7505
RUF005 - collection-literal-concatenation
RUF015 - unnecessary-iterable-allocation-for-first-element
This resolves #7505