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

Import CircuitInstruction to fix Pylance complaint #13579

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

kevinsung
Copy link
Contributor

Summary

Using CircuitInstruction in a type annotation causes Pylance to complain

Variable not allowed in type expression

This fixes that.

Details and comments

@kevinsung kevinsung requested a review from a team as a code owner December 18, 2024 18:09
@qiskit-bot
Copy link
Collaborator

One or more of the following people are relevant to this code:

  • @Qiskit/terra-core

@coveralls
Copy link

coveralls commented Dec 18, 2024

Pull Request Test Coverage Report for Build 12401989194

Details

  • 1 of 1 (100.0%) changed or added relevant line in 1 file are covered.
  • 13 unchanged lines in 3 files lost coverage.
  • Overall coverage decreased (-0.008%) to 88.953%

Files with Coverage Reduction New Missed Lines %
crates/accelerate/src/unitary_synthesis.rs 1 92.2%
crates/qasm2/src/lex.rs 6 91.98%
crates/qasm2/src/parse.rs 6 97.62%
Totals Coverage Status
Change from base Build 12395850432: -0.008%
Covered Lines: 79428
Relevant Lines: 89292

💛 - Coveralls

@Cryoris
Copy link
Contributor

Cryoris commented Dec 18, 2024

If we change this, it would be good to have a guideline and a check by CI/linter. Otherwise we cannot ensure we're consistent here and this change seems a bit arbitrary.

I've used Pylance as well, aren't there also other things it complains about? E.g. using (TypeA, TypeB) instead of tuple[TypeA, TypeB] or something?

@kevinsung kevinsung force-pushed the circuitinstruction-import branch from c2397e3 to da6cd86 Compare December 18, 2024 21:17
@kevinsung
Copy link
Contributor Author

If we change this, it would be good to have a guideline and a check by CI/linter. Otherwise we cannot ensure we're consistent here and this change seems a bit arbitrary.

Does the change still seem arbitrary after the latest commit? I think it brings it more in line with the rest of Qiskit, since we normally import stuff rather than setting a variable like it was before.

I've used Pylance as well, aren't there also other things it complains about? E.g. using (TypeA, TypeB) instead of tuple[TypeA, TypeB] or something?

I don't know, this is the only one that I noticed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants