Skip to content

Commit

Permalink
Fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
y4izus committed Jul 10, 2024
1 parent 3a8f71a commit 1b55b88
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
4 changes: 2 additions & 2 deletions ai-transpiler-demo.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -212,7 +212,7 @@
"\n",
"qiskit_lvl3_transpiler_service = TranspilerService(\n",
" backend_name=\"ibm_torino\",\n",
" ai='false',\n",
" ai=\"false\",\n",
" optimization_level=3,\n",
")"
]
Expand Down Expand Up @@ -281,7 +281,7 @@
"source": [
"qiskit_lvl3_ai_transpiler_service = TranspilerService(\n",
" backend_name=\"ibm_torino\",\n",
" ai='true',\n",
" ai=\"true\",\n",
" optimization_level=3,\n",
")"
]
Expand Down
4 changes: 2 additions & 2 deletions documentation-examples.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"\n",
"cloud_transpiler_service = TranspilerService(\n",
" backend_name=\"ibm_sherbrooke\",\n",
" ai='false',\n",
" ai=\"false\",\n",
" optimization_level=3,\n",
")\n",
"transpiled_circuit_no_ai = cloud_transpiler_service.run(circuit)"
Expand Down Expand Up @@ -50,7 +50,7 @@
"\n",
"cloud_transpiler_service = TranspilerService(\n",
" backend_name=\"ibm_sherbrooke\",\n",
" ai='true',\n",
" ai=\"true\",\n",
" optimization_level=1,\n",
")\n",
"transpiled_circuit_ai = cloud_transpiler_service.run(circuit)"
Expand Down
2 changes: 1 addition & 1 deletion qiskit_transpiler_service/transpiler_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ class TranspilerService:
def __init__(
self,
optimization_level: int,
ai: Literal['true', 'false', 'auto'] = 'true',
ai: Literal["true", "false", "auto"] = "true",
coupling_map: Union[List[List[int]], None] = None,
backend_name: Union[str, None] = None,
qiskit_transpile_options: Dict = None,
Expand Down
4 changes: 2 additions & 2 deletions qiskit_transpiler_service/wrappers/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,8 @@ def _get_error_msg_from_response(exc: requests.exceptions.HTTPError):
if isinstance(detail, str):
msg = detail
elif isinstance(detail, list):
detail_input = detail[0]['input']
detail_msg = detail[0]['msg']
detail_input = detail[0]["input"]
detail_msg = detail[0]["msg"]

if detail_input and detail_msg:
msg = f"Wrong input '{detail_input}'. {detail_msg}"
Expand Down
2 changes: 1 addition & 1 deletion qiskit_transpiler_service/wrappers/transpile.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def transpile(
optimization_level: int = 1,
backend: Union[str, None] = None,
coupling_map: Union[List[List[int]], None] = None,
ai: Literal['true', 'false', 'auto'] = 'true',
ai: Literal["true", "false", "auto"] = "true",
qiskit_transpile_options: Dict = None,
ai_layout_mode: str = None,
):
Expand Down
12 changes: 6 additions & 6 deletions tests/test_transpiler_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
@pytest.mark.parametrize(
"optimization_level", [1, 2, 3], ids=["opt_level_1", "opt_level_2", "opt_level_3"]
)
@pytest.mark.parametrize("ai", ['false', 'true'], ids=["no_ai", "ai"])
@pytest.mark.parametrize("ai", ["false", "true"], ids=["no_ai", "ai"])
@pytest.mark.parametrize(
"qiskit_transpile_options",
[None, {"seed_transpiler": 0}],
Expand All @@ -56,7 +56,7 @@ def test_rand_circ_backend_routing(optimization_level, ai, qiskit_transpile_opti
@pytest.mark.parametrize(
"optimization_level", [1, 2, 3], ids=["opt_level_1", "opt_level_2", "opt_level_3"]
)
@pytest.mark.parametrize("ai", ['false', 'true'], ids=["no_ai", "ai"])
@pytest.mark.parametrize("ai", ["false", "true"], ids=["no_ai", "ai"])
@pytest.mark.parametrize(
"qiskit_transpile_options",
[None, {"seed_transpiler": 0}],
Expand Down Expand Up @@ -85,7 +85,7 @@ def test_qv_backend_routing(optimization_level, ai, qiskit_transpile_options):
],
)
@pytest.mark.parametrize("optimization_level", [1, 2, 3])
@pytest.mark.parametrize("ai", ['false', 'true'], ids=["no_ai", "ai"])
@pytest.mark.parametrize("ai", ["false", "true"], ids=["no_ai", "ai"])
@pytest.mark.parametrize("qiskit_transpile_options", [None, {"seed_transpiler": 0}])
def test_rand_circ_cmap_routing(
coupling_map, optimization_level, ai, qiskit_transpile_options
Expand All @@ -108,7 +108,7 @@ def test_qv_circ_several_circuits_routing():

cloud_transpiler_service = TranspilerService(
backend_name="ibm_brisbane",
ai='true',
ai="true",
optimization_level=1,
)
transpiled_circuit = cloud_transpiler_service.run([qv_circ] * 2)
Expand All @@ -129,7 +129,7 @@ def test_qv_circ_wrong_input_routing():

cloud_transpiler_service = TranspilerService(
backend_name="ibm_brisbane",
ai='true',
ai="true",
optimization_level=1,
)

Expand All @@ -138,7 +138,7 @@ def test_qv_circ_wrong_input_routing():
cloud_transpiler_service.run(circ_dict)


@pytest.mark.parametrize("ai", ['false', 'true'], ids=["no_ai", "ai"])
@pytest.mark.parametrize("ai", ["false", "true"], ids=["no_ai", "ai"])
def test_transpile_layout_reconstruction(ai):
n_qubits = 27

Expand Down

0 comments on commit 1b55b88

Please sign in to comment.