classiq 0.58.1__py3-none-any.whl → 0.59.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 (40) hide show
  1. classiq/_internals/api_wrapper.py +8 -3
  2. classiq/_internals/jobs.py +3 -5
  3. classiq/execution/execution_session.py +36 -20
  4. classiq/executor.py +2 -1
  5. classiq/interface/_version.py +1 -1
  6. classiq/interface/generator/arith/arithmetic_operations.py +1 -0
  7. classiq/interface/generator/register_role.py +8 -0
  8. classiq/interface/model/handle_binding.py +22 -3
  9. classiq/model_expansions/capturing/captured_vars.py +316 -0
  10. classiq/model_expansions/capturing/mangling_utils.py +18 -9
  11. classiq/model_expansions/closure.py +29 -74
  12. classiq/model_expansions/function_builder.py +51 -66
  13. classiq/model_expansions/interpreter.py +4 -7
  14. classiq/model_expansions/quantum_operations/bind.py +1 -3
  15. classiq/model_expansions/quantum_operations/call_emitter.py +46 -11
  16. classiq/model_expansions/quantum_operations/classicalif.py +2 -5
  17. classiq/model_expansions/quantum_operations/control.py +13 -16
  18. classiq/model_expansions/quantum_operations/emitter.py +36 -8
  19. classiq/model_expansions/quantum_operations/expression_operation.py +9 -19
  20. classiq/model_expansions/quantum_operations/inplace_binary_operation.py +4 -6
  21. classiq/model_expansions/quantum_operations/invert.py +5 -8
  22. classiq/model_expansions/quantum_operations/power.py +5 -10
  23. classiq/model_expansions/quantum_operations/quantum_assignment_operation.py +1 -3
  24. classiq/model_expansions/quantum_operations/quantum_function_call.py +1 -3
  25. classiq/model_expansions/quantum_operations/repeat.py +3 -3
  26. classiq/model_expansions/quantum_operations/variable_decleration.py +1 -1
  27. classiq/model_expansions/quantum_operations/within_apply.py +1 -5
  28. classiq/model_expansions/scope.py +2 -2
  29. classiq/model_expansions/transformers/var_splitter.py +32 -19
  30. classiq/model_expansions/utils/handles_collector.py +33 -0
  31. classiq/model_expansions/visitors/variable_references.py +18 -2
  32. classiq/qmod/qfunc.py +9 -13
  33. classiq/qmod/quantum_expandable.py +1 -21
  34. classiq/qmod/quantum_function.py +16 -0
  35. {classiq-0.58.1.dist-info → classiq-0.59.0.dist-info}/METADATA +1 -1
  36. {classiq-0.58.1.dist-info → classiq-0.59.0.dist-info}/RECORD +37 -38
  37. classiq/interface/executor/aws_execution_cost.py +0 -90
  38. classiq/model_expansions/capturing/captured_var_manager.py +0 -48
  39. classiq/model_expansions/capturing/propagated_var_stack.py +0 -194
  40. {classiq-0.58.1.dist-info → classiq-0.59.0.dist-info}/WHEEL +0 -0
@@ -3,7 +3,7 @@ classiq/_analyzer_extras/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZ
3
3
  classiq/_analyzer_extras/_ipywidgets_async_extension.py,sha256=7zv7mANDaLHH8QRGyY9QGDPPKPTjKKYdoq22iJaq_Ns,2190
4
4
  classiq/_analyzer_extras/interactive_hardware.py,sha256=f7ad2HeFq1f-2dJtPpgOE_w2IFzm49W6P_c-MzqJ5qE,3257
5
5
  classiq/_internals/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
6
- classiq/_internals/api_wrapper.py,sha256=JEpUu9oZrbrHHu7qibfjnerAp2UBihdM6GrY9fVz-AM,12824
6
+ classiq/_internals/api_wrapper.py,sha256=CtrQPjCoDtGOJXMmROifX-YcYE6MkQyqJtB2DRwAu2U,12923
7
7
  classiq/_internals/async_utils.py,sha256=utfzFLuCqmvxTLgg3JhMi-sBMIQFVW2LU5dqUEAJLCM,3370
8
8
  classiq/_internals/authentication/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  classiq/_internals/authentication/auth0.py,sha256=K6yCnDUhIfgx-GfUHivak88_u06USHjXAjx9b3m5iek,3663
@@ -15,7 +15,7 @@ classiq/_internals/client.py,sha256=V-hyLXLW2EgE9mPOOemlEDSfz9SgXxez0aYmlv5UaU0,
15
15
  classiq/_internals/config.py,sha256=-UKKvPp_61sxXY-URqU1feLqlfh9ww4wCDH4yl14EiA,3534
16
16
  classiq/_internals/help.py,sha256=9gl64Y8nKW-f-8pYt7lMozOP6uERcIIf8dotgn_WKA0,460
17
17
  classiq/_internals/host_checker.py,sha256=D0rgnoZrHo62rYS32yCuYZSyMrMChZG5ITsJxwj0R5g,3969
18
- classiq/_internals/jobs.py,sha256=kZ2nEs4HGgrLOEHnMhL_AKnKB_BVQ1AFsJuxwEh-xPM,6421
18
+ classiq/_internals/jobs.py,sha256=s-1-500Q-KrVG9nnTPbxcNfVqWiEfRnVKDL8A8HWnKM,6295
19
19
  classiq/_internals/logger.py,sha256=TGV37AR6aezLUzKUz4V1JercHeC68o_nNMlIRNHSRFM,634
20
20
  classiq/_internals/type_validation.py,sha256=kRd6td9krHPSZWgfclNsQcX7sNTqikp5wc3DvNbDsrA,1332
21
21
  classiq/analyzer/__init__.py,sha256=1ASEd3a5BLznMq_uD4ogR6buanALXfJIONZYmCweAgA,186
@@ -88,14 +88,14 @@ classiq/applications/qsvm/qsvm_data_generation.py,sha256=BIXBAxYNAvwZi1pVQJeSPTa
88
88
  classiq/applications/qsvm/qsvm_model_constructor.py,sha256=4Md7FuKZsG9FUCwBVDwkLic2_EtYCfYCkT0mnH-IsVQ,3945
89
89
  classiq/execution/__init__.py,sha256=t43kgz7GlyB8WT4gY10kr6tBBCTsD95oSWy-AZZZF_8,1220
90
90
  classiq/execution/all_hardware_devices.py,sha256=KpLefEISE03FDdgFPGggXeG7NAxBW4090gN4272Dl-E,368
91
- classiq/execution/execution_session.py,sha256=txq8bvULxS4nTKJo0LBcmtVoRZVLjrkqdidzGuk-6JE,15832
91
+ classiq/execution/execution_session.py,sha256=1ZItrjCn5lRdpQfPXGndzWrE_zpg1xY_-AVdhCMsfsU,16628
92
92
  classiq/execution/iqcc.py,sha256=0wy1tgQFcwqf9wFYyi6_OYRtx4s0AEViIAIvUkyKBmk,2429
93
93
  classiq/execution/jobs.py,sha256=XCxv2oLF-0XyXmWS5DutuHhvLrmg5thc0j4yBSdvX3Q,9880
94
94
  classiq/execution/qaoa.py,sha256=IiicS_L41FeR_9kDcqLKnbuBuWj5ABuuGKqyC6SVsHk,3007
95
95
  classiq/execution/qnn.py,sha256=6lAKO0TpSEkcY_EwbJfVqNeqCeOegmkBQC1AzUrWxy0,2333
96
- classiq/executor.py,sha256=wp8FwEUbtkgXCchmgjHTqgMgNYxC06zR7sSvPlDokvk,2603
96
+ classiq/executor.py,sha256=rvcOI95rYtU2OSsuHLSjh9jutAk-CPSP6Bi01Fw3NqQ,2686
97
97
  classiq/interface/__init__.py,sha256=cg7hD_XVu1_jJ1fgwmT0rMIoZHopNVeB8xtlmMx-E_A,83
98
- classiq/interface/_version.py,sha256=LJPq2DsuRYeRYbVnQtXywMtzoD722zWi-ToRnxjpRhg,197
98
+ classiq/interface/_version.py,sha256=rOMLK5Bd2ikoXtLbPc7cjxr3_XaPCsHMXecVZTZmeh0,197
99
99
  classiq/interface/analyzer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
100
100
  classiq/interface/analyzer/analysis_params.py,sha256=dM5rwSks798cxk4FWe4_X5ToRYtgZQh34F1u0XrFkK8,3881
101
101
  classiq/interface/analyzer/cytoscape_graph.py,sha256=MpeRBIYS1TfwYwiFpgTO51IE0KoxhY510pmEM3S0rbw,2361
@@ -151,7 +151,6 @@ classiq/interface/execution/primitives.py,sha256=_--jsR32K5QwuA5YgU43HGIH-nElBBG
151
151
  classiq/interface/execution/resource_estimator.py,sha256=YJRuk9lAkhpwqegjyOrxvEY1TgHzvPnXCMAd-MQC6GE,144
152
152
  classiq/interface/execution/result.py,sha256=6TduBhKFw8j7Yxcgn9d2MA0lm82sEcfY1yWIKUOdHro,139
153
153
  classiq/interface/executor/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
154
- classiq/interface/executor/aws_execution_cost.py,sha256=0yx_q_-rvaaofaqHyI9YvTtAFP45BCLzFfbgEmHsN-w,2627
155
154
  classiq/interface/executor/constants.py,sha256=DtSx-1HArWE0hHjOZHY9WJBevt3hP7M8SrYO3eM3dgo,31
156
155
  classiq/interface/executor/estimation.py,sha256=lJEmN3Uj9bW0EY7JEZvzItwEybbBHSn7zYFz89L8fqo,389
157
156
  classiq/interface/executor/execution_preferences.py,sha256=lEjsv_RGPLrpXBUw55TOZ17lWLEgCJLi3ol9uo1-_Rk,2931
@@ -189,7 +188,7 @@ classiq/interface/generator/arith/arithmetic_arg_type_validator.py,sha256=k7e9nI
189
188
  classiq/interface/generator/arith/arithmetic_expression_abc.py,sha256=c9T_5m9B6Lq7vgNt3u1o8MGHSFo3OJJc9EdpaXP8Yqk,7168
190
189
  classiq/interface/generator/arith/arithmetic_expression_parser.py,sha256=rdzpQkfyxwr1gFm3s96H-qNyi0RKlkBpwx8RJPsM3Ac,5371
191
190
  classiq/interface/generator/arith/arithmetic_expression_validator.py,sha256=QQ9mlCmw-XrYTCmuw-uNZuWx2cmtMPpfIUUOcpuB3YM,7244
192
- classiq/interface/generator/arith/arithmetic_operations.py,sha256=SMwXDF6WQBgbG3NkvZcM5zKUUUw4pFUs02J2uUX8mcg,1894
191
+ classiq/interface/generator/arith/arithmetic_operations.py,sha256=xwX4POh11BGSsFvlWXMctFWaNo02LDoQunZiQF6pDBk,1944
193
192
  classiq/interface/generator/arith/arithmetic_param_getters.py,sha256=P0RWHhu7UiWJ_qjF_SRW6GUcVtyAr8HFgZde3Lau3kQ,13367
194
193
  classiq/interface/generator/arith/arithmetic_result_builder.py,sha256=XYBz7ZwX47GkJG-U2Bh2vE1iJGX-IcRw811_MDGegMI,4231
195
194
  classiq/interface/generator/arith/ast_node_rewrite.py,sha256=m3-PZfeewz_YAXn847DK-gAPtdWQzJo7Rg6WBjOvNzw,2796
@@ -294,7 +293,7 @@ classiq/interface/generator/quantum_function_call.py,sha256=6BjtOeYewX7VhdEP877T
294
293
  classiq/interface/generator/quantum_program.py,sha256=UtRrE2epg_gXAjmtgvQzA8jqEQ3C4iXlDn64w_9eZJY,6955
295
294
  classiq/interface/generator/randomized_benchmarking.py,sha256=D6KI_1fMF5oBydaal2WLmTSit6xSMtz0yDAIZMMO89Q,635
296
295
  classiq/interface/generator/range_types.py,sha256=X6CtSyimlpISz9QNbCdqqQkRg1pOGHEQCXy4aEeSwA4,2044
297
- classiq/interface/generator/register_role.py,sha256=yasTwNKBWWA9S_gppE7RSRc5DJZGBl9ZaL_OBv_sick,871
296
+ classiq/interface/generator/register_role.py,sha256=moerPIO9gQUuG5pe43TemmScSVjTK7_gi-qbrhIgLOA,1147
298
297
  classiq/interface/generator/slice_parsing_utils.py,sha256=0vFaXi-UxTJHXLw0S-0tCaKhIwmRWzQnPhaHnYkuMeg,1972
299
298
  classiq/interface/generator/standard_gates/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
300
299
  classiq/interface/generator/standard_gates/controlled_standard_gates.py,sha256=beouHYwzyOLH9Ngd-Zm1aNf3KBH3c-3zkxT7PT6WvXM,5504
@@ -355,7 +354,7 @@ classiq/interface/model/bind_operation.py,sha256=J0E6u8KOSB-vRcdpsukYpk1oc8efRoh
355
354
  classiq/interface/model/classical_if.py,sha256=Qr726EEiim47PexMd8lTRfHLziUoiTUitnHrM3-oSgI,432
356
355
  classiq/interface/model/classical_parameter_declaration.py,sha256=tcAw-knjFqeHg_snv7qBJuJDrUhmL0v1-Q_YfVgRnEc,1261
357
356
  classiq/interface/model/control.py,sha256=1q_CjIGSGmqmvfT1RAN6VmIj2DZIio2wMOCT6HNniBw,1356
358
- classiq/interface/model/handle_binding.py,sha256=0uJADrIA429Jn05Bg0ZkLB594tl8sjvjPAzvkYl-320,8504
357
+ classiq/interface/model/handle_binding.py,sha256=hyyvXUYUTGB4enLaPXIxfdwWLm7xeKU9WwUXnRle5Y0,9070
359
358
  classiq/interface/model/inplace_binary_operation.py,sha256=Q2CmF42Y975SOJ7gsZfGyRA5Jn9MKzyNle0sopCyCh4,1494
360
359
  classiq/interface/model/invert.py,sha256=9gN0vmy4892_ItwPxKc0lTjjagyKUX6mEer2vINdL5o,294
361
360
  classiq/interface/model/model.py,sha256=aQJEZIi8DO-zeLTQ5M_h7y5iGujoXxzSaUPz8FqKru4,6834
@@ -391,10 +390,9 @@ classiq/interface/source_reference.py,sha256=a-4Vdc511ux-0lDPDTRGAzouRWWtu4A3MPA
391
390
  classiq/model_expansions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
392
391
  classiq/model_expansions/atomic_expression_functions_defs.py,sha256=-P19ErGfCylg_V8mnAh_zFA4h88_FWPHXLGQaFHCvJ0,8443
393
392
  classiq/model_expansions/capturing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
394
- classiq/model_expansions/capturing/captured_var_manager.py,sha256=t-3EM-MfNlSGhx9-wzdwNAUM0aaEqDSboMBSe48QpVo,1790
395
- classiq/model_expansions/capturing/mangling_utils.py,sha256=oXefnIECq-8yeW6FujI0UxgIJRKfPTjhIdfizHK3I2I,1350
396
- classiq/model_expansions/capturing/propagated_var_stack.py,sha256=h6STPdNYa-kpoPYSgnjZ0SPYm2uyTanieY626pbr538,7414
397
- classiq/model_expansions/closure.py,sha256=4X-zE7MW8um5rO9ydp-9LwkeNsbVm-UaYJ5QLw8Qcyo,8897
393
+ classiq/model_expansions/capturing/captured_vars.py,sha256=HNkA_1W11vXie9Fj_deeNjXeu-y30Xr8VZhPdDEVDxo,11981
394
+ classiq/model_expansions/capturing/mangling_utils.py,sha256=9-NR9R4Q24y324u6er3VLWKL3nWon4m9K0MRqQuc7Sk,1663
395
+ classiq/model_expansions/closure.py,sha256=s8N3b5QolH9acFFRArD19ESk-3Q6BtkBoYHokv6jbCw,6854
398
396
  classiq/model_expansions/debug_flag.py,sha256=JWzl9FFq2CLcvTg_sh-K8Dp_xXvewsTuFKhPjTCrsrs,107
399
397
  classiq/model_expansions/evaluators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
400
398
  classiq/model_expansions/evaluators/arg_type_match.py,sha256=ovN41FwUYr0-t_PbTrtUnzqO3ZKw9y7_VBZmZFRN8aM,6135
@@ -406,39 +404,40 @@ classiq/model_expansions/evaluators/quantum_type_utils.py,sha256=5H5ri5RW6TLdXhn
406
404
  classiq/model_expansions/evaluators/type_type_match.py,sha256=3akZR86TAFKUyM5c5knCPSlraI3LQeWZXxXMTtmu0BI,3220
407
405
  classiq/model_expansions/expression_evaluator.py,sha256=viOhH1X3gLAn77FkXzJ4BUHOg2i28LsNOmcpvM_R9-0,4338
408
406
  classiq/model_expansions/expression_renamer.py,sha256=rtAf-vvJhlwh-KCs2WgxdW4lP3UjA0vUtZeHcIoTwUM,2692
409
- classiq/model_expansions/function_builder.py,sha256=9KeicLhIaY3inf1BpNqw2u6EcbNg2a2fP1INmqZ2Hjk,7460
407
+ classiq/model_expansions/function_builder.py,sha256=9VS2UKKVeGKTTO0laz6BfH7JBT2m5fT6sXkxk8MpI9A,6918
410
408
  classiq/model_expansions/generative_functions.py,sha256=bw3KbNCrq72H-jSDZx9npdxha0Po8lV4cqSjneW2Xlo,8465
411
- classiq/model_expansions/interpreter.py,sha256=YqGY8c3PnWUbf_caEMa9MeMalGFWM85i1HwQ4duVD1A,15418
409
+ classiq/model_expansions/interpreter.py,sha256=QRnzKFjAb1-qhDJzCbvKOc63asfWKGuiS7RUA6XanFo,15213
412
410
  classiq/model_expansions/model_tables.py,sha256=C0ZhCF1GAmgCqkm6iTNO9-cj_YdwGpE8etKvVxWx1w8,3585
413
411
  classiq/model_expansions/quantum_operations/__init__.py,sha256=BMruLYFsir2nU9Du9PZBcQzQsgIc-4Zpkx8CJmvbL14,1040
414
- classiq/model_expansions/quantum_operations/bind.py,sha256=QsrNMtDXHFcG2TWO7wbk4yml7kpPys1YCmL-bNrrZ_I,2606
415
- classiq/model_expansions/quantum_operations/call_emitter.py,sha256=wF7HdACC6s0kRnTYRnxp9EKLfOLqeOEn0jAQIq9UJw8,8736
416
- classiq/model_expansions/quantum_operations/classicalif.py,sha256=e15sfehhfMViSVWEA2DcJ6Olb8teWDpRP1FuBhLzzR0,2173
417
- classiq/model_expansions/quantum_operations/control.py,sha256=M2ghFVXU4zu8AOwcfg1pkxmnqmepyNJChLS2fuVwPu8,13486
418
- classiq/model_expansions/quantum_operations/emitter.py,sha256=IL0lR2D2jNWIKCyoc74Qun78BNlOeDPcpK8Oenkse-A,4961
419
- classiq/model_expansions/quantum_operations/expression_operation.py,sha256=dIAtOBkHQtE0BHiRq-Zi2_Cei42DoMKg8hSwf2fDDcE,4290
420
- classiq/model_expansions/quantum_operations/inplace_binary_operation.py,sha256=FKKNyT54VEs-48CzTr0_zqCuu60UxXwk6vOovONVZz4,17049
421
- classiq/model_expansions/quantum_operations/invert.py,sha256=Vyvw2hRy37onm6y60T-cwYnGabqxsAR1hrdzfZhYluo,1680
412
+ classiq/model_expansions/quantum_operations/bind.py,sha256=A1XPXnoexaKUlgUZSAn88SYXmXjo1G9-fCAJS67gM-c,2515
413
+ classiq/model_expansions/quantum_operations/call_emitter.py,sha256=FgyZT40yJ9sQ6HIfTfJuOY1zzUx_07Ayyyz_l-GP6dI,10089
414
+ classiq/model_expansions/quantum_operations/classicalif.py,sha256=fe2RIjn-eo3CJflKvQR2Wv0TYvkWkQg2z_9R9FsGaYo,2029
415
+ classiq/model_expansions/quantum_operations/control.py,sha256=DI9Y3QCMe6A759RKpGrjXuLUHfI7abdv-YTCDdXagRA,13351
416
+ classiq/model_expansions/quantum_operations/emitter.py,sha256=EvFC31OoBsJuX7vqzEHUjoy6UHtHwxbPUHDVyhd6JDA,6301
417
+ classiq/model_expansions/quantum_operations/expression_operation.py,sha256=-ZCsuQou-RAsN2YMIT0GQ5xRn8CZegG3T_ZzWUrrpyM,4052
418
+ classiq/model_expansions/quantum_operations/inplace_binary_operation.py,sha256=t4N9OKmBUTVoska26Ox5mGfKWlxJLXUC0AQN--NCbuY,16903
419
+ classiq/model_expansions/quantum_operations/invert.py,sha256=U8NyaFzKAnZ3effU2Q0MSTCAMB7Zb-9YmVfZHPGJsWY,1553
422
420
  classiq/model_expansions/quantum_operations/phase.py,sha256=vBYdGd5KPj7am37pXAJwY4vZAPI7igm8Fyjg5rkanL8,7280
