classiq 0.48.0__py3-none-any.whl → 0.48.1__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.
@@ -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.48.0'
6
+ SEMVER_VERSION = '0.48.1'
7
7
  VERSION = str(Version(SEMVER_VERSION))
@@ -34,24 +34,28 @@ class ArithmeticOperation(QuantumAssignmentOperation):
34
34
  )
35
35
 
36
36
  operation_kind: ArithmeticOperationKind = pydantic.Field(
37
- default=ArithmeticOperationKind.InplaceXor,
37
+ default=None,
38
38
  )
39
39
 
40
+ @pydantic.validator("operation_kind", always=True)
41
+ def _propagate_inplace_result(
42
+ cls, operation_kind: Optional[ArithmeticOperationKind], values: dict
43
+ ) -> ArithmeticOperationKind:
44
+ if operation_kind is None:
45
+ operation_kind = (
46
+ ArithmeticOperationKind.InplaceXor
47
+ if values["inplace_result"]
48
+ else ArithmeticOperationKind.Assignment
49
+ )
50
+ return operation_kind
51
+
40
52
  @property
41
53
  def is_inplace(self) -> bool:
42
- return self.get_operation_kind() in (
54
+ return self.operation_kind in (
43
55
  ArithmeticOperationKind.InplaceXor,
44
56
  ArithmeticOperationKind.InplaceAdd,
45
57
  )
46
58
 
47
- def get_operation_kind(self) -> ArithmeticOperationKind:
48
- if hasattr(self, "inplace_result"):
49
- if self.inplace_result is False:
50
- return ArithmeticOperationKind.Assignment
51
- if self.inplace_result is True:
52
- return ArithmeticOperationKind.InplaceXor
53
- return self.operation_kind
54
-
55
59
  def initialize_var_types(
56
60
  self,
57
61
  var_types: Dict[str, QuantumType],
@@ -152,15 +152,11 @@ def _build_inplace_binary_operation(
152
152
  *target_bind_ops,
153
153
  *value_bind_ops,
154
154
  *value_pad_pre_bind_ops,
155
+ *value_pad_init_ops,
156
+ *value_post_bind_ops,
155
157
  ],
156
158
  action=[
157
- *value_pad_init_ops,
158
- WithinApply(
159
- compute=[
160
- *value_post_bind_ops,
161
- ],
162
- action=[op_call],
163
- ),
159
+ op_call,
164
160
  ],
165
161
  ),
166
162
  ]
