classiq 0.52.0__py3-none-any.whl → 0.54.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (303) hide show
  1. classiq/__init__.py +1 -3
  2. classiq/_analyzer_extras/_ipywidgets_async_extension.py +2 -1
  3. classiq/_internals/__init__.py +0 -20
  4. classiq/_internals/api_wrapper.py +23 -17
  5. classiq/_internals/async_utils.py +1 -3
  6. classiq/_internals/authentication/auth0.py +5 -5
  7. classiq/_internals/authentication/device.py +5 -4
  8. classiq/_internals/authentication/password_manager.py +3 -3
  9. classiq/_internals/authentication/token_manager.py +3 -2
  10. classiq/_internals/client.py +11 -13
  11. classiq/_internals/config.py +2 -2
  12. classiq/_internals/jobs.py +7 -6
  13. classiq/_internals/type_validation.py +9 -9
  14. classiq/analyzer/__init__.py +1 -3
  15. classiq/analyzer/analyzer.py +8 -7
  16. classiq/analyzer/analyzer_utilities.py +8 -8
  17. classiq/analyzer/rb.py +11 -11
  18. classiq/applications/__init__.py +1 -3
  19. classiq/applications/chemistry/__init__.py +1 -3
  20. classiq/applications/chemistry/ansatz_parameters.py +4 -4
  21. classiq/applications/chemistry/chemistry_model_constructor.py +10 -9
  22. classiq/applications/combinatorial_helpers/combinatorial_problem_utils.py +26 -9
  23. classiq/applications/combinatorial_helpers/encoding_mapping.py +10 -10
  24. classiq/applications/combinatorial_helpers/encoding_utils.py +4 -4
  25. classiq/applications/combinatorial_helpers/memory.py +5 -7
  26. classiq/applications/combinatorial_helpers/optimization_model.py +43 -24
  27. classiq/applications/combinatorial_helpers/pauli_helpers/pauli_utils.py +4 -6
  28. classiq/applications/combinatorial_helpers/pyomo_utils.py +95 -24
  29. classiq/applications/combinatorial_helpers/sympy_utils.py +2 -2
  30. classiq/applications/combinatorial_helpers/transformations/encoding.py +8 -8
  31. classiq/applications/combinatorial_helpers/transformations/fixed_variables.py +5 -5
  32. classiq/applications/combinatorial_helpers/transformations/ising_converter.py +7 -9
  33. classiq/applications/combinatorial_helpers/transformations/penalty.py +1 -2
  34. classiq/applications/combinatorial_helpers/transformations/sign_seperation.py +1 -2
  35. classiq/applications/combinatorial_helpers/transformations/slack_variables.py +1 -2
  36. classiq/applications/combinatorial_optimization/__init__.py +1 -3
  37. classiq/applications/combinatorial_optimization/combinatorial_optimization_config.py +2 -2
  38. classiq/applications/combinatorial_optimization/examples/__init__.py +1 -3
  39. classiq/applications/finance/__init__.py +1 -3
  40. classiq/applications/grover/__init__.py +1 -3
  41. classiq/applications/grover/grover_model_constructor.py +7 -9
  42. classiq/applications/hamiltonian/pauli_decomposition.py +6 -6
  43. classiq/applications/qnn/__init__.py +1 -3
  44. classiq/applications/qnn/circuit_utils.py +5 -5
  45. classiq/applications/qnn/datasets/__init__.py +1 -3
  46. classiq/applications/qnn/datasets/dataset_base_classes.py +5 -4
  47. classiq/applications/qnn/datasets/dataset_parity.py +2 -2
  48. classiq/applications/qnn/gradients/simple_quantum_gradient.py +2 -1
  49. classiq/applications/qnn/qlayer.py +25 -6
  50. classiq/applications/qnn/torch_utils.py +2 -2
  51. classiq/applications/qnn/types.py +5 -5
  52. classiq/applications/qsvm/qsvm.py +1 -3
  53. classiq/applications/qsvm/qsvm_data_generation.py +3 -3
  54. classiq/applications/qsvm/qsvm_model_constructor.py +5 -5
  55. classiq/execution/__init__.py +3 -3
  56. classiq/execution/all_hardware_devices.py +1 -3
  57. classiq/execution/execution_session.py +57 -16
  58. classiq/execution/iqcc.py +1 -1
  59. classiq/execution/jobs.py +4 -4
  60. classiq/execution/qaoa.py +84 -0
  61. classiq/execution/qnn.py +3 -3
  62. classiq/executor.py +4 -4
  63. classiq/interface/_version.py +1 -1
  64. classiq/interface/analyzer/analysis_params.py +9 -10
  65. classiq/interface/analyzer/cytoscape_graph.py +5 -5
  66. classiq/interface/analyzer/result.py +17 -17
  67. classiq/interface/applications/qsvm.py +6 -10
  68. classiq/interface/backend/backend_preferences.py +4 -3
  69. classiq/interface/backend/ionq/ionq_quantum_program.py +4 -5
  70. classiq/interface/backend/pydantic_backend.py +1 -2
  71. classiq/interface/chemistry/fermionic_operator.py +5 -5
  72. classiq/interface/chemistry/ground_state_problem.py +7 -8
  73. classiq/interface/chemistry/molecule.py +4 -4
  74. classiq/interface/chemistry/operator.py +11 -13
  75. classiq/interface/combinatorial_optimization/examples/ascending_sequence.py +1 -3
  76. classiq/interface/combinatorial_optimization/examples/integer_portfolio_optimization.py +2 -4
  77. classiq/interface/combinatorial_optimization/examples/knapsack.py +3 -3
  78. classiq/interface/combinatorial_optimization/examples/mht.py +2 -3
  79. classiq/interface/combinatorial_optimization/examples/portfolio_variations.py +2 -2
  80. classiq/interface/combinatorial_optimization/examples/set_cover.py +1 -2
  81. classiq/interface/combinatorial_optimization/mht_qaoa_input.py +5 -7
  82. classiq/interface/combinatorial_optimization/optimization_problem.py +2 -2
  83. classiq/interface/combinatorial_optimization/result.py +1 -3
  84. classiq/interface/debug_info/debug_info.py +8 -7
  85. classiq/interface/exceptions.py +11 -7
  86. classiq/interface/execution/iqcc.py +1 -3
  87. classiq/interface/execution/jobs.py +2 -2
  88. classiq/interface/execution/primitives.py +3 -3
  89. classiq/interface/executor/aws_execution_cost.py +4 -4
  90. classiq/interface/executor/execution_request.py +2 -3
  91. classiq/interface/executor/execution_result.py +3 -3
  92. classiq/interface/executor/iqae_result.py +3 -5
  93. classiq/interface/executor/optimizer_preferences.py +2 -2
  94. classiq/interface/executor/quantum_code.py +6 -6
  95. classiq/interface/executor/register_initialization.py +2 -4
  96. classiq/interface/executor/result.py +35 -28
  97. classiq/interface/executor/vqe_result.py +8 -8
  98. classiq/interface/finance/function_input.py +2 -2
  99. classiq/interface/finance/gaussian_model_input.py +5 -5
  100. classiq/interface/finance/log_normal_model_input.py +2 -2
  101. classiq/interface/finance/model_input.py +1 -2
  102. classiq/interface/generator/adjacency.py +1 -3
  103. classiq/interface/generator/ansatz_library.py +4 -4
  104. classiq/interface/generator/application_apis/finance_declarations.py +1 -1
  105. classiq/interface/generator/arith/argument_utils.py +3 -3
  106. classiq/interface/generator/arith/arithmetic.py +7 -7
  107. classiq/interface/generator/arith/arithmetic_arg_type_validator.py +5 -5
  108. classiq/interface/generator/arith/arithmetic_expression_abc.py +11 -11
  109. classiq/interface/generator/arith/arithmetic_expression_parser.py +8 -7
  110. classiq/interface/generator/arith/arithmetic_expression_validator.py +8 -8
  111. classiq/interface/generator/arith/arithmetic_operations.py +4 -3
  112. classiq/interface/generator/arith/arithmetic_param_getters.py +6 -6
  113. classiq/interface/generator/arith/arithmetic_result_builder.py +9 -9
  114. classiq/interface/generator/arith/ast_node_rewrite.py +2 -1
  115. classiq/interface/generator/arith/binary_ops.py +10 -13
  116. classiq/interface/generator/arith/extremum_operations.py +3 -2
  117. classiq/interface/generator/arith/logical_ops.py +7 -6
  118. classiq/interface/generator/arith/number_utils.py +4 -4
  119. classiq/interface/generator/arith/register_user_input.py +4 -4
  120. classiq/interface/generator/arith/unary_ops.py +2 -1
  121. classiq/interface/generator/builtin_api_builder.py +2 -1
  122. classiq/interface/generator/circuit_code/circuit_code.py +4 -4
  123. classiq/interface/generator/circuit_code/types_and_constants.py +3 -5
  124. classiq/interface/generator/complex_type.py +1 -2
  125. classiq/interface/generator/control_state.py +2 -2
  126. classiq/interface/generator/custom_ansatz.py +1 -3
  127. classiq/interface/generator/distance.py +3 -5
  128. classiq/interface/generator/excitations.py +3 -2
  129. classiq/interface/generator/expressions/enums/finance_functions.py +1 -3
  130. classiq/interface/generator/expressions/evaluated_expression.py +4 -3
  131. classiq/interface/generator/expressions/expression.py +4 -5
  132. classiq/interface/generator/expressions/expression_constants.py +4 -4
  133. classiq/interface/generator/expressions/qmod_qarray_proxy.py +2 -1
  134. classiq/interface/generator/expressions/qmod_qscalar_proxy.py +2 -1
  135. classiq/interface/generator/expressions/qmod_qstruct_proxy.py +2 -1
  136. classiq/interface/generator/expressions/qmod_sized_proxy.py +2 -1
  137. classiq/interface/generator/expressions/qmod_struct_instance.py +2 -1
  138. classiq/interface/generator/expressions/sympy_supported_expressions.py +11 -13
  139. classiq/interface/generator/finance.py +2 -2
  140. classiq/interface/generator/function_param_library.py +6 -6
  141. classiq/interface/generator/function_params.py +13 -19
  142. classiq/interface/generator/functions/classical_function_declaration.py +4 -3
  143. classiq/interface/generator/functions/classical_type.py +13 -13
  144. classiq/interface/generator/functions/concrete_types.py +1 -2
  145. classiq/interface/generator/functions/function_declaration.py +1 -1
  146. classiq/interface/generator/functions/qmod_python_interface.py +2 -1
  147. classiq/interface/generator/functions/type_name.py +3 -2
  148. classiq/interface/generator/generated_circuit_data.py +34 -22
  149. classiq/interface/generator/grover_diffuser.py +7 -7
  150. classiq/interface/generator/grover_operator.py +2 -2
  151. classiq/interface/generator/hardware/hardware_data.py +7 -6
  152. classiq/interface/generator/hardware_efficient_ansatz.py +8 -8
  153. classiq/interface/generator/identity.py +5 -6
  154. classiq/interface/generator/linear_pauli_rotations.py +6 -6
  155. classiq/interface/generator/mcu.py +2 -2
  156. classiq/interface/generator/mcx.py +6 -6
  157. classiq/interface/generator/model/__init__.py +1 -3
  158. classiq/interface/generator/model/constraints.py +2 -2
  159. classiq/interface/generator/model/model.py +5 -6
  160. classiq/interface/generator/model/preferences/preferences.py +7 -6
  161. classiq/interface/generator/model/quantum_register.py +6 -11
  162. classiq/interface/generator/oracles/arithmetic_oracle.py +1 -2
  163. classiq/interface/generator/oracles/custom_oracle.py +2 -2
  164. classiq/interface/generator/oracles/oracle_abc.py +6 -5
  165. classiq/interface/generator/partitioned_register.py +6 -5
  166. classiq/interface/generator/piecewise_linear_amplitude_loading.py +8 -7
  167. classiq/interface/generator/qpe.py +4 -4
  168. classiq/interface/generator/qsvm.py +3 -3
  169. classiq/interface/generator/quantum_function_call.py +24 -29
  170. classiq/interface/generator/quantum_program.py +9 -9
  171. classiq/interface/generator/register_role.py +2 -4
  172. classiq/interface/generator/slice_parsing_utils.py +4 -3
  173. classiq/interface/generator/standard_gates/standard_gates.py +3 -3
  174. classiq/interface/generator/state_preparation/bell_state_preparation.py +3 -3
  175. classiq/interface/generator/state_preparation/distributions.py +6 -5
  176. classiq/interface/generator/state_preparation/metrics.py +2 -4
  177. classiq/interface/generator/state_preparation/state_preparation.py +4 -4
  178. classiq/interface/generator/synthesis_metadata/synthesis_execution_data.py +3 -3
  179. classiq/interface/generator/transpiler_basis_gates.py +2 -2
  180. classiq/interface/generator/types/enum_declaration.py +2 -3
  181. classiq/interface/generator/types/qstruct_declaration.py +2 -1
  182. classiq/interface/generator/types/struct_declaration.py +3 -2
  183. classiq/interface/generator/ucc.py +2 -1
  184. classiq/interface/generator/unitary_gate.py +2 -2
  185. classiq/interface/generator/user_defined_function_params.py +1 -1
  186. classiq/interface/generator/validations/flow_graph.py +6 -5
  187. classiq/interface/generator/validations/validator_functions.py +3 -2
  188. classiq/interface/generator/visitor.py +9 -14
  189. classiq/interface/hardware.py +5 -6
  190. classiq/interface/helpers/custom_encoders.py +2 -2
  191. classiq/interface/helpers/custom_pydantic_types.py +8 -9
  192. classiq/interface/helpers/dotdict.py +18 -0
  193. classiq/interface/helpers/hashable_mixin.py +3 -2
  194. classiq/interface/helpers/hashable_pydantic_base_model.py +2 -1
  195. classiq/interface/helpers/pydantic_model_helpers.py +4 -3
  196. classiq/interface/helpers/validation_helpers.py +2 -2
  197. classiq/interface/ide/ide_data.py +11 -15
  198. classiq/interface/ide/visual_model.py +33 -22
  199. classiq/interface/jobs.py +2 -2
  200. classiq/interface/model/bind_operation.py +5 -4
  201. classiq/interface/model/classical_parameter_declaration.py +2 -2
  202. classiq/interface/model/handle_binding.py +3 -2
  203. classiq/interface/model/inplace_binary_operation.py +2 -1
  204. classiq/interface/model/model.py +12 -11
  205. classiq/interface/model/native_function_definition.py +10 -0
  206. classiq/interface/model/port_declaration.py +2 -2
  207. classiq/interface/model/quantum_expressions/amplitude_loading_operation.py +3 -2
  208. classiq/interface/model/quantum_expressions/arithmetic_operation.py +3 -2
  209. classiq/interface/model/quantum_expressions/quantum_expression.py +8 -7
  210. classiq/interface/model/quantum_function_call.py +9 -14
  211. classiq/interface/model/quantum_function_declaration.py +10 -12
  212. classiq/interface/model/quantum_lambda_function.py +3 -16
  213. classiq/interface/model/quantum_statement.py +4 -3
  214. classiq/interface/model/quantum_type.py +5 -5
  215. classiq/interface/model/statement_block.py +2 -3
  216. classiq/interface/model/validation_handle.py +5 -4
  217. classiq/interface/server/global_versions.py +3 -3
  218. classiq/model_expansions/atomic_expression_functions_defs.py +3 -2
  219. classiq/model_expansions/call_to_model_converter.py +190 -0
  220. classiq/model_expansions/capturing/captured_var_manager.py +4 -6
  221. classiq/model_expansions/capturing/propagated_var_stack.py +7 -7
  222. classiq/model_expansions/closure.py +17 -9
  223. classiq/model_expansions/evaluators/arg_type_match.py +3 -2
  224. classiq/model_expansions/evaluators/argument_types.py +3 -3
  225. classiq/model_expansions/evaluators/control.py +3 -3
  226. classiq/model_expansions/evaluators/parameter_types.py +7 -7
  227. classiq/model_expansions/evaluators/quantum_type_utils.py +2 -1
  228. classiq/model_expansions/evaluators/type_type_match.py +1 -1
  229. classiq/model_expansions/expression_evaluator.py +10 -9
  230. classiq/model_expansions/expression_renamer.py +6 -6
  231. classiq/model_expansions/function_builder.py +19 -12
  232. classiq/model_expansions/generative_functions.py +3 -2
  233. classiq/model_expansions/interpreter.py +31 -19
  234. classiq/model_expansions/model_tables.py +14 -14
  235. classiq/model_expansions/quantum_operations/bind.py +2 -4
  236. classiq/model_expansions/quantum_operations/classicalif.py +1 -1
  237. classiq/model_expansions/quantum_operations/control.py +2 -4
  238. classiq/model_expansions/quantum_operations/emitter.py +10 -13
  239. classiq/model_expansions/quantum_operations/expression_operation.py +23 -16
  240. classiq/model_expansions/quantum_operations/inplace_binary_operation.py +164 -38
  241. classiq/model_expansions/quantum_operations/phase.py +6 -6
  242. classiq/model_expansions/quantum_operations/quantum_assignment_operation.py +25 -5
  243. classiq/model_expansions/quantum_operations/quantum_function_call.py +41 -2
  244. classiq/model_expansions/quantum_operations/repeat.py +1 -3
  245. classiq/model_expansions/scope.py +11 -10
  246. classiq/model_expansions/scope_initialization.py +6 -5
  247. classiq/model_expansions/sympy_conversion/expression_to_sympy.py +6 -6
  248. classiq/model_expansions/sympy_conversion/sympy_to_python.py +2 -2
  249. classiq/model_expansions/visitors/variable_references.py +5 -4
  250. classiq/qmod/__init__.py +2 -0
  251. classiq/qmod/builtins/classical_execution_primitives.py +9 -9
  252. classiq/qmod/builtins/functions/__init__.py +75 -53
  253. classiq/qmod/builtins/functions/amplitude_estimation.py +4 -1
  254. classiq/qmod/builtins/functions/arithmetic.py +14 -1
  255. classiq/qmod/builtins/functions/discrete_sine_cosine_transform.py +86 -6
  256. classiq/qmod/builtins/functions/grover.py +41 -45
  257. classiq/qmod/builtins/functions/hea.py +60 -4
  258. classiq/qmod/builtins/functions/linear_pauli_rotation.py +26 -4
  259. classiq/qmod/builtins/functions/modular_exponentiation.py +90 -29
  260. classiq/qmod/builtins/functions/operators.py +1 -1
  261. classiq/qmod/builtins/functions/qaoa_penalty.py +14 -5
  262. classiq/qmod/builtins/functions/qft_functions.py +57 -0
  263. classiq/qmod/builtins/functions/qpe.py +20 -4
  264. classiq/qmod/builtins/functions/qsvt.py +49 -4
  265. classiq/qmod/builtins/functions/standard_gates.py +18 -18
  266. classiq/qmod/builtins/functions/state_preparation.py +92 -10
  267. classiq/qmod/builtins/functions/swap_test.py +7 -1
  268. classiq/qmod/builtins/functions/utility_functions.py +43 -0
  269. classiq/qmod/builtins/functions/variational.py +53 -0
  270. classiq/qmod/builtins/operations.py +4 -5
  271. classiq/qmod/cfunc.py +2 -2
  272. classiq/qmod/classical_function.py +3 -7
  273. classiq/qmod/create_model_function.py +19 -8
  274. classiq/qmod/declaration_inferrer.py +7 -10
  275. classiq/qmod/expression_query.py +3 -3
  276. classiq/qmod/generative.py +2 -1
  277. classiq/qmod/model_state_container.py +5 -7
  278. classiq/qmod/native/__init__.py +1 -3
  279. classiq/qmod/native/expression_to_qmod.py +9 -8
  280. classiq/qmod/native/pretty_printer.py +6 -5
  281. classiq/qmod/pretty_print/__init__.py +1 -3
  282. classiq/qmod/pretty_print/expression_to_python.py +13 -12
  283. classiq/qmod/pretty_print/pretty_printer.py +13 -12
  284. classiq/qmod/python_classical_type.py +8 -4
  285. classiq/qmod/qfunc.py +4 -4
  286. classiq/qmod/qmod_parameter.py +3 -1
  287. classiq/qmod/qmod_variable.py +11 -10
  288. classiq/qmod/quantum_expandable.py +32 -15
  289. classiq/qmod/quantum_function.py +34 -5
  290. classiq/qmod/semantics/annotation.py +1 -1
  291. classiq/qmod/semantics/error_manager.py +8 -7
  292. classiq/qmod/semantics/static_semantics_visitor.py +19 -24
  293. classiq/qmod/semantics/validation/constants_validation.py +1 -1
  294. classiq/qmod/semantics/validation/func_call_validation.py +2 -2
  295. classiq/qmod/semantics/validation/main_validation.py +33 -0
  296. classiq/qmod/semantics/validation/types_validation.py +2 -1
  297. classiq/qmod/symbolic.py +5 -8
  298. classiq/qmod/symbolic_type.py +2 -2
  299. classiq/qmod/synthesize_separately.py +16 -0
  300. {classiq-0.52.0.dist-info → classiq-0.54.0.dist-info}/METADATA +1 -1
  301. {classiq-0.52.0.dist-info → classiq-0.54.0.dist-info}/RECORD +302 -295
  302. classiq/qmod/builtins/functions/qft.py +0 -23
  303. {classiq-0.52.0.dist-info → classiq-0.54.0.dist-info}/WHEEL +0 -0
@@ -1,6 +1,6 @@
1
1
  import logging
2
2
  from collections import defaultdict
3
- from typing import Dict, Optional, Tuple
3
+ from typing import Optional
4
4
 
5
5
  import numpy as np
6
6
 
@@ -15,7 +15,7 @@ def generate_data(
15
15
  range_max: float = 2 * np.pi,
16
16
  std: float = 0.5,
17
17
  sources: Optional[np.ndarray] = None,
18
- ) -> Dict[int, np.ndarray]:
18
+ ) -> dict[int, np.ndarray]:
19
19
  if sources is None:
20
20
  sources = np.random.uniform(
21
21
  range_min, range_max, (amount_of_sources, dimension)
@@ -36,7 +36,7 @@ def generate_data(
36
36
  return results
37
37
 
38
38
 
39
- def data_dict_to_data_and_labels(data_dict: dict) -> Tuple[np.ndarray, np.ndarray]:
39
+ def data_dict_to_data_and_labels(data_dict: dict) -> tuple[np.ndarray, np.ndarray]:
40
40
  data = []
41
41
  labels = []
42
42
  for k, v in data_dict.items():
@@ -1,4 +1,4 @@
1
- from typing import Any, List, Tuple
1
+ from typing import Any
2
2
 
3
3
  from classiq.interface.applications.qsvm import DataList, LabelsInt
4
4
  from classiq.interface.exceptions import ClassiqValueError
@@ -22,19 +22,19 @@ _OUTPUT_VARIABLE_NAME = "qsvm_results"
22
22
 
23
23
  def _bloch_sphere_feature_map_function_params(
24
24
  bloch_feature_dimension: int,
25
- ) -> Tuple[List[Expression], str]:
25
+ ) -> tuple[list[Expression], str]:
26
26
  return [
27
27
  Expression(expr=f"{bloch_feature_dimension}")
28
28
  ], f"ceiling({bloch_feature_dimension}/2)"
29
29
 
30
30
 
31
31
  def _pauli_feature_map_function_params(
32
- paulis: List[List[Pauli]],
32
+ paulis: list[list[Pauli]],
33
33
  entanglement: QSVMFeatureMapEntanglement,
34
34
  alpha: int,
35
35
  reps: int,
36
36
  feature_dimension: int,
37
- ) -> Tuple[List[Expression], str]:
37
+ ) -> tuple[list[Expression], str]:
38
38
  paulis_str = (
39
39
  "["
40
40
  + ",".join(
@@ -61,7 +61,7 @@ def _pauli_feature_map_function_params(
61
61
 
62
62
  def get_qsvm_qmain_body(
63
63
  feature_map_function_name: str, **kwargs: Any
64
- ) -> List[QuantumFunctionCall]:
64
+ ) -> list[QuantumFunctionCall]:
65
65
  if feature_map_function_name == "bloch_sphere_feature_map":
66
66
  params, size_expr = _bloch_sphere_feature_map_function_params(**kwargs)
67
67
  elif feature_map_function_name == "pauli_feature_map":
@@ -1,5 +1,3 @@
1
- from typing import List
2
-
3
1
  from ..executor import * # noqa: F403
4
2
  from ..executor import __all__ as _exec_all
5
3
  from ..interface.backend.backend_preferences import * # noqa: F403
@@ -12,6 +10,7 @@ from ..interface.executor.vqe_result import VQESolverResult
12
10
  from .execution_session import ExecutionSession
13
11
  from .iqcc import generate_iqcc_token, generate_iqcc_token_async
14
12
  from .jobs import ExecutionJob, get_execution_jobs, get_execution_jobs_async
13
+ from .qaoa import execute_qaoa
15
14
  from .qnn import execute_qnn
16
15
 
17
16
  __all__ = (
@@ -26,6 +25,7 @@ __all__ = (
26
25
  "get_execution_jobs",
27
26
  "get_execution_jobs_async",
28
27
  "ExecutionSession",
28
+ "execute_qaoa",
29
29
  "execute_qnn",
30
30
  "generate_iqcc_token",
31
31
  "generate_iqcc_token_async",
@@ -33,5 +33,5 @@ __all__ = (
33
33
  )
34
34
 
35
35
 
36
- def __dir__() -> List[str]:
36
+ def __dir__() -> list[str]:
37
37
  return __all__
@@ -1,12 +1,10 @@
1
- from typing import List
2
-
3
1
  from classiq.interface.hardware import HardwareInformation
4
2
 
5
3
  from classiq._internals import async_utils
6
4
  from classiq._internals.api_wrapper import ApiWrapper
7
5
 
8
6
 
9
- def get_all_hardware_devices() -> List[HardwareInformation]:
7
+ def get_all_hardware_devices() -> list[HardwareInformation]:
10
8
  """
11
9
  Returns a list of all hardware devices known to Classiq.
12
10
  """
@@ -1,5 +1,7 @@
1
1
  import json
2
- from typing import Any, Callable, Dict, List, Optional, Tuple, Union, cast
2
+ from typing import Any, Callable, Optional, Union, cast
3
+
4
+ import numpy as np
3
5
 
4
6
  from classiq.interface.chemistry.operator import PauliOperator, pauli_integers_to_str
5
7
  from classiq.interface.exceptions import ClassiqValueError
@@ -8,6 +10,7 @@ from classiq.interface.executor.execution_preferences import ExecutionPreference
8
10
  from classiq.interface.executor.result import (
9
11
  EstimationResult,
10
12
  ExecutionDetails,
13
+ ParsedState,
11
14
  )
12
15
  from classiq.interface.generator.functions.qmod_python_interface import QmodPyStruct
13
16
  from classiq.interface.generator.quantum_program import QuantumProgram
@@ -25,12 +28,12 @@ from classiq.qmod.builtins.classical_execution_primitives import (
25
28
  )
26
29
  from classiq.synthesis import SerializedQuantumProgram
27
30
 
28
- Hamiltonian = Union[List[QmodPyStruct], List[PauliTerm]]
31
+ Hamiltonian = Union[list[QmodPyStruct], list[PauliTerm]]
29
32
  Program = Union[SerializedQuantumProgram, QuantumProgram]
30
- ParsedExecutionParams = Dict[str, Union[float, int]]
31
- ExecutionParameters = Optional[Union[ExecutionParams, List[ExecutionParams]]]
33
+ ParsedExecutionParams = dict[str, Union[float, int]]
34
+ ExecutionParameters = Optional[Union[ExecutionParams, list[ExecutionParams]]]
32
35
  ParsedExecutionParameters = Optional[
33
- Union[ParsedExecutionParams, List[ParsedExecutionParams]]
36
+ Union[ParsedExecutionParams, list[ParsedExecutionParams]]
34
37
  ]
35
38
 
36
39
 
@@ -52,11 +55,11 @@ def _deserialize_program(program: Program) -> QuantumProgram:
52
55
  )
53
56
 
54
57
 
55
- def hamiltonian_to_pauli_terms(hamiltonian: Hamiltonian) -> List[PauliTerm]:
58
+ def hamiltonian_to_pauli_terms(hamiltonian: Hamiltonian) -> list[PauliTerm]:
56
59
  if isinstance(hamiltonian[0], PauliTerm):
57
- return cast(List[PauliTerm], hamiltonian)
60
+ return cast(list[PauliTerm], hamiltonian)
58
61
  else:
59
- return _pauli_dict_to_pauli_terms(cast(List[QmodPyStruct], hamiltonian))
62
+ return _pauli_dict_to_pauli_terms(cast(list[QmodPyStruct], hamiltonian))
60
63
 
61
64
 
62
65
  def to_hamiltonian_str(hamiltonian: Hamiltonian) -> str:
@@ -75,8 +78,8 @@ def _hamiltonian_to_pauli_operator(hamiltonian: Hamiltonian) -> PauliOperator:
75
78
 
76
79
 
77
80
  def serialize(
78
- item: Union[float, int, Tuple[int, ...], Tuple[float, ...]]
79
- ) -> Union[str, List]:
81
+ item: Union[float, int, tuple[int, ...], tuple[float, ...]]
82
+ ) -> Union[str, list]:
80
83
  if isinstance(item, tuple):
81
84
  return list(item)
82
85
  return str(item)
@@ -123,7 +126,7 @@ def create_sample_execution_code(operation: str, **kwargs: Any) -> str:
123
126
  return f"\nresult = {operation}({parameters})" + SAVE_RESULT
124
127
 
125
128
 
126
- operation_handlers: Dict[str, Callable[[str], str]] = {
129
+ operation_handlers: dict[str, Callable[[str], str]] = {
127
130
  "estimate": create_estimate_execution_code,
128
131
  "batch_estimate": create_estimate_execution_code,
129
132
  "sample": create_sample_execution_code,
@@ -215,7 +218,7 @@ class ExecutionSession:
215
218
  )
216
219
  return execute(SerializedQuantumProgram(self.qprog))
217
220
 
218
- def batch_sample(self, parameters: List[ExecutionParams]) -> List[ExecutionDetails]:
221
+ def batch_sample(self, parameters: list[ExecutionParams]) -> list[ExecutionDetails]:
219
222
  """
220
223
  Samples the quantum program multiple times with the given parameters for each iteration. The number of samples is determined by the length of the parameters list.
221
224
 
@@ -228,7 +231,7 @@ class ExecutionSession:
228
231
  job = self.submit_batch_sample(parameters=parameters)
229
232
  return job.get_batch_sample_result()
230
233
 
231
- def submit_batch_sample(self, parameters: List[ExecutionParams]) -> ExecutionJob:
234
+ def submit_batch_sample(self, parameters: list[ExecutionParams]) -> ExecutionJob:
232
235
  """
233
236
  Initiates an execution job with the `batch_sample` primitive.
234
237
 
@@ -297,8 +300,8 @@ class ExecutionSession:
297
300
  return execute(SerializedQuantumProgram(self.qprog))
298
301
 
299
302
  def batch_estimate(
300
- self, hamiltonian: Hamiltonian, parameters: List[ExecutionParams]
301
- ) -> List[EstimationResult]:
303
+ self, hamiltonian: Hamiltonian, parameters: list[ExecutionParams]
304
+ ) -> list[EstimationResult]:
302
305
  """
303
306
  Estimates the expectation value of the given Hamiltonian multiple times using the quantum program, with the given parameters for each iteration. The number of estimations is determined by the length of the parameters list.
304
307
 
@@ -313,7 +316,7 @@ class ExecutionSession:
313
316
  return job.get_batch_estimate_result()
314
317
 
315
318
  def submit_batch_estimate(
316
- self, hamiltonian: Hamiltonian, parameters: List[ExecutionParams]
319
+ self, hamiltonian: Hamiltonian, parameters: list[ExecutionParams]
317
320
  ) -> ExecutionJob:
318
321
  """
319
322
  Initiates an execution job with the `batch_estimate` primitive.
@@ -340,3 +343,41 @@ class ExecutionSession:
340
343
  )
341
344
  )
