Skip to content

Commit

Permalink
type hint fixes for QiskitExecutor
Browse files Browse the repository at this point in the history
  • Loading branch information
araghukas committed Sep 12, 2023
1 parent 67c497b commit 8d5d509
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

import asyncio
import time
from typing import Sequence, Union
from typing import Optional, Sequence, Union

import pennylane as qml
from local_sampler import QiskitLocalSampler
Expand Down Expand Up @@ -190,14 +190,14 @@ class QiskitExecutor(AsyncBaseQExecutor):
single_job: bool = False
local_transpile: bool = False

max_time: Union[int, str] = None
max_time: Optional[Union[int, str]] = None

ibmqx_url: str = None
ibmqx_url: Optional[str] = None
channel: str = "ibm_quantum"
instance: str = ""
cloud_instance: str = ""

options: dict = Field(
options: Optional[Union[dict, tuple]] = Field(
# pylint: disable=unnecessary-lambda
default_factory=lambda: get_config("qelectron")["QiskitExecutor"]["options"]
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def extract_options(opts: dict) -> Options:
"""
Construct a Qiskit `Options` object from the options dictionary
"""
if isinstance(opts, tuple):
opts = dict(opts)

_options = Options()
_options.optimization_level = opts.get("optimization_level", 3)
_options.resilience_level = opts.get("resilience_level", 1)
Expand Down

0 comments on commit 8d5d509

Please sign in to comment.