@@ -71,7 +71,7 @@ class QuantumAssignmentOperationEmitter(
71
71
  def _emit_inplace_arithmetic_op(
72
72
  self, op: ArithmeticOperation, expression: Expression, is_bool_opt: bool
73
73
  ) -> None:
74
- if op.get_operation_kind() != ArithmeticOperationKind.InplaceXor or (
74
+ if op.operation_kind != ArithmeticOperationKind.InplaceXor or (
75
75
  op.result_type.size_in_bits > 1 or not _is_res_boolean(op)
76
76
  ):
77
77
  _validate_naive_inplace_handles(op)
@@ -105,7 +105,7 @@ class QuantumAssignmentOperationEmitter(
105
105
  ) -> Tuple[ArithmeticOperation, Expression, bool]:
106
106
  if (
107
107
  self._interpreter._is_frontend
108
- or op.get_operation_kind()
108
+ or op.operation_kind
109
109
  not in (
110
110
  ArithmeticOperationKind.Assignment,
111
111
  ArithmeticOperationKind.InplaceXor,
@@ -143,7 +143,7 @@ class QuantumAssignmentOperationEmitter(
143
143
  expression=new_expression,
144
144
  operation_kind=ArithmeticOperationKind.Assignment,
145
145
  )
146
- if qe.get_operation_kind() == ArithmeticOperationKind.InplaceXor:
146
+ if qe.operation_kind == ArithmeticOperationKind.InplaceXor:
147
147
  op = BinaryOperation.Xor
148
148
  else:
149
149
  op = BinaryOperation.Addition
@@ -345,9 +345,9 @@ class DSLPrettyPrinter(Visitor):
345
345
  return f"{self.visit(var_ref.base_handle)}.{self.visit(var_ref.field)}"
346
346
 
347
347
  def visit_ArithmeticOperation(self, arith_op: ArithmeticOperation) -> str:
348
- if arith_op.get_operation_kind() == ArithmeticOperationKind.Assignment:
348
+ if arith_op.operation_kind == ArithmeticOperationKind.Assignment:
349
349
  op = "="
350
- elif arith_op.get_operation_kind() == ArithmeticOperationKind.InplaceXor:
350
+ elif arith_op.operation_kind == ArithmeticOperationKind.InplaceXor:
351
351
  op = "^="
352
352
  else:
353
353
  op = "+="
@@ -469,9 +469,9 @@ class PythonPrettyPrinter(Visitor):
469
469
  return f"{self.visit(var_ref.base_handle)}.{self.visit(var_ref.field)}"
470
470
 
471
471
  def visit_ArithmeticOperation(self, arith_op: ArithmeticOperation) -> str:
472
- if arith_op.get_operation_kind() == ArithmeticOperationKind.Assignment:
472
+ if arith_op.operation_kind == ArithmeticOperationKind.Assignment:
473
473
  op = "|="
474
- elif arith_op.get_operation_kind() == ArithmeticOperationKind.InplaceXor:
474
+ elif arith_op.operation_kind == ArithmeticOperationKind.InplaceXor:
475
475
  op = "^="
476
476
  else:
477
477
  op = "+="
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: classiq
3
- Version: 0.48.0
3
+ Version: 0.48.1
4
4
  Summary: Classiq's Python SDK for quantum computing
5
5
  Home-page: https://classiq.io
6
6
  License: Proprietary
@@ -93,7 +93,7 @@ classiq/execution/jobs.py,sha256=t7Wdegpi6lylthg23a98rSmoZ8xXNGfz--efHYw39JY,956
93
93
  classiq/execution/qnn.py,sha256=qsOA2mD8Ne_4VwvyGPfuHVDTzyxVnDHwE2gfoaOMsf8,2339
94
94
  classiq/executor.py,sha256=jKD5O_tJpL2NMTC_N0NEuPJEmKZIaqsTpQrgZ88sleg,2594
95
95
  classiq/interface/__init__.py,sha256=cg7hD_XVu1_jJ1fgwmT0rMIoZHopNVeB8xtlmMx-E_A,83
96
- classiq/interface/_version.py,sha256=vK6DuSdhhyiaz7vVMCdZUXqVEX6JjpArpmU3wGys474,197
96
+ classiq/interface/_version.py,sha256=S41xdanANzq1eRMwHrwqVfplS3dXkiqYaEvMTxElQOg,197
97
97
  classiq/interface/analyzer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
98
98
  classiq/interface/analyzer/analysis_params.py,sha256=043hfS-I3Ec6tkcniKMQQUiRyEC7zlNhntTBpZQB8hw,3725
99
99
  classiq/interface/analyzer/cytoscape_graph.py,sha256=_2GviubgrDMAbF57PTDMhS9W0mTCLYWdyu0HndDPh54,2116
@@ -361,7 +361,7 @@ classiq/interface/model/port_declaration.py,sha256=l5ngik16iZU7BevFfyZvFY2YfY9pM
361
361
  classiq/interface/model/power.py,sha256=3C2NOkq_t8AafvYsN51hmgMIJB0pic_DvZxYbID9WX4,388
362
362
  classiq/interface/model/quantum_expressions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
363
363
  classiq/interface/model/quantum_expressions/amplitude_loading_operation.py,sha256=v45Eb44VxyBTMH-E1NTb5-YdKCj5EY_rb-BClHI0A48,2428
364
- classiq/interface/model/quantum_expressions/arithmetic_operation.py,sha256=EPk0SkJvierFUIh0GOMRNo_xiZvWUXCYKjhToFy9hAM,3347
364
+ classiq/interface/model/quantum_expressions/arithmetic_operation.py,sha256=HKFZci4z4QSmE8Bpwu6_6sCU1Wb-jzovrmsU1lmxjmw,3428
365
365
  classiq/interface/model/quantum_expressions/quantum_expression.py,sha256=yw-sYXbaaKoUSL8oujDFBjyShxCfAQnPPX64h-Yh-_8,2118
366
366
  classiq/interface/model/quantum_function_call.py,sha256=YOwmNuz7F0I7jimVjy69eGI044iXS0hAcBjBRuvhsI8,7313
367
367
  classiq/interface/model/quantum_function_declaration.py,sha256=N1iccemg-xC4Cc1pPLWT3cBGYO3RIEBPVz_zlWWkLpQ,7704
@@ -411,11 +411,11 @@ classiq/model_expansions/quantum_operations/classicalif.py,sha256=6SFumWVIWCTNQs
411
411
  classiq/model_expansions/quantum_operations/control.py,sha256=SibNNK8gwzBMojwmXDg--SXbqhn3PJmIB2y0sK-7rJA,10151
412
412
  classiq/model_expansions/quantum_operations/emitter.py,sha256=wMuICR_CzLmaiwhS6EZWu4H864ZxTndITQC1gNRVaWA,10899
413
413
  classiq/model_expansions/quantum_operations/expression_operation.py,sha256=q2EaNec3kvTw2xDVGrd36p_rHiNMaWzkR0qFC55sJDY,8182
414
- classiq/model_expansions/quantum_operations/inplace_binary_operation.py,sha256=_r7NFHkaC3AxV8DWY_aFrOJj6YLf6Njxu8m4h2hXtmo,11264
414
+ classiq/model_expansions/quantum_operations/inplace_binary_operation.py,sha256=OoEBjjE9sXoOuV3h7p29UN6DgGywcXPVHntSLHXAUp4,11142
415
415
  classiq/model_expansions/quantum_operations/invert.py,sha256=iR6ZpTyntchWb5kJFFMCC6rkBURbueJO42H7-8ljbKw,1661
416
416
  classiq/model_expansions/quantum_operations/phase.py,sha256=W3qHfxs9S25yE2Ofgy9NwO5t9og6DxhqSQW8w1ptm1w,7337
417
417
  classiq/model_expansions/quantum_operations/power.py,sha256=89FEo5xJkOxCP7L7Jy9MJatRbbzjVVR0oc8Q7aBzF8Q,2661
418
- classiq/model_expansions/quantum_operations/quantum_assignment_operation.py,sha256=1bT87G6aOPxtzmAhklV2zhZCwQooGqjlREXIjYv0YJQ,7503
418
+ classiq/model_expansions/quantum_operations/quantum_assignment_operation.py,sha256=-WjwH-DmRbIZa4BusHl8HC7fvt7pc0U2IeU7-Mz5k-A,7485
419
419
  classiq/model_expansions/quantum_operations/quantum_function_call.py,sha256=hQcOwaZV0qe7SmlqV3hdlKIcX_EKmxGOysH0lOVh9F0,729
420
420
  classiq/model_expansions/quantum_operations/repeat.py,sha256=zxxKxbMqa_4zkA5x10NrDpgUqEHKId4WxLXmD4aboJk,2060
421
421
  classiq/model_expansions/quantum_operations/variable_decleration.py,sha256=fRMRxctSxQFhPIhTMMVGC0F9p4iBLIMCD59G_j4Rk2Y,1196
@@ -471,10 +471,10 @@ classiq/qmod/generative.py,sha256=--557jt22gVKJROwcSA7AzQBdgNl9zMXGEfRJVI6W1k,15
471
471
  classiq/qmod/model_state_container.py,sha256=Csm3DbdzGsNG4hQyT8o8Hrwu5CqU3aeIYqlWu15saK4,706
472
472
  classiq/qmod/native/__init__.py,sha256=00ZlOKotzZ5MPkwwWNTnwrPeNRTFurFNJgueixP6BVo,151
473
473
  classiq/qmod/native/expression_to_qmod.py,sha256=p_WHipErHWbIDZkRPT487xik_49MheasCTiQvHVam2Y,7134
474
- classiq/qmod/native/pretty_printer.py,sha256=dYbhc4npUa9aZC2q_YDTwhecz5lbuIZWTWPzZMA4p24,15335
474
+ classiq/qmod/native/pretty_printer.py,sha256=MnsSSA2hmZ_7lkB0ZjhwRy18zVwEEM0URgIP9CFv41U,15323
475
475
  classiq/qmod/pretty_print/__init__.py,sha256=TY7bQpDw75-oLUinUoCUMQnbjUcFzcFqHO1sEK-DgPE,157
476
476
  classiq/qmod/pretty_print/expression_to_python.py,sha256=e9PG553YlTh1R7ywRFYoMyMIsh1oehWU3n0XN8Mj6GY,7471
477
- classiq/qmod/pretty_print/pretty_printer.py,sha256=Z8c-MloAh34PKyDeDeQsmMvGVNjvetc0FARcGS_xqF0,21500
477
+ classiq/qmod/pretty_print/pretty_printer.py,sha256=cO0fVbDoWPfMmRr9WwgW8zAKp9rlaHKfCi1pyXTIIXo,21488
478
478
  classiq/qmod/python_classical_type.py,sha256=kodOLRAm4UTnrRcHGCrUKJGMJBrPmtLEvE4K5SSKkgw,2404
479
479
  classiq/qmod/qfunc.py,sha256=R9Dif90S-RfOnkFWA53p-ZuG1MFVGJoNuMKPC1oULuM,1304
480
480
  classiq/qmod/qmod_constant.py,sha256=ZGYhlN4sN4opm91LGFxN7eShcj5mTlDH3DJXpazW-Zk,3857
@@ -500,6 +500,6 @@ classiq/qmod/utilities.py,sha256=z_VnIRmOYTWjJp2UlOcWK0rQRtMqysmP_Gr6WYY_nak,273
500
500
  classiq/qmod/write_qmod.py,sha256=SO7hdBdO31lTzyeaJ-Htyma-aJmrbBNtABNEB2llI4Q,1818
501
501
  classiq/show.py,sha256=GyxceOzWrnVC9KvsLdHJbxycD9WkcQkkhOSw45P6CPo,1428
502
502
  classiq/synthesis.py,sha256=wBk5iFCH2Bw9AvVPzGvTI96zjQXw6QpKRN9VZxc_Xl0,3350
503
- classiq-0.48.0.dist-info/METADATA,sha256=JUmyJqwhybYuCk29KauILlmXTciyNJQFnQJeMW0EjcA,3458
504
- classiq-0.48.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
505
- classiq-0.48.0.dist-info/RECORD,,
503
+ classiq-0.48.1.dist-info/METADATA,sha256=cZD-gt-m6UXPAiUfRLq3ecmGYHdOHOuDK-gIlg1Cgeo,3458
504
+ classiq-0.48.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
505
+ classiq-0.48.1.dist-info/RECORD,,