342
345
  return execute(SerializedQuantumProgram(self.qprog))
346
+
347
+ def estimate_cost(
348
+ self,
349
+ cost_func: Callable[[ParsedState], float],
350
+ parameters: Optional[ExecutionParams] = None,
351
+ quantile: float = 1.0,
352
+ ) -> float:
353
+ """
354
+ Estimates circuit cost using a classical cost function.
355
+
356
+ Args:
357
+ cost_func: classical circuit sample cost function
358
+ parameters: execution parameters sent to 'sample'
359
+ quantile: drop cost values outside the specified quantile
360
+
361
+ Returns:
362
+ cost estimation
363
+
364
+ See Also:
365
+ sample
366
+ """
367
+ if quantile < 0 or quantile > 1:
368
+ raise ClassiqValueError("'quantile' must be between 0 and 1")
369
+ res = self.sample(parameters)
370
+
371
+ counts = np.array(res.parsed_counts)
372
+ costs = np.vectorize(lambda sample: cost_func(sample.state))(counts)
373
+ shots = np.vectorize(lambda sample: sample.shots)(counts)
374
+
375
+ if quantile == 1:
376
+ return float(np.average(costs, weights=shots))
377
+ costs = np.repeat(costs, shots)
378
+ sort_idx = costs.argsort()
379
+ sort_idx = sort_idx[: int(quantile * len(costs))]
380
+ costs = costs[sort_idx]
381
+ if costs.size == 0:
382
+ return np.nan
383
+ return float(np.average(costs))
classiq/execution/iqcc.py CHANGED
@@ -51,7 +51,7 @@ async def generate_iqcc_token_async(
51
51
  token_id=initiate_response.token_id,
52
52
  )
53
53
  )
54
- if probe_response.auth_token is not None:
54
+ if probe_response is not None:
55
55
  return probe_response.auth_token
56
56
 
57
57
  if time.monotonic() - start_time > timeout:
classiq/execution/jobs.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import webbrowser
2
2
  from datetime import datetime
3
- from typing import Any, List, Optional, Union
3
+ from typing import Any, Optional, Union
4
4
  from urllib.parse import urljoin
5
5
 
6
6
  from classiq.interface.exceptions import (
@@ -150,7 +150,7 @@ class ExecutionJob:
150
150
  return result.details[0]
151
151
  raise ClassiqExecutionResultError("sample")
152
152
 
153
- def get_batch_sample_result(self) -> List[ExecutionDetails]:
153
+ def get_batch_sample_result(self) -> list[ExecutionDetails]:
154
154
  """
155
155
  Returns the job's result as a single batch_sample result after validation. If the result is not yet available, waits for it.
156
156
 
@@ -195,7 +195,7 @@ class ExecutionJob:
195
195
  return result.results[0]
196
196
  raise ClassiqExecutionResultError("estimate")
197
197
 
198
- def get_batch_estimate_result(self) -> List[EstimationResult]:
198
+ def get_batch_estimate_result(self) -> list[EstimationResult]:
199
199
  """
200
200
  Returns the job's result as a single batch_estimate result after validation. If the result is not yet available, waits for it.
201
201
 
@@ -271,7 +271,7 @@ class ExecutionJob:
271
271
 
272
272
  async def get_execution_jobs_async(
273
273
  offset: int = 0, limit: int = 50
274
- ) -> List[ExecutionJob]:
274
+ ) -> list[ExecutionJob]:
275
275
  result = await ApiWrapper().call_query_execution_jobs(offset=offset, limit=limit)
276
276
  return [ExecutionJob(details) for details in result.results]
277
277
 
@@ -0,0 +1,84 @@
1
+ import math
2
+ from typing import Callable, Optional
3
+
4
+ import numpy as np
5
+ import scipy
6
+
7
+ from classiq.interface.executor.execution_preferences import ExecutionPreferences
8
+ from classiq.interface.executor.result import ExecutionDetails
9
+ from classiq.interface.model.model import SerializedModel
10
+
11
+ from classiq.execution import ExecutionSession
12
+ from classiq.qmod.builtins.functions import (
13
+ RX,
14
+ allocate,
15
+ apply_to_all,
16
+ hadamard_transform,
17
+ )
18
+ from classiq.qmod.builtins.operations import phase, repeat
19
+ from classiq.qmod.cparam import CReal
20
+ from classiq.qmod.create_model_function import create_model
21
+ from classiq.qmod.qfunc import qfunc
22
+ from classiq.qmod.qmod_parameter import CArray
23
+ from classiq.qmod.qmod_variable import Output, QVar
24
+ from classiq.synthesis import SerializedQuantumProgram, synthesize
25
+
26
+
27
+ def execute_qaoa(
28
+ problem_vars: type[QVar],
29
+ cost_func: Callable,
30
+ num_layers: int,
31
+ maxiter: int,
32
+ execution_preferences: Optional[ExecutionPreferences] = None,
33
+ ) -> tuple[SerializedModel, SerializedQuantumProgram, ExecutionDetails]:
34
+ """
35
+ Implements a simple QAOA algorithm, including the creation and synthesis of the QAOA
36
+ ansatz and the classical optimization loop.
37
+
38
+ Args:
39
+ problem_vars: the quantum type (scalar, array, or struct) of the problem variable(s)
40
+ cost_func: the arithmetic expression that evaluates the cost given an instance of the problem_vars type
41
+ num_layers: the number of layers of the QAOA ansatz
42
+ maxiter: the maximum number of iterations for the classical optimization loop
43
+ execution_preferences: the execution settings for running the QAOA ansatz
44
+
45
+ Returns:
46
+ a tuple containing the model of the QAOA ansatz, the corresponding synthesized quantum program,
47
+ and the result of the execution with the optimized parameters
48
+ """
49
+
50
+ @qfunc
51
+ def main(
52
+ params: CArray[CReal, num_layers * 2], # type:ignore[valid-type]
53
+ v: Output[problem_vars], # type:ignore[valid-type]
54
+ ) -> None:
55
+ allocate(v.size, v) # type:ignore[attr-defined]
56
+ hadamard_transform(v)
57
+ repeat(
58
+ num_layers,
59
+ lambda i: [ # type:ignore[arg-type]
60
+ phase(-cost_func(v), params[i]), # type:ignore[func-returns-value]
61
+ apply_to_all(lambda q: RX(params[num_layers + i], q), v),
62
+ ],
63
+ )
64
+
65
+ model = create_model(main)
66
+ qprog = synthesize(model)
67
+
68
+ es = ExecutionSession(qprog, execution_preferences)
69
+ initial_params = (
70
+ np.concatenate((np.linspace(0, 1, num_layers), np.linspace(1, 0, num_layers)))
71
+ * math.pi
72
+ )
73
+ final_params = scipy.optimize.minimize(
74
+ lambda params: es.estimate_cost(
75
+ lambda state: cost_func(state["v"]),
76
+ {"params": params.tolist()},
77
+ ),
78
+ x0=initial_params,
79
+ method="COBYLA",
80
+ options={"maxiter": maxiter},
81
+ ).x.tolist()
82
+ result = es.sample({"params": final_params})
83
+
84
+ return model, qprog, result
classiq/execution/qnn.py CHANGED
@@ -1,5 +1,5 @@
1
1
  import functools
