14
14
"""
15
15
16
16
from abc import ABC , abstractmethod
17
- from typing import Union , Iterable , Optional , Tuple , List
17
+ from typing import Iterable , Optional , Tuple , List
18
18
import copy
19
19
from numbers import Integral
20
- from typing import List , Optional , Iterable , Tuple , Union
21
20
22
21
from qiskit import transpile , assemble , QuantumCircuit
23
22
from qiskit .providers .options import Options
24
23
from qiskit .providers .backend import Backend
25
24
from qiskit .providers .basebackend import BaseBackend as LegacyBackend
26
25
from qiskit .exceptions import QiskitError
27
- from qiskit .providers .backend import Backend
28
- from qiskit .providers .basebackend import BaseBackend as LegacyBackend
29
26
30
27
from .experiment_data import ExperimentData
31
28
@@ -107,9 +104,7 @@ def run(
107
104
experiment_data = self .__experiment_data__ (self , backend = backend )
108
105
109
106
# Generate and transpile circuits
110
- circuits = self ._transpile (
111
- self .circuits (backend ), backend , ** self .transpile_options .__dict__
112
- )
107
+ circuits = transpile (self .circuits (backend ), backend , ** self .transpile_options .__dict__ )
113
108
114
109
# Run circuits on backend
115
110
run_opts = copy .copy (self .run_options )
@@ -172,7 +167,7 @@ def physical_qubits(self) -> Tuple[int]:
172
167
return self ._physical_qubits
173
168
174
169
@classmethod
175
- def analysis (cls , ** kwargs ) -> "BaseAnalysis" :
170
+ def analysis (cls , ** kwargs ):
176
171
"""Return the default Analysis class for the experiment."""
177
172
if cls .__analysis_class__ is None :
178
173
raise QiskitError (f"Experiment { cls .__name__ } does not have a default Analysis class" )
@@ -187,7 +182,7 @@ def circuits(self, backend: Optional[Backend] = None) -> List[QuantumCircuit]:
187
182
backend: Optional, a backend object.
188
183
189
184
Returns:
190
- A list of :class:`QuantumCircuit`s .
185
+ A list of :class:`QuantumCircuit`.
191
186
192
187
.. note::
193
188
These circuits should be on qubits ``[0, .., N-1]`` for an
@@ -198,20 +193,6 @@ def circuits(self, backend: Optional[Backend] = None) -> List[QuantumCircuit]:
198
193
# values for any explicit experiment options that effect circuit
199
194
# generation
200
195
201
- def _transpile (
202
- self ,
203
- circuits : Union [QuantumCircuit , List [QuantumCircuit ]],
204
- backend : Optional [Backend ] = None ,
205
- ** transpile_options ,
206
- ) -> List [QuantumCircuit ]:
207
- """Custom transpilation of circuits for running on backend.
208
-
209
- Subclasses may modify this method if they need to customize how
210
- transpilation is done, for example to update metadata in the
211
- transpiled circuits.
212
- """
213
- return transpile (circuits , backend = backend , ** transpile_options )
214
-
215
196
@classmethod
216
197
def _default_options (cls ) -> Options :
217
198
"""Default kwarg options for experiment"""
0 commit comments