423
- classiq/model_expansions/quantum_operations/power.py,sha256=_7mx4emS2cFwC-Ycbdg-FtLTgg1stwNObRa3el829A0,2933
424
- classiq/model_expansions/quantum_operations/quantum_assignment_operation.py,sha256=OQgkUzX747vn5gaQHovnvEpuTRi4iNad2_FRUztYfCI,9524
425
- classiq/model_expansions/quantum_operations/quantum_function_call.py,sha256=7x58DvoLt2IPYMsZxL6swjZDxCo5RXkTPFZvL96GX3c,1006
426
- classiq/model_expansions/quantum_operations/repeat.py,sha256=bvzPtBPArewDpFTiborHhJt8-_pHMfIksxpbKbs3ItE,2254
427
- classiq/model_expansions/quantum_operations/variable_decleration.py,sha256=DdlkwMbVknd_rvZXaXelF0p1YDy6cYHStAzLJVbnV9w,1208
428
- classiq/model_expansions/quantum_operations/within_apply.py,sha256=dehZPxM-z2x_pdjKplml293viBtrhXNtJDEm99TbEqY,1746
429
- classiq/model_expansions/scope.py,sha256=kcqvA-aL8HnyzR6hT-ptxt01lQAT7z_rLXHzxh99AQk,7624
421
+ classiq/model_expansions/quantum_operations/power.py,sha256=rDDaczwPepIfIFnDYlAAHJ1tmA8tKMn6JKScOZSsbhc,2669
422
+ classiq/model_expansions/quantum_operations/quantum_assignment_operation.py,sha256=OTKnUNDswHu0u13gTaXCgRzbo7Of37QMLjbUh9m0pVU,9391
423
+ classiq/model_expansions/quantum_operations/quantum_function_call.py,sha256=WJo_OJeihDuzVNXC3wLSuizZm61QBHpjwn_bONlJutc,926
424
+ classiq/model_expansions/quantum_operations/repeat.py,sha256=2gvc6OwU6Tz6qwRFhGJ11Rjju4Xw1CaRoV0hnH4KB5c,2205
425
+ classiq/model_expansions/quantum_operations/variable_decleration.py,sha256=OG_uWndzpPX4rJ3ij_7iOtcS779ubS-Uo2RT1GHdR60,1199
426
+ classiq/model_expansions/quantum_operations/within_apply.py,sha256=-5MQJ3Hee3W0jJFctL_nm0_wnTeWHgRzvE20-o60Wqk,1548
427
+ classiq/model_expansions/scope.py,sha256=ERAFg1dWyDs8RqSPQ2L7pyC2tmHw0dEksIbJbDfI76E,7640
430
428
  classiq/model_expansions/scope_initialization.py,sha256=hgIK2Qx1uPT_nP4fUzDdFWZAiemDT_yw-S8oKdy01WE,5678
431
429
  classiq/model_expansions/sympy_conversion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
432
430
  classiq/model_expansions/sympy_conversion/arithmetics.py,sha256=7ZKg1C92wUdxtFhrT4VuI9mNvH2a1z1R8lbWYFhYczc,1116
433
431
  classiq/model_expansions/sympy_conversion/expression_to_sympy.py,sha256=JvjhM68m6OinhJ0fR0gSUn3RqoEniD7vLAL0FO4C6R0,5634
434
432
  classiq/model_expansions/sympy_conversion/sympy_to_python.py,sha256=VVz5OvbzLGGRgZibbjTCRGCH0v-Lqt4PEmMwqkN9JEo,3773
435
433
  classiq/model_expansions/transformers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
436
- classiq/model_expansions/transformers/var_splitter.py,sha256=fp9QOJ3O0PqxRdp0H7o8VihQevGobEoznzceQ6YpAic,8474
434
+ classiq/model_expansions/transformers/var_splitter.py,sha256=eaBlaNKlc5Lh01PEtlWwKLZlVVwwYK8789tHr1VoQPA,9065
437
435
  classiq/model_expansions/utils/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
438
436
  classiq/model_expansions/utils/counted_name_allocator.py,sha256=9LPLBm-4ZrpC_0r1rbogyF11FnLaGCUyzwWpcBJoSmA,297
437
+ classiq/model_expansions/utils/handles_collector.py,sha256=4RfPsiKjVZkTq2tuS-nvo5OG5gGT_HEALf52SuzJ4Dg,1164
439
438
  classiq/model_expansions/visitors/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
440
439
  classiq/model_expansions/visitors/boolean_expression_transformers.py,sha256=a8ITXY48uROZFd9MF8tXdXs14Uxh8XbBpuvRXvRehjY,8067
441
- classiq/model_expansions/visitors/variable_references.py,sha256=HfAU6UZUtfcy7KkrvQbNQdnSXD79wwbyagnv8ZpMukQ,4111
440
+ classiq/model_expansions/visitors/variable_references.py,sha256=35KnovjtWfpEIewpZlY1UjL8YKG9e47z1pXzaqoE4jM,4730
442
441
  classiq/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
443
442
  classiq/qmod/__init__.py,sha256=ktAnNYCn6UJGvpMjwEjed3MKtdOwpevBD3JPErM7lqs,842
444
443
  classiq/qmod/builtins/__init__.py,sha256=pYNdaroGuxuXRPX3oHdwGoF5sCfHSqU9IG3uuenCmT8,1206
@@ -486,13 +485,13 @@ classiq/qmod/pretty_print/__init__.py,sha256=jhR0cpXumOJnyb-zWnvMLpEuUOYPnnJ7DJm
486
485
  classiq/qmod/pretty_print/expression_to_python.py,sha256=QoRP817CFEp3Ad3Q3hxWW-hbVzWQbHQIGUHjZkpZDm8,7480
