• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Qiskit / qiskit / 11221302818

07 Oct 2024 06:04PM UTC coverage: 88.868% (-0.03%) from 88.899%
11221302818

push

github

web-flow
Improve deprecation of unit and duration (#13247)

* Improve deprecation of unit and duration

The unit and duration attributes of QuantumCircuit and Instruction were
introduced in #13224 however the way the PR went about this was a bit to
abbreviated and it had several downsides. The most noticable was that it
introduced a significant runtime regression as the rust internals were
accessing the deprecated getter. This is fixed so that the rust code
doesn't try to access any deprecated attributes. However, more
importantly there were several edge cases not accoutned for in the PR.
Mainly, DAGCircuit's matching attribute were not deprecated, but then
also specific use cases of the attributes were not addressed. The
primary driver of the per instruction duration and unit were the
timeline visualization which didn't have a method to function without
these data attributes. This commit addresses this by adding a new
target argument that is used to provide a backend's target which is
the source of truth for durations in a post unit/duration `Instruction`.
The other notable edge case is the `Delay` instruction which will need
to retain the duration and unit attributes as the fields are integral
for that instruction. The `Delay` is updated to handle them explicitly
outside of the `Instrution` data model to avoid complications around the
deprecation.

* Apply suggestions from code review

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

* Fix lint

* Mention the target in constructor deprecation message

---------

Co-authored-by: Elena Peña Tapia <57907331+ElePT@users.noreply.github.com>

73 of 92 new or added lines in 9 files covered. (79.35%)

25 existing lines in 5 files now uncovered.

74523 of 83858 relevant lines covered (88.87%)

372906.69 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

24.49
/qiskit/visualization/timeline/interface.py


Source Not Available

STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc