classiq 0.53.0__py3-none-any.whl → 0.55.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 (301) 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 +8 -8
  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 +10 -12
  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 +3 -3
  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 +1 -3
  56. classiq/execution/all_hardware_devices.py +1 -3
  57. classiq/execution/execution_session.py +16 -16
  58. classiq/execution/jobs.py +4 -4
  59. classiq/execution/qaoa.py +3 -3
  60. classiq/execution/qnn.py +3 -3
  61. classiq/executor.py +3 -3
  62. classiq/interface/_version.py +1 -1
  63. classiq/interface/analyzer/analysis_params.py +9 -10
  64. classiq/interface/analyzer/cytoscape_graph.py +5 -5
  65. classiq/interface/analyzer/result.py +17 -17
  66. classiq/interface/applications/qsvm.py +6 -10
  67. classiq/interface/backend/backend_preferences.py +4 -3
  68. classiq/interface/backend/ionq/ionq_quantum_program.py +4 -5
  69. classiq/interface/backend/pydantic_backend.py +1 -2
  70. classiq/interface/chemistry/fermionic_operator.py +5 -5
  71. classiq/interface/chemistry/ground_state_problem.py +7 -8
  72. classiq/interface/chemistry/molecule.py +4 -4
  73. classiq/interface/chemistry/operator.py +11 -13
  74. classiq/interface/combinatorial_optimization/examples/ascending_sequence.py +1 -3
  75. classiq/interface/combinatorial_optimization/examples/integer_portfolio_optimization.py +2 -4
  76. classiq/interface/combinatorial_optimization/examples/knapsack.py +3 -3
  77. classiq/interface/combinatorial_optimization/examples/mht.py +2 -3
  78. classiq/interface/combinatorial_optimization/examples/portfolio_variations.py +2 -2
  79. classiq/interface/combinatorial_optimization/examples/set_cover.py +1 -2
  80. classiq/interface/combinatorial_optimization/mht_qaoa_input.py +5 -7
  81. classiq/interface/combinatorial_optimization/optimization_problem.py +2 -2
  82. classiq/interface/combinatorial_optimization/result.py +1 -3
  83. classiq/interface/debug_info/debug_info.py +8 -7
  84. classiq/interface/exceptions.py +8 -6
  85. classiq/interface/execution/jobs.py +2 -2
  86. classiq/interface/execution/primitives.py +3 -3
  87. classiq/interface/executor/aws_execution_cost.py +4 -4
  88. classiq/interface/executor/execution_request.py +2 -3
  89. classiq/interface/executor/execution_result.py +3 -3
  90. classiq/interface/executor/iqae_result.py +3 -5
  91. classiq/interface/executor/optimizer_preferences.py +2 -2
  92. classiq/interface/executor/quantum_code.py +6 -6
  93. classiq/interface/executor/register_initialization.py +2 -4
  94. classiq/interface/executor/result.py +23 -27
  95. classiq/interface/executor/vqe_result.py +8 -8
  96. classiq/interface/finance/function_input.py +2 -2
  97. classiq/interface/finance/gaussian_model_input.py +5 -5
  98. classiq/interface/finance/log_normal_model_input.py +2 -2
  99. classiq/interface/finance/model_input.py +1 -2
  100. classiq/interface/generator/adjacency.py +1 -3
  101. classiq/interface/generator/ansatz_library.py +4 -4
  102. classiq/interface/generator/application_apis/finance_declarations.py +1 -1
  103. classiq/interface/generator/arith/argument_utils.py +3 -3
  104. classiq/interface/generator/arith/arithmetic.py +7 -7
  105. classiq/interface/generator/arith/arithmetic_arg_type_validator.py +5 -5
  106. classiq/interface/generator/arith/arithmetic_expression_abc.py +11 -11
  107. classiq/interface/generator/arith/arithmetic_expression_parser.py +8 -7
  108. classiq/interface/generator/arith/arithmetic_expression_validator.py +8 -8
  109. classiq/interface/generator/arith/arithmetic_operations.py +4 -3
  110. classiq/interface/generator/arith/arithmetic_param_getters.py +6 -6
  111. classiq/interface/generator/arith/arithmetic_result_builder.py +9 -9
  112. classiq/interface/generator/arith/ast_node_rewrite.py +2 -1
  113. classiq/interface/generator/arith/binary_ops.py +10 -13
  114. classiq/interface/generator/arith/extremum_operations.py +3 -2
  115. classiq/interface/generator/arith/logical_ops.py +7 -6
  116. classiq/interface/generator/arith/number_utils.py +4 -4
  117. classiq/interface/generator/arith/register_user_input.py +4 -4
  118. classiq/interface/generator/arith/unary_ops.py +2 -1
  119. classiq/interface/generator/builtin_api_builder.py +2 -1
  120. classiq/interface/generator/circuit_code/circuit_code.py +4 -4
  121. classiq/interface/generator/circuit_code/types_and_constants.py +3 -5
  122. classiq/interface/generator/complex_type.py +1 -2
  123. classiq/interface/generator/control_state.py +2 -2
  124. classiq/interface/generator/custom_ansatz.py +1 -3
  125. classiq/interface/generator/distance.py +3 -5
  126. classiq/interface/generator/excitations.py +3 -2
  127. classiq/interface/generator/expressions/enums/finance_functions.py +1 -3
  128. classiq/interface/generator/expressions/evaluated_expression.py +4 -3
  129. classiq/interface/generator/expressions/expression.py +4 -5
  130. classiq/interface/generator/expressions/expression_constants.py +4 -4
  131. classiq/interface/generator/expressions/qmod_qarray_proxy.py +2 -1
  132. classiq/interface/generator/expressions/qmod_qscalar_proxy.py +2 -1
  133. classiq/interface/generator/expressions/qmod_qstruct_proxy.py +2 -1
  134. classiq/interface/generator/expressions/qmod_sized_proxy.py +2 -1
  135. classiq/interface/generator/expressions/qmod_struct_instance.py +2 -1
  136. classiq/interface/generator/expressions/sympy_supported_expressions.py +11 -13
  137. classiq/interface/generator/finance.py +2 -2
  138. classiq/interface/generator/function_param_library.py +6 -6
  139. classiq/interface/generator/function_params.py +13 -19
  140. classiq/interface/generator/functions/builtins/internal_operators.py +9 -1
  141. classiq/interface/generator/functions/classical_function_declaration.py +4 -3
  142. classiq/interface/generator/functions/classical_type.py +13 -13
  143. classiq/interface/generator/functions/concrete_types.py +1 -2
  144. classiq/interface/generator/functions/function_declaration.py +1 -1
  145. classiq/interface/generator/functions/qmod_python_interface.py +2 -1
  146. classiq/interface/generator/functions/type_name.py +3 -2
  147. classiq/interface/generator/generated_circuit_data.py +33 -22
  148. classiq/interface/generator/grover_diffuser.py +7 -7
  149. classiq/interface/generator/grover_operator.py +2 -2
  150. classiq/interface/generator/hardware/hardware_data.py +7 -6
  151. classiq/interface/generator/hardware_efficient_ansatz.py +8 -8
  152. classiq/interface/generator/identity.py +5 -6
  153. classiq/interface/generator/linear_pauli_rotations.py +6 -6
  154. classiq/interface/generator/mcu.py +2 -2
  155. classiq/interface/generator/mcx.py +6 -6
  156. classiq/interface/generator/model/__init__.py +1 -3
  157. classiq/interface/generator/model/constraints.py +2 -2
  158. classiq/interface/generator/model/model.py +5 -6
  159. classiq/interface/generator/model/preferences/preferences.py +11 -6
  160. classiq/interface/generator/model/quantum_register.py +6 -11
  161. classiq/interface/generator/oracles/arithmetic_oracle.py +1 -2
  162. classiq/interface/generator/oracles/custom_oracle.py +2 -2
  163. classiq/interface/generator/oracles/oracle_abc.py +6 -5
  164. classiq/interface/generator/partitioned_register.py +6 -5
  165. classiq/interface/generator/piecewise_linear_amplitude_loading.py +8 -7
  166. classiq/interface/generator/qpe.py +4 -4
  167. classiq/interface/generator/qsvm.py +3 -3
  168. classiq/interface/generator/quantum_function_call.py +24 -29
  169. classiq/interface/generator/quantum_program.py +9 -9
  170. classiq/interface/generator/register_role.py +2 -4
  171. classiq/interface/generator/slice_parsing_utils.py +4 -3
  172. classiq/interface/generator/standard_gates/standard_gates.py +3 -3
  173. classiq/interface/generator/state_preparation/bell_state_preparation.py +3 -3
  174. classiq/interface/generator/state_preparation/distributions.py +6 -5
  175. classiq/interface/generator/state_preparation/metrics.py +2 -4
  176. classiq/interface/generator/state_preparation/state_preparation.py +4 -4
  177. classiq/interface/generator/synthesis_metadata/synthesis_execution_data.py +3 -3
  178. classiq/interface/generator/transpiler_basis_gates.py +2 -2
  179. classiq/interface/generator/types/compilation_metadata.py +5 -0
  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/hashable_mixin.py +3 -2
  193. classiq/interface/helpers/hashable_pydantic_base_model.py +2 -1
  194. classiq/interface/helpers/pydantic_model_helpers.py +4 -3
  195. classiq/interface/helpers/validation_helpers.py +2 -2
  196. classiq/interface/ide/ide_data.py +11 -15
  197. classiq/interface/ide/visual_model.py +22 -22
  198. classiq/interface/jobs.py +2 -2
  199. classiq/interface/model/bind_operation.py +5 -4
  200. classiq/interface/model/classical_parameter_declaration.py +2 -2
  201. classiq/interface/model/control.py +22 -1
  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 +16 -11
  205. classiq/interface/model/native_function_definition.py +1 -1
  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 +4 -27
  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 +7 -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/capturing/captured_var_manager.py +4 -6
  220. classiq/model_expansions/capturing/propagated_var_stack.py +7 -7
  221. classiq/model_expansions/closure.py +83 -12
  222. classiq/model_expansions/evaluators/arg_type_match.py +3 -2
  223. classiq/model_expansions/evaluators/argument_types.py +3 -3
  224. classiq/model_expansions/evaluators/control.py +3 -3
  225. classiq/model_expansions/evaluators/parameter_types.py +7 -7
  226. classiq/model_expansions/evaluators/quantum_type_utils.py +2 -1
  227. classiq/model_expansions/evaluators/type_type_match.py +1 -1
  228. classiq/model_expansions/expression_evaluator.py +10 -9
  229. classiq/model_expansions/expression_renamer.py +6 -6
  230. classiq/model_expansions/function_builder.py +13 -12
  231. classiq/model_expansions/generative_functions.py +5 -4
  232. classiq/model_expansions/interpreter.py +20 -11
  233. classiq/model_expansions/model_tables.py +14 -14
  234. classiq/model_expansions/quantum_operations/bind.py +2 -4
  235. classiq/model_expansions/quantum_operations/classicalif.py +1 -1
  236. classiq/model_expansions/quantum_operations/control.py +81 -24
  237. classiq/model_expansions/quantum_operations/emitter.py +33 -20
  238. classiq/model_expansions/quantum_operations/expression_operation.py +47 -16
  239. classiq/model_expansions/quantum_operations/inplace_binary_operation.py +160 -35
  240. classiq/model_expansions/quantum_operations/phase.py +6 -6
  241. classiq/model_expansions/quantum_operations/quantum_assignment_operation.py +28 -31
  242. classiq/model_expansions/quantum_operations/quantum_function_call.py +9 -0
  243. classiq/model_expansions/quantum_operations/repeat.py +1 -3
  244. classiq/model_expansions/quantum_operations/within_apply.py +0 -16
  245. classiq/model_expansions/scope.py +11 -10
  246. classiq/model_expansions/scope_initialization.py +5 -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/builtins/classical_execution_primitives.py +9 -9
  251. classiq/qmod/builtins/functions/__init__.py +72 -55
  252. classiq/qmod/builtins/functions/amplitude_estimation.py +4 -1
  253. classiq/qmod/builtins/functions/arithmetic.py +14 -1
  254. classiq/qmod/builtins/functions/discrete_sine_cosine_transform.py +86 -6
  255. classiq/qmod/builtins/functions/grover.py +41 -45
  256. classiq/qmod/builtins/functions/hea.py +60 -4
  257. classiq/qmod/builtins/functions/linear_pauli_rotation.py +26 -4
  258. classiq/qmod/builtins/functions/modular_exponentiation.py +90 -29
  259. classiq/qmod/builtins/functions/operators.py +1 -1
  260. classiq/qmod/builtins/functions/qaoa_penalty.py +14 -5
  261. classiq/qmod/builtins/functions/qft_functions.py +57 -0
  262. classiq/qmod/builtins/functions/qpe.py +20 -4
  263. classiq/qmod/builtins/functions/qsvt.py +49 -4
  264. classiq/qmod/builtins/functions/standard_gates.py +4 -4
  265. classiq/qmod/builtins/functions/state_preparation.py +92 -10
  266. classiq/qmod/builtins/functions/swap_test.py +7 -1
  267. classiq/qmod/builtins/functions/utility_functions.py +43 -0
  268. classiq/qmod/builtins/functions/variational.py +18 -2
  269. classiq/qmod/builtins/operations.py +117 -22
  270. classiq/qmod/cfunc.py +2 -2
  271. classiq/qmod/classical_function.py +3 -7
  272. classiq/qmod/create_model_function.py +16 -17
  273. classiq/qmod/declaration_inferrer.py +7 -10
  274. classiq/qmod/expression_query.py +3 -3
  275. classiq/qmod/generative.py +2 -1
  276. classiq/qmod/model_state_container.py +10 -8
  277. classiq/qmod/native/__init__.py +1 -3
  278. classiq/qmod/native/expression_to_qmod.py +9 -8
  279. classiq/qmod/native/pretty_printer.py +12 -6
  280. classiq/qmod/pretty_print/__init__.py +1 -3
  281. classiq/qmod/pretty_print/expression_to_python.py +13 -12
  282. classiq/qmod/pretty_print/pretty_printer.py +38 -23
  283. classiq/qmod/python_classical_type.py +8 -4
  284. classiq/qmod/qfunc.py +4 -4
  285. classiq/qmod/qmod_variable.py +11 -10
  286. classiq/qmod/quantum_expandable.py +12 -15
  287. classiq/qmod/quantum_function.py +35 -22
  288. classiq/qmod/semantics/annotation.py +1 -1
  289. classiq/qmod/semantics/error_manager.py +8 -7
  290. classiq/qmod/semantics/static_semantics_visitor.py +19 -24
  291. classiq/qmod/semantics/validation/constants_validation.py +1 -1
  292. classiq/qmod/semantics/validation/func_call_validation.py +2 -2
  293. classiq/qmod/semantics/validation/main_validation.py +33 -0
  294. classiq/qmod/semantics/validation/types_validation.py +2 -1
  295. classiq/qmod/symbolic.py +5 -8
  296. classiq/qmod/symbolic_type.py +2 -2
  297. classiq/qmod/synthesize_separately.py +1 -2
  298. {classiq-0.53.0.dist-info → classiq-0.55.0.dist-info}/METADATA +1 -1
  299. {classiq-0.53.0.dist-info → classiq-0.55.0.dist-info}/RECORD +300 -297
  300. classiq/qmod/builtins/functions/qft.py +0 -23
  301. {classiq-0.53.0.dist-info → classiq-0.55.0.dist-info}/WHEEL +0 -0
@@ -1,17 +1,15 @@
1
1
  import abc
2
2
  import sys
3
+ from collections.abc import Iterator, Mapping
3
4
  from contextlib import contextmanager
4
5
  from typing import ( # type: ignore[attr-defined]
5
6
  TYPE_CHECKING,
7
+ Annotated,
6
8
  Any,
7
9
  ForwardRef,
8
10
  Generic,
9
- Iterator,
10
11
  Literal,
11
- Mapping,
12
12
  Optional,
13
- Tuple,
14
- Type,
15
13
  TypeVar,
16
14
  Union,
17
15
  _GenericAlias,
@@ -20,7 +18,7 @@ from typing import ( # type: ignore[attr-defined]
20
18
  get_origin,
21
19
  )
22
20
 
23
- from typing_extensions import Annotated, ParamSpec, Self, _AnnotatedAlias
21
+ from typing_extensions import ParamSpec, Self, _AnnotatedAlias
24
22
 
25
23
  from classiq.interface.exceptions import ClassiqValueError
26
24
  from classiq.interface.generator.expressions.expression import Expression
@@ -127,7 +125,7 @@ class QVar(Symbolic):
127
125
  raise NotImplementedError()
128
126
 
129
127
  @staticmethod
130
- def from_type_hint(type_hint: Any) -> Optional[Type["QVar"]]:
128
+ def from_type_hint(type_hint: Any) -> Optional[type["QVar"]]:
131
129
  if _is_input_output_typehint(type_hint):
132
130
  return QVar.from_type_hint(type_hint.__args__[0])
133
131
  type_ = get_origin(type_hint) or type_hint
@@ -322,7 +320,7 @@ class QNum(Generic[_P], QScalar):
322
320
  super().__init__(name, _expr_str=_expr_str, depth=3)
323
321
 
324
322
  @classmethod
325
- def _get_attributes(cls, type_hint: Any) -> Tuple[Any, Any, Any]:
323
+ def _get_attributes(cls, type_hint: Any) -> tuple[Any, Any, Any]:
326
324
  type_args = version_portable_get_args(type_hint)
327
325
  if len(type_args) == 0:
328
326
  return None, None, None
@@ -413,6 +411,9 @@ class QArray(ArrayBase[_P], QVar):
413
411
  self._get_slice(key) if isinstance(key, slice) else self._get_subscript(key)
414
412
  )
415
413
 
414
+ def __setitem__(self, *args: Any) -> None:
415
+ pass
416
+
416
417
  def _get_subscript(self, index: Union[slice, int, SymbolicExpr]) -> Any:
417
418
  if isinstance(index, SymbolicExpr) and index.is_quantum:
418
419
  raise ClassiqValueError("Non-classical parameter for slicing")
@@ -492,7 +493,7 @@ class QArray(ArrayBase[_P], QVar):
492
493
  return CParamScalar(f"get_field({self}, 'len')")
493
494
 
494
495
  @classmethod
495
- def _get_attributes(cls, type_hint: Any) -> Tuple[Type[QVar], Any]:
496
+ def _get_attributes(cls, type_hint: Any) -> tuple[type[QVar], Any]:
496
497
  type_args = version_portable_get_args(type_hint)
497
498
  if len(type_args) == 0:
498
499
  return QBit, None
@@ -505,7 +506,7 @@ class QArray(ArrayBase[_P], QVar):
505
506
  "QArray receives two type arguments: QArray[element_type: QVar, "
506
507
  "length: int | CInt]"
507
508
  )
508
- return cast(Tuple[Type[QVar], Any], type_args)
509
+ return cast(tuple[type[QVar], Any], type_args)
509
510
 
510
511
  @classmethod
511
512
  def to_qmod_quantum_type(cls, type_hint: Any) -> QuantumType:
@@ -597,7 +598,7 @@ class QStruct(QVar):
597
598
  base_handle = HandleBinding(name=origin) if isinstance(origin, str) else origin
598
599
  with _no_current_expandable():
599
600
  field_vars = {
600
- field_name: cast(Type[QVar], field_class).to_qvar(
601
+ field_name: cast(type[QVar], field_class).to_qvar(
601
602
  FieldHandleBinding(base_handle=base_handle, field=field_name),
602
603
  field_type,
603
604
  f"get_field({expr_str if expr_str is not None else str(origin)}, '{field_name}')",
@@ -9,10 +9,7 @@ from typing import (
9
9
  Any,
10
10
  Callable,
11
11
  ClassVar,
12
- Dict,
13
- List,
14
12
  Optional,
15
- Type,
16
13
  Union,
17
14
  cast,
18
15
  overload,
@@ -74,15 +71,15 @@ ArgType = Union[CParam, QVar, QCallable]
74
71
 
75
72
 
76
73
  class QExpandable(QCallable, QExpandableInterface, ABC):
77
- STACK: ClassVar[List["QExpandable"]] = list()
74
+ STACK: ClassVar[list["QExpandable"]] = list()
78
75
 
79
76
  def __init__(self, py_callable: Callable) -> None:
80
77
  self._qmodule: ModelStateContainer = QMODULE
81
78
  self._py_callable: Callable = py_callable
82
- self._body: List[QuantumStatement] = list()
79
+ self._body: list[QuantumStatement] = list()
83
80
 
84
81
  @property
85
- def body(self) -> List[QuantumStatement]:
82
+ def body(self) -> list[QuantumStatement]:
86
83
  return self._body
87
84
 
88
85
  def __enter__(self) -> Self:
@@ -93,7 +90,7 @@ class QExpandable(QCallable, QExpandableInterface, ABC):
93
90
 
94
91
  def __exit__(
95
92
  self,
96
- exc_type: Optional[Type[BaseException]],
93
+ exc_type: Optional[type[BaseException]],
97
94
  exc_val: Optional[BaseException],
98
95
  exc_tb: Optional[TracebackType],
99
96
  ) -> None:
@@ -107,7 +104,7 @@ class QExpandable(QCallable, QExpandableInterface, ABC):
107
104
  with self, generative_mode_context(False):
108
105
  self._py_callable(*self._get_positional_args())
109
106
 
110
- def infer_rename_params(self) -> Optional[List[str]]:
107
+ def infer_rename_params(self) -> Optional[list[str]]:
111
108
  return None
112
109
 
113
110
  def add_local_handle(
@@ -125,8 +122,8 @@ class QExpandable(QCallable, QExpandableInterface, ABC):
125
122
  def append_statement_to_body(self, stmt: QuantumStatement) -> None:
126
123
  self._body.append(stmt)
127
124
 
128
- def _get_positional_args(self) -> List[ArgType]:
129
- result: List[ArgType] = []
125
+ def _get_positional_args(self) -> list[ArgType]:
126
+ result: list[ArgType] = []
130
127
  rename_params = self.infer_rename_params()
131
128
  if rename_params is not None and len(rename_params) != len(
132
129
  self.func_decl.positional_arg_declarations
@@ -179,7 +176,7 @@ class QLambdaFunction(QExpandable):
179
176
  if not is_generative_mode():
180
177
  super().expand()
181
178
 
182
- def infer_rename_params(self) -> List[str]:
179
+ def infer_rename_params(self) -> list[str]:
183
180
  return inspect.getfullargspec(self._py_callable).args
184
181
 
185
182
 
@@ -313,7 +310,7 @@ def prepare_arg(
313
310
  f"Quantum operand {param_name!r} cannot be initialized with a "
314
311
  f"list of non-callables"
315
312
  )
316
- val = cast(List[Union[QCallable, Callable[[Any], None]]], val)
313
+ val = cast(list[Union[QCallable, Callable[[Any], None]]], val)
317
314
  return [prepare_arg(arg_decl, v, func_name, param_name) for v in val]
318
315
 
319
316
  if not isinstance(val, QCallable):
@@ -391,8 +388,8 @@ def _get_operand_hint(
391
388
 
392
389
 
393
390
  def _prepare_args(
394
- decl: AnonQuantumFunctionDeclaration, arg_list: List[Any], kwargs: Dict[str, Any]
395
- ) -> List[ArgValue]:
391
+ decl: AnonQuantumFunctionDeclaration, arg_list: list[Any], kwargs: dict[str, Any]
392
+ ) -> list[ArgValue]:
396
393
  _apply_control_backward_compatibility(decl, kwargs)
397
394
  result = []
398
395
  for idx, arg_decl in enumerate(decl.positional_arg_declarations):
@@ -417,7 +414,7 @@ def _prepare_args(
417
414
 
418
415
 
419
416
  def _apply_control_backward_compatibility(
420
- decl: AnonQuantumFunctionDeclaration, kwargs: Dict[str, Any]
417
+ decl: AnonQuantumFunctionDeclaration, kwargs: dict[str, Any]
421
418
  ) -> None:
422
419
  from classiq.qmod.builtins.functions import __all__ as builtin_functions
423
420
 
@@ -3,15 +3,15 @@ import functools
3
3
  from dataclasses import is_dataclass
4
4
  from enum import EnumMeta
5
5
  from inspect import isclass
6
- from typing import Any, Callable, Dict, List, Optional, Tuple, get_origin
6
+ from typing import Any, Callable, Optional, get_origin
7
7
 
8
8
  from classiq.interface.exceptions import ClassiqError
9
9
  from classiq.interface.executor.execution_preferences import ExecutionPreferences
10
10
  from classiq.interface.generator.model.constraints import Constraints
11
11
  from classiq.interface.generator.model.preferences.preferences import Preferences
12
+ from classiq.interface.generator.types.compilation_metadata import CompilationMetadata
12
13
  from classiq.interface.model.model import Model
13
14
  from classiq.interface.model.native_function_definition import (
14
- FunctionSynthesisData,
15
15
  NativeFunctionDefinition,
16
16
  )
17
17
  from classiq.interface.model.quantum_function_declaration import (
@@ -35,7 +35,7 @@ class QFunc(QExpandable):
35
35
  _validate_no_gen_params(py_callable.__annotations__)
36
36
  super().__init__(py_callable)
37
37
  functools.update_wrapper(self, py_callable)
38
- self._synthesis_data: Optional[FunctionSynthesisData] = None
38
+ self.compilation_metadata: Optional[CompilationMetadata] = None
39
39
 
40
40
  @property
41
41
  def func_decl(self) -> NamedParamsQuantumFunctionDeclaration:
@@ -45,12 +45,19 @@ class QFunc(QExpandable):
45
45
  )
46
46
 
47
47
  @property
48
- def synthesis_data(self) -> Optional[FunctionSynthesisData]:
49
- return self._synthesis_data
50
-
51
- @synthesis_data.setter
52
- def synthesis_data(self, value: FunctionSynthesisData) -> None:
53
- self._synthesis_data = value
48
+ def should_synthesize_separately(self) -> bool:
49
+ if self.compilation_metadata is None:
50
+ return False
51
+ return self.compilation_metadata.should_synthesize_separately
52
+
53
+ @should_synthesize_separately.setter
54
+ def should_synthesize_separately(self, value: bool) -> None:
55
+ if self.compilation_metadata is None:
56
+ self.compilation_metadata = CompilationMetadata(
57
+ should_synthesize_separately=value
58
+ )
59
+ else:
60
+ self.compilation_metadata.should_synthesize_separately = value
54
61
 
55
62
  def __call__(self, *args: Any, **kwargs: Any) -> None:
56
63
  super().__call__(*args, **kwargs)
@@ -62,15 +69,19 @@ class QFunc(QExpandable):
62
69
  execution_preferences: Optional[ExecutionPreferences] = None,
63
70
  preferences: Optional[Preferences] = None,
64
71
  classical_execution_function: Optional[CFunc] = None,
72
+ functions_compilation_metadata: Optional[dict[str, CompilationMetadata]] = None,
65
73
  ) -> Model:
74
+ if functions_compilation_metadata is None:
75
+ functions_compilation_metadata = dict()
66
76
  self._qmodule.enum_decls = dict()
67
77
  self._qmodule.type_decls = dict()
68
78
  self._qmodule.qstruct_decls = dict()
69
79
  self._qmodule.native_defs = dict()
70
80
  self._qmodule.constants = dict()
81
+ self._qmodule.functions_compilation_metadata = functions_compilation_metadata
71
82
  QConstant.set_current_model(self._qmodule)
72
83
  self.expand()
73
- model_extra_settings: List[Tuple[str, Any]] = [
84
+ model_extra_settings: list[tuple[str, Any]] = [
74
85
  ("constraints", constraints),
75
86
  ("execution_preferences", execution_preferences),
76
87
  ("preferences", preferences),
@@ -86,6 +97,7 @@ class QFunc(QExpandable):
86
97
  enums=list(self._qmodule.enum_decls.values()),
87
98
  types=list(self._qmodule.type_decls.values()),
88
99
  qstructs=list(self._qmodule.qstruct_decls.values()),
100
+ functions_compilation_metadata=self._qmodule.functions_compilation_metadata,
89
101
  **{key: value for key, value in model_extra_settings if value},
90
102
  )
91
103
 
@@ -94,18 +106,12 @@ class QFunc(QExpandable):
94
106
  return
95
107
  super().expand()
96
108
  self._qmodule.native_defs[self.func_decl.name] = NativeFunctionDefinition(
97
- **{
98
- **self.func_decl.model_dump(),
99
- **{
100
- "body": self.body,
101
- "synthesis_data": (
102
- self.synthesis_data
103
- if self.synthesis_data is not None
104
- else FunctionSynthesisData()
105
- ),
106
- },
107
- },
109
+ **{**self.func_decl.model_dump(), **{"body": self.body}}
108
110
  )
111
+ if self.compilation_metadata is not None:
112
+ self._qmodule.functions_compilation_metadata[self.func_decl.name] = (
113
+ self.compilation_metadata
114
+ )
109
115
 
110
116
  def _add_constants_from_classical_code(
111
117
  self, classical_execution_function: CFunc
@@ -137,6 +143,7 @@ class ExternalQFunc(QTerminalCallable):
137
143
  _decl: NamedParamsQuantumFunctionDeclaration
138
144
 
139
145
  def __init__(self, py_callable: Callable) -> None:
146
+ self._py_callable = py_callable
140
147
  decl = infer_func_decl(py_callable)
141
148
 
142
149
  py_callable.__annotations__.pop("return", None)
@@ -153,6 +160,12 @@ class ExternalQFunc(QTerminalCallable):
153
160
  def func_decl(self) -> NamedParamsQuantumFunctionDeclaration:
154
161
  return self._decl
155
162
 
163
+ def get_implementation(self) -> NativeFunctionDefinition:
164
+ model = QFunc(self._py_callable).create_model()
165
+ return [
166
+ func for func in model.functions if func.name == self._py_callable.__name__
167
+ ][0]
168
+
156
169
 
157
170
  class GenerativeQFunc(QExpandable):
158
171
  def __init__(
@@ -183,7 +196,7 @@ class IllegalParamsError(ClassiqError):
183
196
  super().__init__(message + self._HINT)
184
197
 
185
198
 
186
- def _validate_no_gen_params(annotations: Dict[str, Any]) -> None:
199
+ def _validate_no_gen_params(annotations: dict[str, Any]) -> None:
187
200
  _illegal_params = {
188
201
  name: annotation
189
202
  for name, annotation in annotations.items()
@@ -1,4 +1,4 @@
1
- from typing import Mapping
1
+ from collections.abc import Mapping
2
2
 
3
3
  from classiq.interface.exceptions import ClassiqError
4
4
  from classiq.interface.model.quantum_function_call import QuantumFunctionCall
@@ -1,5 +1,6 @@
1
+ from collections.abc import Iterator
1
2
  from contextlib import contextmanager
2
- from typing import Iterator, List, Optional, Type
3
+ from typing import Optional
3
4
 
4
5
  from classiq.interface.ast_node import ASTNode
5
6
  from classiq.interface.exceptions import CLASSIQ_SLACK_COMMUNITY_LINK
@@ -16,9 +17,9 @@ class ErrorManager:
16
17
  if hasattr(self, "_instantiated"):
17
18
  return
18
19
  self._instantiated = True
19
- self._errors: List[SourceReferencedError] = []
20
- self._current_nodes_stack: List[ASTNode] = []
21
- self._call_stack: List[str] = []
20
+ self._errors: list[SourceReferencedError] = []
21
+ self._current_nodes_stack: list[ASTNode] = []
22
+ self._call_stack: list[str] = []
22
23
  self._ignore_errors: bool = False
23
24
 
24
25
  @contextmanager
@@ -31,7 +32,7 @@ class ErrorManager:
31
32
  self._ignore_errors = previous
32
33
 
33
34
  @property
34
- def annotated_errors(self) -> List[str]:
35
+ def annotated_errors(self) -> list[str]:
35
36
  return [str(error) for error in self._errors]
36
37
 
37
38
  def add_error(self, error: str) -> None:
@@ -48,7 +49,7 @@ class ErrorManager:
48
49
  )
49
50
  )
50
51
 
51
- def get_errors(self) -> List[SourceReferencedError]:
52
+ def get_errors(self) -> list[SourceReferencedError]:
52
53
  return self._errors
53
54
 
54
55
  def clear(self) -> None:
@@ -58,7 +59,7 @@ class ErrorManager:
58
59
  def has_errors(self) -> bool:
59
60
  return len(self._errors) > 0
60
61
 
61
- def report_errors(self, error_type: Type[Exception]) -> None:
62
+ def report_errors(self, error_type: type[Exception]) -> None:
62
63
  if self.has_errors():
63
64
  errors = self.annotated_errors
64
65
  self.clear()
@@ -1,15 +1,8 @@
1
+ from collections.abc import Iterator, Mapping, Sequence
1
2
  from contextlib import contextmanager
2
3
  from typing import (
3
4
  Any,
4
- Dict,
5
- Iterator,
6
- List,
7
- Mapping,
8
5
  Optional,
9
- Sequence,
10
- Set,
11
- Tuple,
12
- Type,
13
6
  )
14
7
 
15
8
  from classiq.interface.exceptions import ClassiqSemanticError
@@ -59,6 +52,7 @@ from classiq.qmod.semantics.validation.func_call_validation import (
59
52
  validate_call_arguments,
60
53
  )
61
54
  from classiq.qmod.semantics.validation.handle_validation import resolve_handle
55
+ from classiq.qmod.semantics.validation.main_validation import validate_main_function
62
56
  from classiq.qmod.semantics.validation.types_validation import (
63
57
  check_cstruct_has_fields,
64
58
  check_duplicate_types,
@@ -79,10 +73,10 @@ class StaticScope:
79
73
 
80
74
  def __init__(
81
75
  self,
82
- parameters: List[str],
83
- operands: Dict[str, QuantumOperandDeclaration],
84
- variables_to_states: Dict[str, HandleState],
85
- variables_to_types: Dict[str, ConcreteQuantumType],
76
+ parameters: list[str],
77
+ operands: dict[str, QuantumOperandDeclaration],
78
+ variables_to_states: dict[str, HandleState],
79
+ variables_to_types: dict[str, ConcreteQuantumType],
86
80
  ) -> None:
87
81
  self.parameters = parameters
88
82
  self.operands = operands
@@ -94,9 +88,9 @@ class StaticSemanticsVisitor(Visitor):
94
88
  def __init__(
95
89
  self,
96
90
  functions_dict: Mapping[str, QuantumFunctionDeclaration],
97
- constants: List[str],
91
+ constants: list[str],
98
92
  ) -> None:
99
- self._scope: List[StaticScope] = []
93
+ self._scope: list[StaticScope] = []
100
94
  self._error_manager = ErrorManager()
101
95
  self._functions_dict = functions_dict
102
96
  self._constants = constants
@@ -122,6 +116,7 @@ class StaticSemanticsVisitor(Visitor):
122
116
  check_qstruct_flexibility(qstruct)
123
117
  for cstruct in model.types:
124
118
  check_cstruct_has_fields(cstruct)
119
+ validate_main_function(model.main_func)
125
120
  self.visit_BaseModel(model)
126
121
 
127
122
  def visit_NativeFunctionDefinition(
@@ -141,7 +136,7 @@ class StaticSemanticsVisitor(Visitor):
141
136
  parameter_declaration_names = [
142
137
  decl.name for decl in func_def.positional_arg_declarations
143
138
  ]
144
- seen_names: Set[str] = set()
139
+ seen_names: set[str] = set()
145
140
  for name in parameter_declaration_names:
146
141
  if name in seen_names:
147
142
  self._error_manager.add_error(
@@ -254,12 +249,12 @@ class StaticSemanticsVisitor(Visitor):
254
249
 
255
250
  def _get_renamed_parameters(
256
251
  self, lambda_func: QuantumLambdaFunction
257
- ) -> Tuple[List[str], Dict[str, QuantumOperandDeclaration], List[PortDeclaration]]:
258
- renamed_parameters: List[str] = []
259
- renamed_operands: Dict[str, QuantumOperandDeclaration] = {}
260
- renamed_ports: List[PortDeclaration] = []
252
+ ) -> tuple[list[str], dict[str, QuantumOperandDeclaration], list[PortDeclaration]]:
253
+ renamed_parameters: list[str] = []
254
+ renamed_operands: dict[str, QuantumOperandDeclaration] = {}
255
+ renamed_ports: list[PortDeclaration] = []
261
256
  for idx, param in enumerate(lambda_func.func_decl.positional_arg_declarations):
262
- param_name = lambda_func.get_rename_params()[idx]
257
+ param_name = lambda_func.pos_rename_params[idx]
263
258
  if isinstance(param, AnonClassicalParameterDeclaration):
264
259
  renamed_parameters.append(param_name)
265
260
  elif isinstance(param, AnonQuantumOperandDeclaration):
@@ -375,7 +370,7 @@ def resolve_function_calls(
375
370
 
376
371
 
377
372
  def static_semantics_analysis_pass(
378
- model: Model, error_type: Optional[Type[Exception]] = ClassiqSemanticError
373
+ model: Model, error_type: Optional[type[Exception]] = ClassiqSemanticError
379
374
  ) -> None:
380
375
  StaticSemanticsVisitor(
381
376
  {**BUILTIN_FUNCTION_DECLARATIONS, **model.function_dict},
@@ -385,7 +380,7 @@ def static_semantics_analysis_pass(
385
380
  ErrorManager().report_errors(error_type)
386
381
 
387
382
 
388
- EXPECTED_TERMINAL_STATES: Dict[PortDeclarationDirection, HandleState] = {
383
+ EXPECTED_TERMINAL_STATES: dict[PortDeclarationDirection, HandleState] = {
389
384
  PortDeclarationDirection.Output: HandleState.INITIALIZED,
390
385
  PortDeclarationDirection.Inout: HandleState.INITIALIZED,
391
386
  }
@@ -393,8 +388,8 @@ EXPECTED_TERMINAL_STATES: Dict[PortDeclarationDirection, HandleState] = {
393
388
 
394
389
  def initialize_variables_to_state(
395
390
  port_declarations: Sequence[PortDeclaration],
396
- ) -> Dict[str, HandleState]:
397
- variables_to_state: Dict[str, HandleState] = dict()
391
+ ) -> dict[str, HandleState]:
392
+ variables_to_state: dict[str, HandleState] = dict()
398
393
 
399
394
  for port_decl in port_declarations:
400
395
  variables_to_state[port_decl.name] = (
@@ -1,4 +1,4 @@
1
- from typing import Sequence
1
+ from collections.abc import Sequence
2
2
 
3
3
  from classiq.interface.generator.constant import Constant
4
4
 
@@ -1,4 +1,4 @@
1
- from typing import List, Mapping
1
+ from collections.abc import Mapping
2
2
 
3
3
  from classiq.interface.exceptions import ClassiqError
4
4
  from classiq.interface.generator.expressions.expression import Expression
@@ -83,7 +83,7 @@ def _check_operand_against_declaration(
83
83
 
84
84
 
85
85
  def check_no_overlapping_quantum_args(
86
- args: List[HandleBinding], func_name: str
86
+ args: list[HandleBinding], func_name: str
87
87
  ) -> None:
88
88
  for idx, arg in enumerate(args):
89
89
  for other_arg in args[idx + 1 :]:
@@ -0,0 +1,33 @@
1
+ from classiq.interface.generator.functions.classical_type import (
2
+ ClassicalArray,
3
+ ClassicalList,
4
+ )
5
+ from classiq.interface.generator.functions.concrete_types import ConcreteClassicalType
6
+ from classiq.interface.model.native_function_definition import NativeFunctionDefinition
7
+ from classiq.interface.model.quantum_function_declaration import PositionalArg
8
+
9
+ from classiq import ClassicalParameterDeclaration
10
+ from classiq.qmod.semantics.error_manager import append_error
11
+
12
+
13
+ def validate_main_function(func: NativeFunctionDefinition) -> None:
14
+ for param in func.positional_arg_declarations:
15
+ _validate_main_param(param)
16
+
17
+
18
+ def _validate_main_param(param: PositionalArg) -> None:
19
+ if isinstance(param, ClassicalParameterDeclaration):
20
+ _validate_main_classical_param_type(param.classical_type, param.name)
21
+
22
+
23
+ def _validate_main_classical_param_type(
24
+ param: ConcreteClassicalType, param_name: str
25
+ ) -> None:
26
+ if isinstance(param, ClassicalList):
27
+ append_error(
28
+ param,
29
+ f"Classical array parameter {param_name!r} of function 'main' must must "
30
+ f"specify array length",
31
+ )
32
+ if isinstance(param, ClassicalArray):
33
+ _validate_main_classical_param_type(param.element_type, param_name)
@@ -1,4 +1,5 @@
1
- from typing import Sequence, Union
1
+ from collections.abc import Sequence
2
+ from typing import Union
2
3
 
3
4
  from classiq.interface.generator.functions.type_name import TypeName
4
5
  from classiq.interface.generator.types.enum_declaration import EnumDeclaration
classiq/qmod/symbolic.py CHANGED
@@ -2,10 +2,7 @@ import sys
2
2
  from typing import (
3
3
  TYPE_CHECKING,
4
4
  Any,
5
- List,
6
5
  Optional,
7
- Tuple,
8
- Type,
9
6
  TypeVar,
10
7
  Union,
11
8
  overload,
@@ -41,10 +38,10 @@ def symbolic_function(*args: Any, return_type: None = None) -> CParamScalar: ...
41
38
 
42
39
 
43
40
  @overload
44
- def symbolic_function(*args: Any, return_type: Type[T]) -> T: ...
41
+ def symbolic_function(*args: Any, return_type: type[T]) -> T: ...
45
42
 
46
43
 
47
- def symbolic_function(*args: Any, return_type: Optional[Type[T]] = None) -> CParam:
44
+ def symbolic_function(*args: Any, return_type: Optional[type[T]] = None) -> CParam:
48
45
  qmodule = (
49
46
  model_state_container.QMODULE
50
47
  ) # FIXME: https://classiq.atlassian.net/browse/CAD-15126
@@ -266,7 +263,7 @@ def catalan(x: SymbolicTypes) -> CParamScalar:
266
263
  return symbolic_function(x)
267
264
 
268
265
 
269
- def Piecewise(*args: Tuple[SymbolicTypes, SymbolicTypes]) -> CParamScalar: # noqa: N802
266
+ def Piecewise(*args: tuple[SymbolicTypes, SymbolicTypes]) -> CParamScalar: # noqa: N802
270
267
  return symbolic_function(*args)
271
268
 
272
269
 
@@ -299,7 +296,7 @@ def sum(arr: SymbolicTypes) -> CParamScalar:
299
296
 
300
297
 
301
298
  def subscript(
302
- amplitudes: Union[List[float], List[CReal], List[CParamScalar], CArray[CReal]],
299
+ amplitudes: Union[list[float], list[CReal], list[CParamScalar], CArray[CReal]],
303
300
  index: QNum,
304
301
  ) -> CParamScalar:
305
302
  return CParamScalar(expr=f"{amplitudes}[{index}]")
@@ -373,5 +370,5 @@ __all__ = [
373
370
  ]
374
371
 
375
372
 
376
- def __dir__() -> List[str]:
373
+ def __dir__() -> list[str]:
377
374
  return __all__
@@ -1,5 +1,5 @@
1
- from typing import Tuple, Union
1
+ from typing import Union
2
2
 
3
3
  from classiq.qmod.symbolic_expr import SymbolicExpr
4
4
 
5
- SymbolicTypes = Union[SymbolicExpr, int, float, bool, Tuple["SymbolicTypes", ...]]
5
+ SymbolicTypes = Union[SymbolicExpr, int, float, bool, tuple["SymbolicTypes", ...]]
@@ -1,14 +1,13 @@
1
1
  from typing import Union
2
2
 
3
3
  from classiq.interface.exceptions import ClassiqError
4
- from classiq.interface.model.native_function_definition import FunctionSynthesisData
5
4
 
6
5
  from classiq.qmod.quantum_function import ExternalQFunc, GenerativeQFunc, QFunc
7
6
 
8
7
 
9
8
  def synthesize_separately(qfunc: Union[QFunc, GenerativeQFunc, ExternalQFunc]) -> QFunc:
10
9
  if isinstance(qfunc, QFunc):
11
- qfunc.synthesis_data = FunctionSynthesisData(should_synthesize_separately=True)
10
+ qfunc.should_synthesize_separately = True
12
11
  return qfunc
13
12
  if isinstance(qfunc, GenerativeQFunc):
14
13
  raise ClassiqError("Generative functions can not be synthesized separately")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: classiq
3
- Version: 0.53.0
3
+ Version: 0.55.0
4
4
  Summary: Classiq's Python SDK for quantum computing
5
5
  Home-page: https://classiq.io
6
6
  License: Proprietary