Skip to content

Commit

Permalink
Move make_generic_backend to provider.utils.
Browse files Browse the repository at this point in the history
The reason for this is that it isn't actually part of the
fake backend _provider_. And also, fake backends are likely
going away in Qiskit.
  • Loading branch information
kevinhartman committed Jan 26, 2024
1 parent 754f1bc commit 761a272
Show file tree
Hide file tree
Showing 8 changed files with 42 additions and 7 deletions.
2 changes: 0 additions & 2 deletions qiskit/providers/fake_provider/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@
FakeBackendV2
FakeBackend5QV2
FakeMumbaiFractionalCX
make_generic_backend
Fake Backend Base Classes
=========================
Expand Down Expand Up @@ -249,4 +248,3 @@
from .fake_1q import Fake1Q
from .fake_backend_v2 import FakeBackendV2, FakeBackend5QV2
from .fake_mumbai_v2 import FakeMumbaiFractionalCX
from .fake_generic import make_generic_backend
File renamed without changes.
23 changes: 23 additions & 0 deletions qiskit/providers/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2024.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""
==============================================
Provider Utils (:mod:`qiskit.providers.utils`)
==============================================
.. currentmodule:: qiskit.providers.utils
.. autofunction:: make_generic_backend
"""

from .generic_backend import make_generic_backend
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@
import numpy as np
from numpy.random import Generator

from .simulator_backend import _SimulatorBackend

from qiskit.pulse.instruction_schedule_map import InstructionScheduleMap
from qiskit.circuit import Instruction
Expand All @@ -37,6 +36,7 @@
PulseDefaults,
Command,
)
from qiskit.providers.simulator_backend import _SimulatorBackend
from qiskit.qobj import PulseQobjInstruction, PulseLibraryItem

# Noise default values/ranges for duration and error of supported
Expand Down
2 changes: 1 addition & 1 deletion test/python/compiler/test_transpiler.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,12 +71,12 @@
from qiskit.dagcircuit import DAGOpNode, DAGOutNode
from qiskit.exceptions import QiskitError
from qiskit.providers.backend import BackendV2
from qiskit.providers.fake_provider import make_generic_backend
from qiskit.providers.fake_provider import (
FakeMelbourne,
FakeRueschlikon,
FakeVigo,
)
from qiskit.providers.utils import make_generic_backend
from qiskit.providers.options import Options
from qiskit.pulse import InstructionScheduleMap
from qiskit.quantum_info import Operator, random_unitary
Expand Down
13 changes: 13 additions & 0 deletions test/python/providers/utils/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
# This code is part of Qiskit.
#
# (C) Copyright IBM 2022.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any modifications or derivative works of this code must retain this
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""Qiskit Provider utils tests."""
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@
# copyright notice, and modified files need to carry a notice indicating
# that they have been altered from the originals.

"""Tests for fake_generic.py"""
"""Tests for generic backend construction."""

import math

from qiskit import ClassicalRegister, QuantumCircuit, QuantumRegister
from qiskit import transpile
from qiskit.providers.fake_provider import make_generic_backend
from qiskit.providers.utils import make_generic_backend
from qiskit.transpiler import CouplingMap
from qiskit.exceptions import QiskitError
from qiskit.test import QiskitTestCase
Expand Down
3 changes: 2 additions & 1 deletion test/python/pulse/test_macros.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
)
from qiskit.pulse import macros
from qiskit.pulse.exceptions import PulseError
from qiskit.providers.fake_provider import FakeOpenPulse2Q, FakeHanoi, make_generic_backend
from qiskit.providers.fake_provider import FakeOpenPulse2Q, FakeHanoi
from qiskit.providers.utils import make_generic_backend
from qiskit.test import QiskitTestCase


Expand Down

0 comments on commit 761a272

Please sign in to comment.