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 mypy errors (assembler) #8258

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Fix mypy errors (assembler) #8258

wants to merge 1 commit into from

Conversation

Randl
Copy link
Contributor

@Randl Randl commented Jun 28, 2022

Summary

Following discussion, I'm splitting #8187 by module.

Details and comments

The are 10 errors left:

qiskit/assembler/assemble_schedules.py:62: error: Argument 1 to "_assemble_experiments" has incompatible type "List[Union[ScheduleBlock, Union[Schedule, Instruction], Tuple[int, Union[Schedule, Instruction]]]]"; expected "List[Union[Union[Schedule, Instruction], Tuple[int, Union[Schedule, Instruction]]]]"  [arg-type]
qiskit/assembler/assemble_schedules.py:103: error: Argument 1 to "target_qobj_transform" has incompatible type "Union[Union[Schedule, Instruction], Tuple[int, Union[Schedule, Instruction]]]"; expected "Union[ScheduleBlock, Schedule, Union[Tuple[int, Instruction], Instruction], Iterable[Union[Tuple[int, Instruction], Instruction]]]"  [arg-type]
qiskit/assembler/assemble_schedules.py:207: error: Argument 1 to "sha256" has incompatible type "ndarray[Any, Any]"; expected "Union[bytes, Union[bytearray, memoryview, array[Any], mmap, _CData, PickleBuffer]]"  [arg-type]
qiskit/assembler/assemble_schedules.py:213: error: "Pulse" has no attribute "samples"  [attr-defined]
qiskit/assembler/assemble_schedules.py:224: error: Value of type variable "SupportsRichComparisonT" of "max" cannot be "Union[int, ParameterExpression]"  [type-var]
qiskit/assembler/assemble_schedules.py:224: error: Incompatible types in assignment (expression has type "Union[int, ParameterExpression]", variable has type "int")  [assignment]
qiskit/assembler/assemble_schedules.py:234: error: Argument 1 to "_validate_meas_map" has incompatible type "defaultdict[Tuple[int, Union[int, ParameterExpression]], List[Acquire]]"; expected "Dict[Tuple[int, Acquire], List[Acquire]]"  [arg-type]
qiskit/assembler/assemble_schedules.py:262: error: Unsupported operand types for + ("int" and "Acquire")  [operator]
qiskit/assembler/assemble_schedules.py:283: error: Unsupported operand types for + ("int" and "Acquire")  [operator]
qiskit/assembler/disassemble.py:263: error: Invalid index type "MeasureChannel" for "Dict[DriveChannel, Any]"; expected type "DriveChannel"  [index]

Some of those are related to Schedule, not sure what the fix should be. Some others are related to the fact that Acquire properties may be ParameterExpression but are summed/compared to int (this is common problem in other places too).

@Randl Randl requested a review from a team as a code owner June 28, 2022 14:13
@qiskit-bot
Copy link
Collaborator

Thank you for opening a new pull request.

Before your PR can be merged it will first need to pass continuous integration tests and be reviewed. Sometimes the review process can be slow, so please be patient.

While you're waiting, please feel free to review other open PRs. While only a subset of people are authorized to approve pull requests for merging, everyone is encouraged to review open pull requests. Doing reviews helps reduce the burden on the core team and helps make the project's code better for everyone.

One or more of the the following people are requested to review this:

  • @Qiskit/terra-core

@Randl Randl changed the title Fix assembler mypy errors Fix mypy errors (assembler) Jun 28, 2022
@javabster javabster added the Community PR PRs from contributors that are not 'members' of the Qiskit repo label Jun 28, 2022
@1ucian0 1ucian0 added the mypy Work related to support improving type hints in Qiskti code label Mar 30, 2023
@Randl Randl force-pushed the mypy-7 branch 2 times, most recently from c8388ba to 2c8be5b Compare May 23, 2023 13:45
@coveralls
Copy link

Pull Request Test Coverage Report for Build 5058087172

  • 8 of 8 (100.0%) changed or added relevant lines in 3 files are covered.
  • 6 unchanged lines in 2 files lost coverage.
  • Overall coverage increased (+0.06%) to 85.926%

Files with Coverage Reduction New Missed Lines %
crates/accelerate/src/sabre_swap/mod.rs 2 99.53%
crates/qasm2/src/lex.rs 4 90.89%
Totals Coverage Status
Change from base Build 5050064110: 0.06%
Covered Lines: 71193
Relevant Lines: 82854

💛 - Coveralls

@coveralls
Copy link

Pull Request Test Coverage Report for Build 7370764643

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.03%) to 87.528%

Totals Coverage Status
Change from base Build 7369683756: -0.03%
Covered Lines: 59240
Relevant Lines: 67681

💛 - Coveralls

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Community PR PRs from contributors that are not 'members' of the Qiskit repo mypy Work related to support improving type hints in Qiskti code
Projects
Status: mypy
Development

Successfully merging this pull request may close these issues.

None yet

5 participants