487
486
  classiq/qmod/pretty_print/pretty_printer.py,sha256=KVgAbQXiMjriif1E2DtgBLadkZzvv8lRlipWZ4_AuM4,23135
488
487
  classiq/qmod/python_classical_type.py,sha256=S_CbuxMHmYDgYcT31kCIy1xjhWvnAHHVJNWZ6lUPV8w,2513
489
- classiq/qmod/qfunc.py,sha256=6aJ7muLptXXRq5V5UG19LsJGrwCJeYr7Jk0TmQ_Qvgg,2124
488
+ classiq/qmod/qfunc.py,sha256=pDyGqHhITayNFvcns-IknAG_KHTqlqHaQfHRF25Yc44,1949
490
489
  classiq/qmod/qmod_constant.py,sha256=YawkwhhOLqFyFUyhE13Q_zCnex_Ki46hePRwGJmr5oU,4853
491
490
  classiq/qmod/qmod_parameter.py,sha256=PpK4rzY0Hszgbzr_lclROcZ7JPqnhDJBYsSQkUjkcs8,4294
492
491
  classiq/qmod/qmod_variable.py,sha256=T53o_GQWXPCIfW6bTIvNUTHoE3bodIHec8r6a_YJXfU,24105
493
492
  classiq/qmod/quantum_callable.py,sha256=sthlH5UJyJsdOxpCW3_EW3JFIYd0r1K3Zec1CDbC2-0,2451
494
- classiq/qmod/quantum_expandable.py,sha256=ZRg_NWpqM86rp8hhvRXGJytBJfWdwiw930ODq6Er3xY,16450
495
- classiq/qmod/quantum_function.py,sha256=vF2qU8Z1yTtZA6pbVLS0Rjh02A-OTt4VGxbnFGoSeFE,8980
493
+ classiq/qmod/quantum_expandable.py,sha256=7Qvae2WVCXtvrIA-sgZdO1fCjB7GfZLs2lCwjwrdzDw,15630
494
+ classiq/qmod/quantum_function.py,sha256=tnFryVjOK9mouzdcbxm_VjpenAvYjBCc229n3c4lGuQ,9551
496
495
  classiq/qmod/semantics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
497
496
  classiq/qmod/semantics/annotation.py,sha256=0IeRymMK20sPHzbs7EzGoqhZICQmR6-gXR3SS9sr9OE,1255
498
497
  classiq/qmod/semantics/error_manager.py,sha256=KAnNaQE0YarkXTQ0du3mvCqGCbbH-d81sv2Ti-NpkL4,2783
@@ -511,6 +510,6 @@ classiq/qmod/type_attribute_remover.py,sha256=NZmTXAsngWqthXjE8n-n6yE72fiWTFM12-
511
510
  classiq/qmod/utilities.py,sha256=z_VnIRmOYTWjJp2UlOcWK0rQRtMqysmP_Gr6WYY_nak,2734
512
511
  classiq/qmod/write_qmod.py,sha256=Oo-j_rSfcmzC5MOn0Vq334vv_OTvdD4P7K9pv-gbo8c,1833
513
512
  classiq/synthesis.py,sha256=WLk3wpX_xPiAMstF9PGMO5SWVb_qqa1sN2Nj3MekX34,8113
