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

Fix import of mirror qv circuit function #2570

Merged
merged 1 commit into from
Nov 13, 2024
Merged

Conversation

cosenal
Copy link
Contributor

@cosenal cosenal commented Nov 13, 2024

An explicit import of the mirror qv circuit function was missing; adding it for coherence with the rest of the module.

This solves the issue reported by @Shivansh20128 while working on #2274

I ran this line

circuit= benchmarks.mirror_qv_circuits.generate_mirror_qv_circuit(num_qubits=10, depth=2)

But I got the attribute error:

AttributeError: module 'mitiq.benchmarks' has no attribute 'mirror_qv_circuits'.

Note

Absolute vs. relative, and explicit vs. implicit imports is somehow a recurrent source of confusion/issue for users in Mitiq (more so than in another Python packages it seems.) This is because we haven't done a great job at pre-importing modules in dunder init files, neither we have defined a dynamic loading rule of the modules. For an explanation of the issue, see #2471 (comment)

That being said, for this specific case, the fix is straightforward, it was just a miss of a previous PR.

Copy link

codecov bot commented Nov 13, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 98.72%. Comparing base (45778e8) to head (18f1e14).
Report is 1 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2570   +/-   ##
=======================================
  Coverage   98.72%   98.72%           
=======================================
  Files          92       92           
  Lines        4167     4168    +1     
=======================================
+ Hits         4114     4115    +1     
  Misses         53       53           

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

@cosenal cosenal self-assigned this Nov 13, 2024
@cosenal cosenal added bug Something isn't working benchmarks Tools for benchmarking error mitigation methods. labels Nov 13, 2024
@Shivansh20128 Shivansh20128 mentioned this pull request Nov 13, 2024
6 tasks
@cosenal cosenal merged commit 3315184 into main Nov 13, 2024
18 checks passed
@cosenal cosenal deleted the import-mirror-qv-fix branch November 13, 2024 12:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
benchmarks Tools for benchmarking error mitigation methods. bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants