Skip to content

Commit 23595bf

Browse files
authored
Deprecate num_shots parameter (#688)
The num_shots parameter was replaced with shots parameter in Jan 2024. Removing the deprecation message and support for num_shots.
1 parent b5fd0ad commit 23595bf

13 files changed

+21
-2944
lines changed

azure-quantum/azure/quantum/cirq/targets/ionq.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -146,7 +146,7 @@ def submit(
146146
azure_job = super().submit(
147147
circuit=serialized_program.body,
148148
name=name,
149-
num_shots=repetitions,
149+
shots=repetitions,
150150
metadata=metadata,
151151
**kwargs
152152
)

azure-quantum/azure/quantum/cirq/targets/quantinuum.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ def submit(
105105
azure_job = super().submit(
106106
circuit=serialized_program,
107107
name=name,
108-
num_shots=repetitions,
108+
shots=repetitions,
109109
metadata=metadata,
110110
**kwargs
111111
)

azure-quantum/azure/quantum/target/ionq.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
from typing import Any, Dict, List
66
from warnings import warn
77

8-
from azure.quantum.target.target import (
9-
Target,
10-
_determine_shots_or_deprecated_num_shots,
11-
)
128
from azure.quantum.job.job import Job
9+
from azure.quantum.target.target import Target
1310
from azure.quantum.workspace import Workspace
14-
from azure.quantum._client.models import CostEstimate, UsageEvent
1511
from typing import Union
1612

1713

@@ -91,13 +87,6 @@ def submit(
9187
)
9288
if input_params is None:
9389
input_params = {}
94-
95-
num_shots = kwargs.pop("num_shots", None)
96-
97-
shots = _determine_shots_or_deprecated_num_shots(
98-
shots=shots,
99-
num_shots=num_shots,
100-
)
10190

10291
return super().submit(
10392
input_data=input_data,

azure-quantum/azure/quantum/target/quantinuum.py

Lines changed: 1 addition & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,9 @@
55
from typing import Any, Dict, Union
66
from warnings import warn
77

8-
from azure.quantum.target.target import (
9-
Target,
10-
_determine_shots_or_deprecated_num_shots,
11-
)
128
from azure.quantum.job.job import Job
9+
from azure.quantum.target.target import Target
1310
from azure.quantum.workspace import Workspace
14-
from azure.quantum._client.models import CostEstimate, UsageEvent
1511

1612

1713
class Quantinuum(Target):
@@ -86,13 +82,6 @@ def submit(
8682
if input_params is None:
8783
input_params = {}
8884

89-
num_shots = kwargs.pop("num_shots", None)
90-
91-
shots = _determine_shots_or_deprecated_num_shots(
92-
shots=shots,
93-
num_shots=num_shots,
94-
)
95-
9685
return super().submit(
9786
input_data=input_data,
9887
name=name,

azure-quantum/azure/quantum/target/target.py

Lines changed: 0 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -390,33 +390,3 @@ def _calculate_qir_module_gate_stats(self, qir_module) -> GateStats:
390390
multi_qubit_gates,
391391
measurement_gates
392392
)
393-
394-
395-
def _determine_shots_or_deprecated_num_shots(
396-
shots: int = None,
397-
num_shots: int = None,
398-
) -> int:
399-
"""
400-
This helper function checks if the deprecated 'num_shots' parameter is specified.
401-
In earlier versions it was possible to pass this parameter to specify shots number for a job,
402-
but now we only check for it for compatibility reasons.
403-
"""
404-
final_shots = None
405-
if shots is not None and num_shots is not None:
406-
warnings.warn(
407-
"Both 'shots' and 'num_shots' parameters were specified. Defaulting to 'shots' parameter. "
408-
"Please, use 'shots' since 'num_shots' will be deprecated.",
409-
category=DeprecationWarning,
410-
)
411-
final_shots = shots
412-
413-
elif shots is not None:
414-
final_shots = shots
415-
elif num_shots is not None:
416-
warnings.warn(
417-
"The 'num_shots' parameter will be deprecated. Please, use 'shots' parameter instead.",
418-
category=DeprecationWarning,
419-
)
420-
final_shots = num_shots
421-
422-
return final_shots

0 commit comments

Comments
 (0)