Skip to content

Commit

Permalink
Explicitly handle cirq_ionq.SimulatorResult
Browse files Browse the repository at this point in the history
Let pylint check for `unexpected-keyword-arg`.
  • Loading branch information
pavoljuhas committed Nov 5, 2024
1 parent fdfd682 commit 7a51b3c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions cirq-ionq/cirq_ionq/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,9 +134,11 @@ def run(
).results(sharpen=sharpen)
if isinstance(job_results[0], results.QPUResult):
return job_results[0].to_cirq_result(params=cirq.ParamResolver(param_resolver))
# pylint: disable=unexpected-keyword-arg
return job_results[0].to_cirq_result(params=cirq.ParamResolver(param_resolver), seed=seed)
# pylint: enable=unexpected-keyword-arg
if isinstance(job_results[0], results.SimulatorResult):
return job_results[0].to_cirq_result(
params=cirq.ParamResolver(param_resolver), seed=seed
)
raise NotImplementedError(f"Unrecognized job result type '{type(job_results[0])}'.")

def run_batch(
self,
Expand Down Expand Up @@ -191,12 +193,12 @@ def run_batch(
cirq_results.append(
job_result.to_cirq_result(params=cirq.ParamResolver(param_resolver))
)
else:
# pylint: disable=unexpected-keyword-arg
elif isinstance(job_result, results.SimulatorResult):
cirq_results.append(
job_result.to_cirq_result(params=cirq.ParamResolver(param_resolver), seed=seed)
)
# pylint: enable=unexpected-keyword-arg
else:
raise NotImplementedError(f"Unrecognized job result type '{type(job_result)}'.")
return cirq_results

def sampler(self, target: Optional[str] = None, seed: cirq.RANDOM_STATE_OR_SEED_LIKE = None):
Expand Down

0 comments on commit 7a51b3c

Please sign in to comment.