Skip to content

Commit

Permalink
Fix some linter errors
Browse files Browse the repository at this point in the history
  • Loading branch information
chriseclectic committed May 5, 2021
1 parent 21c1a85 commit 83aeec7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 25 deletions.
16 changes: 8 additions & 8 deletions qiskit_experiments/base_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from numbers import Integral
from typing import List, Optional, Iterable, Tuple, Union

from qiskit import transpile, assemble
from qiskit import transpile, assemble, QuantumCircuit
from qiskit.providers.options import Options
from qiskit.providers.backend import Backend
from qiskit.providers.basebackend import BaseBackend as LegacyBackend
Expand Down Expand Up @@ -85,7 +85,7 @@ def __init__(self, qubits: Iterable[int], experiment_type: Optional[str] = None,

def run(
self,
backend: "Backend",
backend: Backend,
analysis: bool = True,
experiment_data: Optional[ExperimentData] = None,
**kwargs,
Expand Down Expand Up @@ -153,14 +153,14 @@ def analysis(cls, **analysis_options) -> "BaseAnalysis":
return cls.__analysis_class__(**analysis_options)

@abstractmethod
def circuits(self, backend=None) -> List["QuantumCircuit"]:
def circuits(self, backend: Optional[Backend] = None) -> List[QuantumCircuit]:
"""Return a list of experiment circuits.
Args:
backend (Backend): Optional, a backend object.
backend: Optional, a backend object.
Returns:
List[QuantumCircuit]: A list of :class:`QuantumCircuit`s.
A list of :class:`QuantumCircuit`s.
.. note:
These circuits should be on qubits ``[0, .., N-1]`` for an
Expand All @@ -173,10 +173,10 @@ def circuits(self, backend=None) -> List["QuantumCircuit"]:

def _transpile(
self,
circuits: Union["QuantumCircuit", List["QuantumCircuit"]],
backend: Optional["Backend"] = None,
circuits: Union[QuantumCircuit, List[QuantumCircuit]],
backend: Optional[Backend] = None,
**transpile_options,
) -> List["QuantumCircuit"]:
) -> List[QuantumCircuit]:
"""Custom transpilation of circuits for running on backend.
Subclasses may modify this method if they need to customize how
Expand Down
2 changes: 2 additions & 0 deletions qiskit_experiments/randomized_benchmarking/rb_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
from typing import Optional, List

import numpy as np

from qiskit.providers.options import Options
from qiskit_experiments.base_analysis import BaseAnalysis
from qiskit_experiments.analysis.curve_fitting import curve_fit
from qiskit_experiments.analysis.data_processing import (
Expand Down
17 changes: 0 additions & 17 deletions qiskit_experiments/randomized_benchmarking/rb_experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,23 +74,6 @@ def circuits(self, backend=None):
circuits += self._sample_circuits(self._lengths, seed=self._rng)
return circuits

def transpiled_circuits(self, backend=None, **kwargs):
"""Return a list of transpiled RB circuits.
Args:
backend (Backend): Optional, a backend object to use as the
argument for the :func:`qiskit.transpile`
function.
kwargs: kwarg options for the :func:`qiskit.transpile` function.
Returns:
List[QuantumCircuit]: A list of :class:`QuantumCircuit`s.
Raises:
QiskitError: if an initial layout is specified in the
kwarg options for transpilation. The initial
layout must be generated from the experiment.
"""
circuits = super().transpiled_circuits(backend=backend, **kwargs)
return circuits

def _sample_circuits(
self, lengths: Iterable[int], seed: Optional[Union[int, Generator]] = None
):
Expand Down

0 comments on commit 83aeec7

Please sign in to comment.