514
- classiq-0.58.1.dist-info/METADATA,sha256=xqtK3NkYyILJ2CFocS2L4nzRMBWwCqhDC-VDNDnu6D0,3459
515
- classiq-0.58.1.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
516
- classiq-0.58.1.dist-info/RECORD,,
513
+ classiq-0.59.0.dist-info/METADATA,sha256=nNs_shmuDS6cAFEx9HamByF3V4eWV25bemBS3yh56Mo,3459
514
+ classiq-0.59.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
515
+ classiq-0.59.0.dist-info/RECORD,,
@@ -1,90 +0,0 @@
1
- import datetime
2
- from datetime import date
3
- from typing import Any, Optional, Union
4
-
5
- import pydantic
6
- from pydantic import BaseModel, ConfigDict, Field
7
- from pydantic_core.core_schema import ValidationInfo
8
-
9
- from classiq.interface.enum_utils import StrEnum
10
-
11
-
12
- class Granularity(StrEnum):
13
- monthly = "MONTHLY"
14
- daily = "DAILY"
15
- hourly = "HOURLY"
16
-
17
-
18
- class CostScope(StrEnum):
19
- user = "user"
20
- organization = "organization"
21
-
22
-
23
- class ExecutionCostForTimePeriod(BaseModel):
24
- start: date = Field(
25
- description="The beginning of the time period for tasks usage and cost (inclusive)."
26
- )
27
- end: date = Field(
28
- description="The end of the time period for tasks usage and cost (exclusive)."
29
- )
30
- granularity: Granularity = Field(
31
- description="Either MONTHLY or DAILY, or HOURLY.", default=Granularity.daily
32
- )
33
- cost_scope: CostScope = Field(
34
- description="Either user or organization", default=CostScope.user
35
- )
36
-
37
- @pydantic.field_validator("start", mode="before")
38
- @classmethod
39
- def validate_start_date(cls, start_date: Union[datetime.datetime, date]) -> date:
40
- if isinstance(start_date, datetime.datetime):
41
- return start_date.date()
42
- return start_date
43
-
44
- @pydantic.field_validator("end", mode="before")
45
- @classmethod
46
- def validate_date_and_date_order(
47
- cls, v: Union[date, datetime.datetime], info: ValidationInfo
48
- ) -> date:
49
- if isinstance(v, datetime.datetime):
50
- v = v.date()
51
- if "start" in info.data and v <= info.data["start"]:
52
- raise ValueError('"end" date should be after "start" date')
53
- return v
54
-
55
- def dict(self, **kwargs: Any) -> dict[str, Any]:
56
- data = super().model_dump(**kwargs)
57
- data["start"] = self.start.strftime("%Y-%m-%d")
58
- data["end"] = self.end.strftime("%Y-%m-%d")
59
- return data
60
-
61
-
62
- """The following models describe the aws response model and based on this schema:
63
- https://boto3.amazonaws.com/v1/documentation/api/latest/reference/services/ce.html#CostExplorer.Client.get_cost_and_usage"""
64
-
65
-
66
- class TimePeriod(pydantic.BaseModel):
67
- Start: str
68
- End: str
69
-
70
-
71
- class BlendedCost(pydantic.BaseModel):
72
- Amount: str
73
- Unit: str
74
-
75
-
76
- class Total(pydantic.BaseModel):
77
- BlendedCost: BlendedCost
78
-
79
-
80
- class ExecutedTaskForPeriodItem(pydantic.BaseModel):
81
- TimePeriod: TimePeriod
82
- Total: Total
83
- Groups: Optional[list] = None
84
- Estimated: Optional[bool] = None
85
-
86
- model_config = ConfigDict(extra="forbid")
87
-
88
-
89
- class ExecutionCostForTimePeriodResponse(pydantic.BaseModel):
90
- executed_task_for_period: list[ExecutedTaskForPeriodItem]
@@ -1,48 +0,0 @@
1
- from classiq.interface.generator.functions.port_declaration import (
2
- PortDeclarationDirection,
3
- )
4
- from classiq.interface.model.port_declaration import PortDeclaration
5
-
6
-
7
- def update_captured_vars(captured_vars: list[PortDeclaration]) -> list[PortDeclaration]:
8
- if not captured_vars:
9
- return []
10
- return _update_declarations(captured_vars)
11
-
12
-
13
- def _update_declarations(
14
- captured_vars: list[PortDeclaration],
15
- ) -> list[PortDeclaration]:
16
- updated_vars: dict[str, PortDeclaration] = {
17
- var.name: PortDeclaration(
18
- name=var.name,
19
- quantum_type=var.quantum_type,
20
- direction=PortDeclarationDirection.Inout,
21
- )
22
- for var in captured_vars
23
- }
24
- for var in captured_vars:
25
- updated_vars[var.name].direction = _update_var_declaration(
26
- var.direction, updated_vars[var.name].direction
27
- )
28
- return list(updated_vars.values())
29
-
30
-
31
- def _update_var_declaration(
32
- stmt_direction: PortDeclarationDirection,
33
- existing_direction: PortDeclarationDirection,
34
- ) -> PortDeclarationDirection:
35
- if stmt_direction is PortDeclarationDirection.Input:
36
- if existing_direction is PortDeclarationDirection.Output:
37
- # This will fail semantically because the inout variable is not initialized.
38
- # We will get rid of this scenario by unifying variable declaration and allocation.
39
- return PortDeclarationDirection.Inout
40
- else:
41
- return PortDeclarationDirection.Input
42
- elif stmt_direction is PortDeclarationDirection.Output:
43
- if existing_direction is PortDeclarationDirection.Input:
44
- return PortDeclarationDirection.Inout
45
- else:
46
- return PortDeclarationDirection.Output
47
- else:
48
- return PortDeclarationDirection.Inout
@@ -1,194 +0,0 @@
1
- from collections.abc import Iterable, Iterator, Sequence
2
- from contextlib import contextmanager
3
- from dataclasses import dataclass
4
-
5
- from classiq.interface.exceptions import (
6
- ClassiqExpansionError,
7
- ClassiqInternalExpansionError,
8
- )
9
- from classiq.interface.generator.functions.port_declaration import (
10
- PortDeclarationDirection,
11
- )
12
- from classiq.interface.model.handle_binding import HandleBinding
13
- from classiq.interface.model.port_declaration import PortDeclaration
14
- from classiq.interface.model.quantum_function_call import ArgValue
15
- from classiq.interface.model.quantum_statement import QuantumOperation
16
-
17
- from classiq.model_expansions.capturing.mangling_utils import (
18
- demangle_handle,
19
- mangle_captured_var_name,
20
- )
21
- from classiq.model_expansions.closure import FunctionClosure, GenerativeFunctionClosure
22
- from classiq.model_expansions.function_builder import OperationBuilder
23
- from classiq.model_expansions.scope import QuantumSymbol, Scope
24
-
25
-
26
- @dataclass(frozen=True)
27
- class PropagatedVariable:
28
- symbol: QuantumSymbol
29
- direction: PortDeclarationDirection
30
- defining_function: str
31
- handle: HandleBinding
32
-
33
- @property
34
- def name(self) -> str:
35
- name = self.symbol.handle.name
36
- assert name == self.handle.name
37
- return self.symbol.handle.name
38
-
39
-
40
- class PropagatedVarStack:
41
- def __init__(self, scope: Scope, builder: OperationBuilder) -> None:
42
- # We use dictionary instead of set to maintain the order of insertion
43
- self._stack: list[dict[PropagatedVariable, None]] = [dict()]
44
- self._current_scope = scope
45
- self._builder = builder
46
- self._to_mangle: dict[PropagatedVariable, str] = dict()
47
-
48
- def set_scope(self, scope: Scope) -> None:
49
- self._current_scope = scope
50
-
51
- @contextmanager
52
- def capture_variables(self, op: QuantumOperation) -> Iterator[None]:
53
- self._stack.append(dict())
54
- yield
55
- self._post_handle_propagated_vars(op)
56
-
57
- def _post_handle_propagated_vars(self, qop: QuantumOperation) -> None:
58
- self._halt_propagation_for_vars_in_scope()
59
- currently_captured_vars = self._get_captured_vars(qop)
60
- self._stack[-1].update(currently_captured_vars)
61
- self._update_port_declarations_for_captured_vars()
62
-
63
- def _halt_propagation_for_vars_in_scope(self) -> None:
64
- currently_propagated = self._stack.pop()
65
- self._stack[-1].update(
66
- {var: None for var in currently_propagated if self._should_propagate(var)}
67
- )
68
-
69
- def _should_propagate(self, var: PropagatedVariable) -> bool:
70
- # The second case is in case the captured variable was defined in another function,
71
- # but the current scope has a variable with the same name
72
- return (
73
- var.name not in self._current_scope.data
74
- or isinstance(self._builder.current_operation, FunctionClosure)
75
- and var.defining_function != self._builder.current_function.name
76
- )
77
-
78
- def _get_captured_vars(
79
- self, qop: QuantumOperation
80
- ) -> dict[PropagatedVariable, None]:
81
- input_captured = self._get_captured_vars_with_direction(
82
- qop.inputs,
83
- (
84
- PortDeclarationDirection.Input
85
- if not self._builder.is_compute_context()
86
- else PortDeclarationDirection.Inout
87
- ),
88
- )
89
- output_captured = self._get_captured_vars_with_direction(
90
- qop.outputs,
91
- (
92
- PortDeclarationDirection.Output
93
- if not self._builder.is_compute_context()
94
- else PortDeclarationDirection.Inout
95
- ),
96
- )
97
- inout_captured = self._get_captured_vars_with_direction(
98
- qop.inouts, PortDeclarationDirection.Inout
99
- )
100
- return inout_captured | input_captured | output_captured
101
-
102
- def _get_captured_vars_with_direction(
103
- self,
104
- variables: Iterable[HandleBinding],
105
- direction: PortDeclarationDirection,
106
- ) -> dict[PropagatedVariable, None]:
107
- return {
108
- self._get_captured_var_with_direction(var, direction): None
109
- for var in variables
110
- if self._is_captured(var.name)
111
- }
112
-
113
- def _get_captured_var_with_direction(
114
- self, var_handle: HandleBinding, direction: PortDeclarationDirection
115
- ) -> PropagatedVariable:
116
- defining_function = self._current_scope[var_handle.name].defining_function
117
- if defining_function is None:
118
- raise ClassiqInternalExpansionError
119
- return PropagatedVariable(
120
- symbol=self._current_scope[var_handle.name].as_type(QuantumSymbol),
121
- direction=direction,
122
- defining_function=defining_function.name,
123
- handle=var_handle,
124
- )
125
-
126
- def _is_captured(self, var_name: str) -> bool:
127
- return (
128
- self._current_scope.parent is not None
129
- and var_name in self._current_scope.parent
130
- and var_name not in self._current_scope.data
131
- )
132
-
133
- def _update_port_declarations_for_captured_vars(self) -> None:
134
- self._builder.add_captured_vars(
135
- PortDeclaration(
136
- name=self._to_mangle.get(var, var.name),
137
- direction=var.direction,
138
- quantum_type=var.symbol.quantum_type,
139
- )
140
- for var in self._stack[-1]
141
- )
142
-
143
- def get_propagated_variables(self, flatten: bool) -> list[HandleBinding]:
144
- return list(
145
- dict.fromkeys(
146
- [self._get_propagated_handle(var, flatten) for var in self._stack[-1]]
147
- )
148
- )
149
-
150
- def _get_propagated_handle(
151
- self, var: PropagatedVariable, flatten: bool
152
- ) -> HandleBinding:
153
- if (
154
- var.defining_function == self._builder.current_function.name
155
- or not isinstance(
156
- self._builder.current_function, GenerativeFunctionClosure
157
- ) # FIXME doesn't work for all cases (CAD-22663)
158
- and self._no_name_conflict(var)
159
- ):
160
- handle_name = var.name
161
- if var in self._to_mangle:
162
- self._to_mangle.pop(var)
163
- else:
164
- handle_name = mangle_captured_var_name(var.name, var.defining_function)
165
- self._to_mangle[var] = handle_name
166
- if flatten:
167
- return HandleBinding(name=handle_name)
168
- return var.handle.rename(handle_name)
169
-
170
- def _no_name_conflict(self, var: PropagatedVariable) -> bool:
171
- return var.name not in self._builder.current_function.colliding_variables
172
-
173
-
174
- def validate_args_are_not_propagated(
175
- args: Sequence[ArgValue], captured_vars: Sequence[HandleBinding]
176
- ) -> None:
177
- if not captured_vars:
178
- return
179
- captured_handles = {demangle_handle(handle) for handle in captured_vars}
180
- arg_handles = {
181
- demangle_handle(arg) for arg in args if isinstance(arg, HandleBinding)
182
- }
183
- if any(
184
- arg_handle.overlaps(captured_handle)
185
- for arg_handle in arg_handles
186
- for captured_handle in captured_handles
187
- ):
188
- captured_handles_str = {str(handle) for handle in captured_handles}
189
- arg_handles_str = {str(handle) for handle in arg_handles}
190
- vars_msg = f"Explicitly passed variables: {arg_handles_str}, captured variables: {captured_handles_str}"
191
- raise ClassiqExpansionError(
192
- f"Cannot capture variables that are explicitly passed as arguments. "
193
- f"{vars_msg}"
194
- )