Skip to content

Commit

Permalink
Use hasattr to check if attribute exists in configuration
Browse files Browse the repository at this point in the history
  • Loading branch information
rathishcholarajan committed Feb 11, 2022
1 parent 513f320 commit 2b81944
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions qiskit_ibm_runtime/ibm_backend.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,19 +173,19 @@ def __init__(
if not self._configuration.simulator:
self.options.set_validator("noise_model", type(None))
self.options.set_validator("seed_simulator", type(None))
if configuration.max_shots:
if hasattr(configuration, "max_shots"):
self.options.set_validator("shots", (1, configuration.max_shots))
if configuration.rep_delay_range:
if hasattr(configuration, "rep_delay_range"):
self.options.set_validator(
"rep_delay",
(configuration.rep_delay_range[0], configuration.rep_delay_range[1]),
)
if configuration.qubit_lo_range:
if hasattr(configuration, "qubit_lo_range"):
self.options.set_validator(
"qubit_lo_freq",
(configuration.qubit_lo_range[0], configuration.qubit_lo_range[1]),
)
if configuration.meas_lo_range:
if hasattr(configuration, "meas_lo_range"):
self.options.set_validator(
"meas_lo_freq",
(configuration.meas_lo_range[0], configuration.meas_lo_range[1]),
Expand Down

0 comments on commit 2b81944

Please sign in to comment.