Skip to content

Commit

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

* Construct InstructionDuration subclass

* add reno

* Add Sphinx cross-refs

---------

Co-authored-by: Jake Lishman <jake.lishman@ibm.com>
(cherry picked from commit fbb0938)

Co-authored-by: Diego Ristè <10402430+dieris@users.noreply.github.com>
  • Loading branch information
mergify[bot] and dieris committed Feb 6, 2024
1 parent 9aa4888 commit 32d240f
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 32d240f

Please sign in to comment.