Skip to content

Commit

Permalink
Construct subclasses of InstructionDurations from backend (#11501)
Browse files Browse the repository at this point in the history
* Construct InstructionDuration subclass

* add reno

* Add Sphinx cross-refs

---------

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
  • Loading branch information
dieris and jakelishman authored Jan 6, 2024
1 parent 5b46c3e commit fbb0938
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 fbb0938

Please sign in to comment.