2
- from typing import List, Optional
2
+ from typing import Optional
3
3
 
4
4
  import more_itertools
5
5
 
@@ -24,7 +24,7 @@ _MAX_ARGUMENTS_SIZE = 1024
24
24
 
25
25
  def _execute_qnn_estimate(
26
26
  session: ExecutionSession,
27
- arguments: List[Arguments],
27
+ arguments: list[Arguments],
28
28
  observable: PauliOperator,
29
29
  ) -> ResultsCollection:
30
30
  hamiltonian = pauli_operator_to_hamiltonian(observable.pauli_list)
@@ -42,7 +42,7 @@ def _execute_qnn_estimate(
42
42
 
43
43
  def _execute_qnn_sample(
44
44
  session: ExecutionSession,
45
- arguments: List[Arguments],
45
+ arguments: list[Arguments],
46
46
  ) -> ResultsCollection:
47
47
  return [
48
48
  TaggedExecutionDetails(
classiq/executor.py CHANGED
@@ -1,6 +1,6 @@
1
1
  """Executor module, implementing facilities for executing quantum programs using Classiq platform."""
2
2
 
3
- from typing import Tuple, Union
3
+ from typing import Union
4
4
 
5
5
  from typing_extensions import TypeAlias
6
6
 
@@ -18,8 +18,8 @@ from classiq.execution.jobs import ExecutionJob
18
18
  from classiq.synthesis import SerializedQuantumProgram
19
19
 
20
20
  BatchExecutionResult: TypeAlias = Union[ExecutionDetails, BaseException]
21
- ProgramAndResult: TypeAlias = Tuple[QuantumCode, BatchExecutionResult]
22
- BackendPreferencesAndResult: TypeAlias = Tuple[
21
+ ProgramAndResult: TypeAlias = tuple[QuantumCode, BatchExecutionResult]
22
+ BackendPreferencesAndResult: TypeAlias = tuple[
23
23
  BackendPreferencesTypes, int, BatchExecutionResult
24
24
  ]
25
25
 
@@ -46,7 +46,7 @@ def execute(quantum_program: SerializedQuantumProgram) -> ExecutionJob:
46
46
  Returns:
47
47
  ExecutionJob: The result of the execution.
48
48
 
49
- For examples please see [Execution Documentation](https://docs.classiq.io/latest/reference-manual/executor/)
49
+ For examples please see [Execution Documentation](https://docs.classiq.io/latest/user-guide/executor/)
50
50
  """
51
51
  return async_utils.run(execute_async(quantum_program))
52
52
 
@@ -3,5 +3,5 @@ from packaging.version import Version
3
3
  # This file was generated automatically
4
4
  # Please don't track in version control (DONTTRACK)
5
5
 
6
- SEMVER_VERSION = '0.52.0'
6
+ SEMVER_VERSION = '0.54.0'
7
7
  VERSION = str(Version(SEMVER_VERSION))
@@ -1,9 +1,8 @@
1
- from typing import Dict, List, Optional
1
+ from typing import Annotated, Optional
2
2
 
3
3
  import numpy
4
4
  import pydantic
5
5
  from pydantic import ConfigDict, Field, StringConstraints
6
- from typing_extensions import Annotated
7
6
 
8
7
  from classiq.interface.backend.quantum_backend_providers import AnalyzerProviderVendor
9
8
  from classiq.interface.chemistry.ground_state_problem import MoleculeProblem
@@ -30,17 +29,17 @@ class AnalysisParams(pydantic.BaseModel):
30
29
 
31
30
 
32
31
  class HardwareListParams(pydantic.BaseModel):
33
- devices: Optional[List[PydanticNonEmptyString]] = pydantic.Field(
32
+ devices: Optional[list[PydanticNonEmptyString]] = pydantic.Field(
34
33
  default=None, description="Devices"
35
34
  )
36
- providers: List[Provider]
35
+ providers: list[Provider]
37
36
  from_ide: bool = Field(default=False)
38
37
 
39
38
  @pydantic.field_validator("providers")
40
39
  @classmethod
41
40
  def set_default_providers(
42
- cls, providers: Optional[List[AnalyzerProviderVendor]]
43
- ) -> List[AnalyzerProviderVendor]:
41
+ cls, providers: Optional[list[AnalyzerProviderVendor]]
42
+ ) -> list[AnalyzerProviderVendor]:
44
43
  if providers is None:
45
44
  providers = list(AnalyzerProviderVendor)
46
45
  return providers
@@ -65,7 +64,7 @@ class GateNamsMapping(pydantic.BaseModel):
65
64
 
66
65
 
67
66
  class LatexParams(AnalysisParams):
68
- gate_names: List[GateNamsMapping] = pydantic.Field(
67
+ gate_names: list[GateNamsMapping] = pydantic.Field(
69
68
  default=..., description="List of gate names as apper in the qasm"
70
69
  )
71
70
 
@@ -96,12 +95,12 @@ class CircuitAnalysisHardwareParams(AnalysisParams):
96
95
 
97
96
  class AnalysisRBParams(pydantic.BaseModel):
98
97
  hardware: str
99
- counts: List[
100
- Dict[
98
+ counts: list[
99
+ dict[
101
100
  str, Annotated[int, Annotated[int, Field(strict=True, gt=0, le=MAX_COUNTS)]]
102
101
  ]
103
102
  ]
104
- num_clifford: List[
103
+ num_clifford: list[
105
104
  Annotated[int, Annotated[int, Field(strict=True, gt=0, le=MAX_NUM_CLIFFORD)]]
106
105
  ]
107
106
 
@@ -1,4 +1,4 @@
1
- from typing import Any, Dict, List, Optional
1
+ from typing import Any, Optional
2
2
 
3
3
  import pydantic
4
4
 
@@ -25,7 +25,7 @@ class CytoScapeEdgeData(pydantic.BaseModel):
25
25
 
26
26
  @pydantic.model_validator(mode="before")
27
27
  @classmethod
28
- def _validate_values(cls, values: Dict[str, Any]) -> Dict[str, Any]:
28
+ def _validate_values(cls, values: dict[str, Any]) -> dict[str, Any]:
29
29
  values["source"] = str(values["source"]) or " "
30
30
  values["target"] = str(values["target"]) or " "
31
31
  return values
@@ -38,7 +38,7 @@ class CytoScapeEdge(pydantic.BaseModel):
38
38
 
39
39
 
40
40
  class CytoScapeNode(pydantic.BaseModel):
41
- data: Dict[str, Any] = pydantic.Field(
41
+ data: dict[str, Any] = pydantic.Field(
42
42
  default=...,
43
43
  description="Data of the Node, such as label, and color, can be of free form",
44
44
  )
@@ -48,11 +48,11 @@ class CytoScapeNode(pydantic.BaseModel):
48
48
 
49
49
 
50
50
  class CytoScapeGraph(pydantic.BaseModel):
51
- nodes: List[CytoScapeNode] = pydantic.Field(
51
+ nodes: list[CytoScapeNode] = pydantic.Field(
52
52
  default_factory=list,
53
53
  description="Nodes of the Graph",
54
54
  )
55
- edges: List[CytoScapeEdge] = pydantic.Field(
55
+ edges: list[CytoScapeEdge] = pydantic.Field(
56
56
  default_factory=list,
57
57
  description="Edges of the Graph",
58
58
  )
@@ -1,9 +1,9 @@
1
- from typing import Dict, List, Literal, Optional, Set, Tuple, Union
1
+ from typing import Annotated, Literal, Optional, Union
2
2
  from uuid import UUID
3
3
 
4
4
  import pydantic
5
5
  from pydantic import Field
6
- from typing_extensions import Annotated, Self
6
+ from typing_extensions import Self
7
7
 
8
8
  from classiq.interface.analyzer.analysis_params import MAX_FILE_LENGTH
9
9
  from classiq.interface.enum_utils import StrEnum
@@ -11,7 +11,7 @@ from classiq.interface.exceptions import ClassiqValueError
11
11
  from classiq.interface.helpers.custom_pydantic_types import PydanticNonEmptyString
12
12
  from classiq.interface.helpers.versioned_model import VersionedModel
13
13
 
14
- Match = List[List[int]]
14
+ Match = list[list[int]]
15
15
 
16
16
 
17
17
  class GraphStatus(StrEnum):
@@ -29,8 +29,8 @@ class RbResults(VersionedModel):
29
29
  average_error: float
30
30
  A: float
31
31
  B: float
32
- success_probability: List[float]
33
- parameters_error: Tuple[float, ...]
32
+ success_probability: list[float]
33
+ parameters_error: tuple[float, ...]
34
34
 
35
35
 
36
36
  class DataID(pydantic.BaseModel):
@@ -58,19 +58,19 @@ class BasisGates(StrEnum):
58
58
 
59
59
 
60
60
  class HardwareComparisonInformation(pydantic.BaseModel):
61
- devices: List[str] = pydantic.Field(
61
+ devices: list[str] = pydantic.Field(
62
62
  default=..., description="Device which is used for the transpilation."
63
63
  )
64
- providers: List[str] = pydantic.Field(
64
+ providers: list[str] = pydantic.Field(
65
65
  default=..., description="Provider cloud of the device."
66
66
  )
67
- depth: List[pydantic.NonNegativeInt] = pydantic.Field(
67
+ depth: list[pydantic.NonNegativeInt] = pydantic.Field(
68
68
  default=..., description="Circuit depth."
69
69
  )
70
- multi_qubit_gate_count: List[pydantic.NonNegativeInt] = pydantic.Field(
70
+ multi_qubit_gate_count: list[pydantic.NonNegativeInt] = pydantic.Field(
71
71
  default=..., description="Number of multi qubit gates."
72
72
  )
73
- total_gate_count: List[pydantic.NonNegativeInt] = pydantic.Field(
73
+ total_gate_count: list[pydantic.NonNegativeInt] = pydantic.Field(
74
74
  default=..., description="Number of total gates."
75
75
  )
76
76
 
@@ -105,32 +105,32 @@ class SingleHardwareInformation(pydantic.BaseModel):
105
105
 
106
106
  class HardwareComparisonData(VersionedModel):
107
107
  kind: Literal["hardware_comparison"] = Field(default="hardware_comparison")
108
- data: List[SingleHardwareInformation]
108
+ data: list[SingleHardwareInformation]
109
109
 
110
110
 
111
111
  HardwareComparisonGraphType = Annotated[
112
112
  Union[HardwareComparisonData, GraphResult], Field(discriminator="kind")
113
113
  ]
114
114
 
115
- _HARDWARE_COMPARISON_TABLE_COLUMNS_NAMES: Dict[str, str] = {
115
+ _HARDWARE_COMPARISON_TABLE_COLUMNS_NAMES: dict[str, str] = {
116
116
  s.upper(): s.capitalize() for s in SingleHardwareInformation.model_fields
117
117
  }
118
118
 
119
119
 
120
120
  class HardwareComparisonDataColumns(pydantic.BaseModel):
121
- columns: Dict[str, str] = _HARDWARE_COMPARISON_TABLE_COLUMNS_NAMES
121
+ columns: dict[str, str] = _HARDWARE_COMPARISON_TABLE_COLUMNS_NAMES
122
122
 
123
123
 
124
124
  class AvailableHardware(pydantic.BaseModel):
125
- ibm_quantum: Optional[Dict[PydanticNonEmptyString, bool]] = pydantic.Field(
125
+ ibm_quantum: Optional[dict[PydanticNonEmptyString, bool]] = pydantic.Field(
126
126
  default=None,
127
127
  description="available IBM Quantum devices with boolean indicates if a given device has enough qubits.",
128
128
  )
129
- azure_quantum: Optional[Dict[PydanticNonEmptyString, bool]] = pydantic.Field(
129
+ azure_quantum: Optional[dict[PydanticNonEmptyString, bool]] = pydantic.Field(
130
130
  default=None,
131
131
  description="available Azure Quantum devices with boolean indicates if a given device has enough qubits.",
132
132
  )
133
- amazon_braket: Optional[Dict[PydanticNonEmptyString, bool]] = pydantic.Field(
133
+ amazon_braket: Optional[dict[PydanticNonEmptyString, bool]] = pydantic.Field(
134
134
  default=None,
135
135
  description="available Amazon Braket devices with boolean indicates if a given device has enough qubits.",
136
136
  )
@@ -163,7 +163,7 @@ class QuantumCircuitProperties(pydantic.BaseModel):
163
163
 
164
164
 
165
165
  class NativeQuantumCircuitProperties(QuantumCircuitProperties):
166
- native_gates: Set[BasisGates] = pydantic.Field(
166
+ native_gates: set[BasisGates] = pydantic.Field(
167
167
  default=..., description="Native gates used for decomposition"
168
168
  )
169
169