Skip to content

Commit

Permalink
Construct subclasses of InstructionDurations from backend (Qiskit#1…
Browse files Browse the repository at this point in the history
…1501)

* Construct InstructionDuration subclass

* add reno

* Add Sphinx cross-refs

---------

Co-authored-by: Jake Lishman <[email protected]>
  • Loading branch information
2 people authored and ShellyGarion committed Jan 18, 2024
1 parent b420bd1 commit 5eb6c2a
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 1 addition & 1 deletion qiskit/transpiler/instruction_durations.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def from_backend(cls, backend: Backend):
except AttributeError:
dt = None

return InstructionDurations(instruction_durations, dt=dt)
return cls(instruction_durations, dt=dt)

def update(self, inst_durations: "InstructionDurationsType" | None, dt: float = None):
"""Update self with inst_durations (inst_durations overwrite self).
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
fixes:
- |
:meth:`.InstructionDurations.from_backend` now returns an instance of any subclass
of :class:`.InstructionDurations` instead of the base class.

0 comments on commit 5eb6c2a

Please sign in to comment.