Skip to content

Conversation

pavoljuhas
Copy link
Collaborator

@pavoljuhas pavoljuhas commented Jun 5, 2025

  • enable and fix F601 - multi-value-repeated-key-literal
  • enable and fix F401 - unused-import

No change in the effective code.

Partially implements #7371

@github-actions github-actions bot added the size: M 50< lines changed <250 label Jun 5, 2025
Copy link

codecov bot commented Jun 5, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.69%. Comparing base (15345b4) to head (ab12edc).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #7413      +/-   ##
==========================================
- Coverage   98.69%   98.69%   -0.01%     
==========================================
  Files        1112     1112              
  Lines       97747    97745       -2     
==========================================
- Hits        96469    96467       -2     
  Misses       1278     1278              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@pavoljuhas pavoljuhas requested a review from dstrain115 June 6, 2025 01:22
Copy link
Contributor

@mhucka mhucka left a comment

Choose a reason for hiding this comment

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

LGTM, with an optional change at your discretion, noted in a comment.

try:
import qiskit as _
except ImportError: # pragma: no cover
if importlib.util.find_spec('qiskit') is None: # pragma: no cover
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 not disputing this approach but this change seems to go against Python EAFP (easier to ask for forgiveness than permission) coding style. (C.f. https://docs.quantifiedcode.com/python-anti-patterns/readability/asking_for_permission_instead_of_forgiveness_when_working_with_files.html).

(Flagging it here even though I see it's done in other places in this PR.)

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Ack. I just followed the ruff-check recommendation. I suppose for a linter it is impossible to tell if an import is unused intentionally (as in our case) or if it is a leftover dead code. An import is also potentially expensive operation, so there is a benefit in not importing if we just need to know module availability.

@pavoljuhas pavoljuhas added this pull request to the merge queue Jun 9, 2025
@github-merge-queue github-merge-queue bot removed this pull request from the merge queue due to failed status checks Jun 9, 2025
@pavoljuhas pavoljuhas added this pull request to the merge queue Jun 9, 2025
Merged via the queue into quantumlib:main with commit 6bb6661 Jun 9, 2025
35 checks passed
@pavoljuhas pavoljuhas deleted the small-ruff-fixups branch June 9, 2025 22:34
BichengYing pushed a commit to BichengYing/Cirq that referenced this pull request Jun 20, 2025
- enable and fix F601 - multi-value-repeated-key-literal
- enable and fix F401 - unused-import

No change in the effective code.

Partially implements quantumlib#7371
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: M 50< lines changed <250
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants