Skip to content

Commit

Permalink
lint
Browse files Browse the repository at this point in the history
  • Loading branch information
doichanj committed Aug 14, 2024
1 parent 76fe2dc commit 7419131
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 35 deletions.
62 changes: 29 additions & 33 deletions qiskit_aer/backends/aerbackend.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,39 +406,35 @@ def _get_value(prop_dict, prop_name):
in_data["qubit_properties"] = qubit_properties

for name in all_instructions:
try:
for qubits, params in properties.gate_property(name).items():
if set.intersection(
faulty_qubits, qubits
) or not properties.is_gate_operational(name, qubits):
try:
# Qubits might be pre-defined by the gate config
# However properties objects says the qubits is non-operational
del prop_name_map[name][qubits]
except KeyError:
pass
faulty_ops.add((name, qubits))
continue
if prop_name_map[name] is None:
prop_name_map[name] = {}
prop_name_map[name][qubits] = InstructionProperties(
error=_get_value(params, "gate_error"),
duration=_get_value(params, "gate_length"),
)
if isinstance(prop_name_map[name], dict) and any(
v is None for v in prop_name_map[name].values()
):
# Properties provides gate properties only for subset of qubits
# Associated qubit set might be defined by the gate config here
logger.info(
"Gate properties of instruction %s are not provided for every qubits. "
"This gate is ideal for some qubits and the rest is with finite error. "
"Created backend target may confuse error-aware circuit optimization.",
name,
)
except BackendPropertyError:
# This gate doesn't report any property
continue
for qubits, params in properties.gate_property(name).items():
if set.intersection(
faulty_qubits, qubits
) or not properties.is_gate_operational(name, qubits):
try:
# Qubits might be pre-defined by the gate config
# However properties objects says the qubits is non-operational
del prop_name_map[name][qubits]
except KeyError:
pass
faulty_ops.add((name, qubits))
continue
if prop_name_map[name] is None:
prop_name_map[name] = {}
prop_name_map[name][qubits] = InstructionProperties(
error=_get_value(params, "gate_error"),
duration=_get_value(params, "gate_length"),
)
if isinstance(prop_name_map[name], dict) and any(
v is None for v in prop_name_map[name].values()
):
# Properties provides gate properties only for subset of qubits
# Associated qubit set might be defined by the gate config here
logger.info(
"Gate properties of instruction %s are not provided for every qubits. "
"This gate is ideal for some qubits and the rest is with finite error. "
"Created backend target may confuse error-aware circuit optimization.",
name,
)

# Measure instruction property is stored in qubit property
prop_name_map["measure"] = {}
Expand Down
1 change: 0 additions & 1 deletion qiskit_aer/backends/backendconfiguration.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,6 @@ def __init__(
dt=None,
dtm=None,
processor_type=None,
parametric_pulses=None,
**kwargs,
):
"""Initialize a AerBackendConfiguration Object
Expand Down
2 changes: 1 addition & 1 deletion qiskit_aer/backends/backendproperties.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
import copy
import datetime
import warnings
import dateutil.parser
from typing import Any, Iterable, Tuple, Union, Dict
import dateutil.parser
from qiskit.providers.exceptions import BackendPropertyError
from qiskit.utils.units import apply_prefix
from qiskit.transpiler.target import Target
Expand Down

0 comments on commit 7419131

Please sign in to comment.