classiq 0.93.0__py3-none-any.whl → 0.99.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.
- classiq/__init__.py +11 -19
- classiq/_analyzer_extras/_ipywidgets_async_extension.py +7 -7
- classiq/_analyzer_extras/interactive_hardware.py +19 -12
- classiq/_internals/api_wrapper.py +31 -142
- classiq/_internals/async_utils.py +4 -7
- classiq/_internals/authentication/auth0.py +41 -15
- classiq/_internals/authentication/authorization_code.py +9 -0
- classiq/_internals/authentication/authorization_flow.py +41 -0
- classiq/_internals/authentication/device.py +33 -52
- classiq/_internals/authentication/hybrid_flow.py +19 -0
- classiq/_internals/authentication/password_manager.py +13 -13
- classiq/_internals/authentication/token_manager.py +9 -9
- classiq/_internals/client.py +17 -44
- classiq/_internals/config.py +19 -5
- classiq/_internals/help.py +1 -2
- classiq/_internals/host_checker.py +3 -3
- classiq/_internals/jobs.py +14 -14
- classiq/_internals/type_validation.py +3 -3
- classiq/analyzer/analyzer.py +18 -18
- classiq/analyzer/rb.py +17 -8
- classiq/analyzer/show_interactive_hack.py +1 -1
- classiq/applications/__init__.py +2 -2
- classiq/applications/chemistry/__init__.py +0 -30
- classiq/applications/chemistry/op_utils.py +4 -4
- classiq/applications/chemistry/problems.py +3 -3
- classiq/applications/chemistry/ucc.py +1 -2
- classiq/applications/chemistry/z2_symmetries.py +4 -4
- classiq/applications/combinatorial_helpers/allowed_constraints.py +1 -3
- classiq/applications/combinatorial_helpers/arithmetic/arithmetic_expression.py +2 -1
- classiq/applications/combinatorial_helpers/combinatorial_problem_utils.py +2 -2
- classiq/applications/combinatorial_helpers/encoding_mapping.py +2 -3
- classiq/applications/combinatorial_helpers/encoding_utils.py +2 -2
- classiq/applications/combinatorial_helpers/optimization_model.py +3 -4
- classiq/applications/combinatorial_helpers/pauli_helpers/pauli_sparsing.py +2 -2
- classiq/applications/combinatorial_helpers/pyomo_utils.py +8 -8
- classiq/applications/combinatorial_helpers/sympy_utils.py +1 -3
- classiq/applications/combinatorial_helpers/transformations/encoding.py +3 -3
- classiq/applications/combinatorial_helpers/transformations/fixed_variables.py +1 -2
- classiq/applications/combinatorial_optimization/combinatorial_optimization_config.py +2 -3
- classiq/applications/combinatorial_optimization/combinatorial_optimization_model_constructor.py +4 -6
- classiq/applications/combinatorial_optimization/combinatorial_problem.py +15 -10
- classiq/applications/hamiltonian/pauli_decomposition.py +6 -4
- classiq/applications/iqae/iqae.py +14 -11
- classiq/applications/qnn/datasets/dataset_base_classes.py +6 -6
- classiq/applications/qnn/datasets/dataset_parity.py +6 -6
- classiq/applications/qnn/gradients/simple_quantum_gradient.py +1 -1
- classiq/applications/qnn/qlayer.py +9 -8
- classiq/applications/qnn/torch_utils.py +5 -6
- classiq/applications/qnn/types.py +2 -1
- classiq/applications/qsp/__init__.py +20 -2
- classiq/applications/qsp/qsp.py +238 -10
- classiq/applications/qsvm/qsvm_data_generation.py +1 -2
- classiq/evaluators/classical_expression.py +0 -4
- classiq/evaluators/parameter_types.py +10 -8
- classiq/evaluators/qmod_annotated_expression.py +31 -26
- classiq/evaluators/qmod_expression_visitors/qmod_expression_evaluator.py +14 -14
- classiq/evaluators/qmod_expression_visitors/qmod_expression_simplifier.py +2 -1
- classiq/evaluators/qmod_expression_visitors/sympy_wrappers.py +8 -8
- classiq/evaluators/qmod_node_evaluators/binary_op_evaluation.py +4 -4
- classiq/evaluators/qmod_node_evaluators/classical_function_evaluation.py +14 -4
- classiq/evaluators/qmod_node_evaluators/list_evaluation.py +2 -2
- classiq/evaluators/qmod_node_evaluators/numeric_attrs_utils.py +3 -3
- classiq/evaluators/qmod_node_evaluators/subscript_evaluation.py +9 -9
- classiq/evaluators/qmod_node_evaluators/utils.py +6 -6
- classiq/evaluators/qmod_type_inference/classical_type_inference.py +9 -10
- classiq/evaluators/qmod_type_inference/quantum_type_inference.py +5 -5
- classiq/execution/__init__.py +0 -3
- classiq/execution/execution_session.py +28 -21
- classiq/execution/jobs.py +26 -26
- classiq/execution/qnn.py +1 -2
- classiq/execution/user_budgets.py +71 -37
- classiq/executor.py +1 -3
- classiq/interface/_version.py +1 -1
- classiq/interface/analyzer/analysis_params.py +4 -4
- classiq/interface/analyzer/cytoscape_graph.py +3 -3
- classiq/interface/analyzer/result.py +4 -4
- classiq/interface/ast_node.py +3 -3
- classiq/interface/backend/backend_preferences.py +26 -50
- classiq/interface/backend/ionq/ionq_quantum_program.py +5 -5
- classiq/interface/backend/provider_config/__init__.py +0 -0
- classiq/interface/backend/provider_config/provider_config.py +8 -0
- classiq/interface/backend/provider_config/providers/__init__.py +0 -0
- classiq/interface/backend/provider_config/providers/alice_bob.py +47 -0
- classiq/interface/backend/provider_config/providers/aqt.py +16 -0
- classiq/interface/backend/provider_config/providers/azure.py +37 -0
- classiq/interface/backend/provider_config/providers/braket.py +39 -0
- classiq/interface/backend/provider_config/providers/ibm.py +26 -0
- classiq/interface/backend/provider_config/providers/ionq.py +22 -0
- classiq/interface/backend/quantum_backend_providers.py +20 -2
- classiq/interface/chemistry/ansatz_library.py +3 -5
- classiq/interface/chemistry/operator.py +3 -3
- classiq/interface/combinatorial_optimization/examples/knapsack.py +2 -4
- classiq/interface/combinatorial_optimization/examples/tsp_digraph.py +1 -2
- classiq/interface/compression_utils.py +2 -3
- classiq/interface/debug_info/debug_info.py +8 -7
- classiq/interface/exceptions.py +6 -7
- classiq/interface/execution/primitives.py +6 -6
- classiq/interface/executor/estimate_cost.py +1 -1
- classiq/interface/executor/execution_preferences.py +3 -5
- classiq/interface/executor/execution_request.py +10 -10
- classiq/interface/executor/execution_result.py +1 -2
- classiq/interface/executor/quantum_code.py +8 -8
- classiq/interface/executor/result.py +28 -18
- classiq/interface/executor/user_budget.py +25 -17
- classiq/interface/executor/vqe_result.py +5 -6
- classiq/interface/generator/ansatz_library.py +6 -8
- classiq/interface/generator/application_apis/__init__.py +0 -3
- classiq/interface/generator/arith/arithmetic.py +2 -2
- classiq/interface/generator/arith/arithmetic_arg_type_validator.py +2 -3
- classiq/interface/generator/arith/arithmetic_expression_abc.py +4 -5
- classiq/interface/generator/arith/arithmetic_expression_parser.py +11 -4
- classiq/interface/generator/arith/arithmetic_expression_validator.py +12 -15
- classiq/interface/generator/arith/arithmetic_operations.py +4 -6
- classiq/interface/generator/arith/arithmetic_param_getters.py +70 -107
- classiq/interface/generator/arith/arithmetic_result_builder.py +4 -4
- classiq/interface/generator/arith/ast_node_rewrite.py +8 -4
- classiq/interface/generator/arith/binary_ops.py +15 -40
- classiq/interface/generator/arith/logical_ops.py +2 -3
- classiq/interface/generator/arith/number_utils.py +2 -2
- classiq/interface/generator/arith/register_user_input.py +3 -3
- classiq/interface/generator/arith/unary_ops.py +2 -2
- classiq/interface/generator/circuit_code/circuit_code.py +8 -10
- classiq/interface/generator/circuit_code/types_and_constants.py +1 -1
- classiq/interface/generator/complex_type.py +2 -2
- classiq/interface/generator/copy.py +1 -3
- classiq/interface/generator/expressions/atomic_expression_functions.py +0 -5
- classiq/interface/generator/expressions/evaluated_expression.py +2 -3
- classiq/interface/generator/expressions/expression.py +2 -2
- classiq/interface/generator/expressions/proxies/classical/classical_array_proxy.py +4 -7
- classiq/interface/generator/function_param_list.py +0 -40
- classiq/interface/generator/function_params.py +5 -6
- classiq/interface/generator/functions/classical_function_declaration.py +2 -2
- classiq/interface/generator/functions/classical_type.py +3 -3
- classiq/interface/generator/functions/type_modifier.py +0 -15
- classiq/interface/generator/functions/type_name.py +2 -2
- classiq/interface/generator/generated_circuit_data.py +14 -18
- classiq/interface/generator/hamiltonian_evolution/exponentiation.py +2 -4
- classiq/interface/generator/hardware/hardware_data.py +8 -8
- classiq/interface/generator/hardware_efficient_ansatz.py +9 -9
- classiq/interface/generator/mcu.py +3 -3
- classiq/interface/generator/mcx.py +3 -3
- classiq/interface/generator/model/constraints.py +34 -5
- classiq/interface/generator/model/preferences/preferences.py +15 -21
- classiq/interface/generator/model/quantum_register.py +7 -10
- classiq/interface/generator/noise_properties.py +3 -7
- classiq/interface/generator/parameters.py +1 -1
- classiq/interface/generator/partitioned_register.py +1 -2
- classiq/interface/generator/preferences/qasm_to_qmod_params.py +11 -0
- classiq/interface/generator/quantum_function_call.py +9 -12
- classiq/interface/generator/quantum_program.py +10 -23
- classiq/interface/generator/range_types.py +3 -3
- classiq/interface/generator/slice_parsing_utils.py +4 -5
- classiq/interface/generator/standard_gates/standard_gates.py +2 -4
- classiq/interface/generator/synthesis_execution_parameter.py +1 -3
- classiq/interface/generator/synthesis_metadata/synthesis_duration.py +9 -0
- classiq/interface/generator/synthesis_metadata/synthesis_execution_data.py +2 -3
- classiq/interface/generator/transpiler_basis_gates.py +12 -4
- classiq/interface/generator/types/builtin_enum_declarations.py +0 -145
- classiq/interface/generator/types/compilation_metadata.py +12 -1
- classiq/interface/generator/types/enum_declaration.py +2 -1
- classiq/interface/generator/validations/flow_graph.py +3 -3
- classiq/interface/generator/visitor.py +10 -12
- classiq/interface/hardware.py +2 -3
- classiq/interface/helpers/classproperty.py +2 -2
- classiq/interface/helpers/custom_encoders.py +2 -1
- classiq/interface/helpers/custom_pydantic_types.py +1 -1
- classiq/interface/helpers/text_utils.py +1 -4
- classiq/interface/ide/visual_model.py +6 -5
- classiq/interface/interface_version.py +1 -1
- classiq/interface/jobs.py +3 -3
- classiq/interface/model/allocate.py +4 -4
- classiq/interface/model/block.py +6 -2
- classiq/interface/model/bounds.py +3 -3
- classiq/interface/model/classical_if.py +4 -0
- classiq/interface/model/control.py +8 -1
- classiq/interface/model/inplace_binary_operation.py +2 -2
- classiq/interface/model/invert.py +4 -0
- classiq/interface/model/model.py +4 -4
- classiq/interface/model/model_visitor.py +40 -1
- classiq/interface/model/parameter.py +1 -3
- classiq/interface/model/port_declaration.py +1 -1
- classiq/interface/model/power.py +4 -0
- classiq/interface/model/quantum_expressions/quantum_expression.py +1 -2
- classiq/interface/model/quantum_function_call.py +3 -6
- classiq/interface/model/quantum_function_declaration.py +1 -0
- classiq/interface/model/quantum_lambda_function.py +4 -4
- classiq/interface/model/quantum_statement.py +11 -4
- classiq/interface/model/quantum_type.py +14 -14
- classiq/interface/model/repeat.py +4 -0
- classiq/interface/model/skip_control.py +4 -0
- classiq/interface/model/validation_handle.py +2 -3
- classiq/interface/model/variable_declaration_statement.py +2 -2
- classiq/interface/model/within_apply_operation.py +4 -0
- classiq/interface/pretty_print/expression_to_qmod.py +3 -4
- classiq/interface/server/routes.py +0 -16
- classiq/interface/source_reference.py +3 -4
- classiq/model_expansions/arithmetic.py +11 -7
- classiq/model_expansions/arithmetic_compute_result_attrs.py +30 -27
- classiq/model_expansions/capturing/captured_vars.py +3 -3
- classiq/model_expansions/capturing/mangling_utils.py +1 -2
- classiq/model_expansions/closure.py +12 -11
- classiq/model_expansions/function_builder.py +14 -6
- classiq/model_expansions/generative_functions.py +7 -12
- classiq/model_expansions/interpreters/base_interpreter.py +3 -7
- classiq/model_expansions/interpreters/frontend_generative_interpreter.py +2 -1
- classiq/model_expansions/interpreters/generative_interpreter.py +5 -3
- classiq/model_expansions/quantum_operations/allocate.py +4 -4
- classiq/model_expansions/quantum_operations/assignment_result_processor.py +2 -4
- classiq/model_expansions/quantum_operations/call_emitter.py +31 -37
- classiq/model_expansions/quantum_operations/declarative_call_emitter.py +2 -2
- classiq/model_expansions/quantum_operations/emitter.py +3 -5
- classiq/model_expansions/quantum_operations/expression_evaluator.py +3 -3
- classiq/model_expansions/quantum_operations/skip_control_verifier.py +1 -2
- classiq/model_expansions/quantum_operations/variable_decleration.py +2 -2
- classiq/model_expansions/scope.py +7 -7
- classiq/model_expansions/scope_initialization.py +4 -0
- classiq/model_expansions/visitors/symbolic_param_inference.py +6 -6
- classiq/model_expansions/visitors/uncomputation_signature_inference.py +328 -0
- classiq/model_expansions/visitors/variable_references.py +15 -14
- classiq/open_library/functions/__init__.py +28 -11
- classiq/open_library/functions/amplitude_loading.py +81 -0
- classiq/open_library/functions/discrete_sine_cosine_transform.py +5 -5
- classiq/open_library/functions/grover.py +8 -10
- classiq/open_library/functions/lcu.py +47 -18
- classiq/open_library/functions/modular_exponentiation.py +93 -8
- classiq/open_library/functions/qsvt.py +66 -79
- classiq/open_library/functions/qsvt_temp.py +536 -0
- classiq/open_library/functions/state_preparation.py +130 -27
- classiq/qmod/__init__.py +6 -4
- classiq/qmod/builtins/classical_execution_primitives.py +4 -23
- classiq/qmod/builtins/classical_functions.py +1 -42
- classiq/qmod/builtins/enums.py +15 -153
- classiq/qmod/builtins/functions/__init__.py +9 -18
- classiq/qmod/builtins/functions/allocation.py +25 -4
- classiq/qmod/builtins/functions/arithmetic.py +22 -27
- classiq/qmod/builtins/functions/exponentiation.py +51 -2
- classiq/qmod/builtins/functions/mcx_func.py +7 -0
- classiq/qmod/builtins/functions/standard_gates.py +46 -27
- classiq/qmod/builtins/operations.py +165 -79
- classiq/qmod/builtins/structs.py +24 -91
- classiq/qmod/cfunc.py +3 -2
- classiq/qmod/classical_function.py +2 -1
- classiq/qmod/cparam.py +2 -8
- classiq/qmod/create_model_function.py +7 -7
- classiq/qmod/declaration_inferrer.py +33 -30
- classiq/qmod/expression_query.py +7 -4
- classiq/qmod/model_state_container.py +2 -2
- classiq/qmod/native/pretty_printer.py +25 -14
- classiq/qmod/pretty_print/expression_to_python.py +5 -3
- classiq/qmod/pretty_print/pretty_printer.py +39 -17
- classiq/qmod/python_classical_type.py +40 -13
- classiq/qmod/qfunc.py +124 -19
- classiq/qmod/qmod_constant.py +2 -2
- classiq/qmod/qmod_parameter.py +5 -2
- classiq/qmod/qmod_variable.py +47 -46
- classiq/qmod/quantum_callable.py +18 -13
- classiq/qmod/quantum_expandable.py +31 -26
- classiq/qmod/quantum_function.py +84 -36
- classiq/qmod/semantics/annotation/call_annotation.py +5 -5
- classiq/qmod/semantics/error_manager.py +12 -14
- classiq/qmod/semantics/lambdas.py +1 -2
- classiq/qmod/semantics/validation/types_validation.py +1 -2
- classiq/qmod/symbolic.py +2 -4
- classiq/qmod/utilities.py +13 -20
- classiq/qmod/write_qmod.py +3 -4
- classiq/quantum_program.py +1 -3
- classiq/synthesis.py +11 -7
- {classiq-0.93.0.dist-info → classiq-0.99.0.dist-info}/METADATA +2 -3
- {classiq-0.93.0.dist-info → classiq-0.99.0.dist-info}/RECORD +271 -299
- {classiq-0.93.0.dist-info → classiq-0.99.0.dist-info}/WHEEL +1 -1
- classiq/applications/chemistry/ansatz_parameters.py +0 -29
- classiq/applications/chemistry/chemistry_execution_parameters.py +0 -16
- classiq/applications/chemistry/chemistry_model_constructor.py +0 -532
- classiq/applications/chemistry/ground_state_problem.py +0 -42
- classiq/applications/qsvm/__init__.py +0 -8
- classiq/applications/qsvm/qsvm.py +0 -11
- classiq/evaluators/qmod_expression_visitors/qmod_expression_bwc.py +0 -129
- classiq/execution/iqcc.py +0 -128
- classiq/interface/applications/qsvm.py +0 -117
- classiq/interface/chemistry/elements.py +0 -120
- classiq/interface/chemistry/fermionic_operator.py +0 -208
- classiq/interface/chemistry/ground_state_problem.py +0 -132
- classiq/interface/chemistry/ground_state_result.py +0 -8
- classiq/interface/chemistry/molecule.py +0 -71
- classiq/interface/execution/iqcc.py +0 -44
- classiq/interface/generator/application_apis/chemistry_declarations.py +0 -69
- classiq/interface/generator/application_apis/entangler_declarations.py +0 -29
- classiq/interface/generator/application_apis/qsvm_declarations.py +0 -6
- classiq/interface/generator/chemistry_function_params.py +0 -50
- classiq/interface/generator/entangler_params.py +0 -72
- classiq/interface/generator/entanglers.py +0 -14
- classiq/interface/generator/hamiltonian_evolution/qdrift.py +0 -27
- classiq/interface/generator/hartree_fock.py +0 -26
- classiq/interface/generator/hva.py +0 -22
- classiq/interface/generator/linear_pauli_rotations.py +0 -92
- classiq/interface/generator/qft.py +0 -37
- classiq/interface/generator/qsvm.py +0 -96
- classiq/interface/generator/state_preparation/__init__.py +0 -14
- classiq/interface/generator/state_preparation/bell_state_preparation.py +0 -27
- classiq/interface/generator/state_preparation/computational_basis_state_preparation.py +0 -28
- classiq/interface/generator/state_preparation/distributions.py +0 -53
- classiq/interface/generator/state_preparation/exponential_state_preparation.py +0 -14
- classiq/interface/generator/state_preparation/ghz_state_preparation.py +0 -14
- classiq/interface/generator/state_preparation/metrics.py +0 -41
- classiq/interface/generator/state_preparation/state_preparation.py +0 -113
- classiq/interface/generator/state_preparation/state_preparation_abc.py +0 -24
- classiq/interface/generator/state_preparation/uniform_distibution_state_preparation.py +0 -13
- classiq/interface/generator/state_preparation/w_state_preparation.py +0 -13
- classiq/interface/generator/ucc.py +0 -74
- classiq/interface/helpers/backward_compatibility.py +0 -9
- classiq/model_expansions/transformers/type_modifier_inference.py +0 -392
- classiq/open_library/functions/lookup_table.py +0 -58
- classiq/qmod/builtins/functions/chemistry.py +0 -123
- classiq/qmod/builtins/functions/qsvm.py +0 -24
- {classiq-0.93.0.dist-info → classiq-0.99.0.dist-info}/licenses/LICENSE.txt +0 -0
|
@@ -4,139 +4,6 @@
|
|
|
4
4
|
from enum import IntEnum
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
class Element(IntEnum):
|
|
8
|
-
H = 0
|
|
9
|
-
He = 1
|
|
10
|
-
Li = 2
|
|
11
|
-
Be = 3
|
|
12
|
-
B = 4
|
|
13
|
-
C = 5
|
|
14
|
-
N = 6
|
|
15
|
-
O = 7 # noqa: E741
|
|
16
|
-
F = 8
|
|
17
|
-
Ne = 9
|
|
18
|
-
Na = 10
|
|
19
|
-
Mg = 11
|
|
20
|
-
Al = 12
|
|
21
|
-
Si = 13
|
|
22
|
-
P = 14
|
|
23
|
-
S = 15
|
|
24
|
-
Cl = 16
|
|
25
|
-
Ar = 17
|
|
26
|
-
K = 18
|
|
27
|
-
Ca = 19
|
|
28
|
-
Sc = 20
|
|
29
|
-
Ti = 21
|
|
30
|
-
V = 22
|
|
31
|
-
Cr = 23
|
|
32
|
-
Mn = 24
|
|
33
|
-
Fe = 25
|
|
34
|
-
Co = 26
|
|
35
|
-
Ni = 27
|
|
36
|
-
Cu = 28
|
|
37
|
-
Zn = 29
|
|
38
|
-
Ga = 30
|
|
39
|
-
Ge = 31
|
|
40
|
-
As = 32
|
|
41
|
-
Se = 33
|
|
42
|
-
Br = 34
|
|
43
|
-
Kr = 35
|
|
44
|
-
Rb = 36
|
|
45
|
-
Sr = 37
|
|
46
|
-
Y = 38
|
|
47
|
-
Zr = 39
|
|
48
|
-
Nb = 40
|
|
49
|
-
Mo = 41
|
|
50
|
-
Tc = 42
|
|
51
|
-
Ru = 43
|
|
52
|
-
Rh = 44
|
|
53
|
-
Pd = 45
|
|
54
|
-
Ag = 46
|
|
55
|
-
Cd = 47
|
|
56
|
-
In = 48
|
|
57
|
-
Sn = 49
|
|
58
|
-
Sb = 50
|
|
59
|
-
Te = 51
|
|
60
|
-
I = 52 # noqa: E741
|
|
61
|
-
Xe = 53
|
|
62
|
-
Cs = 54
|
|
63
|
-
Ba = 55
|
|
64
|
-
La = 56
|
|
65
|
-
Ce = 57
|
|
66
|
-
Pr = 58
|
|
67
|
-
Nd = 59
|
|
68
|
-
Pm = 60
|
|
69
|
-
Sm = 61
|
|
70
|
-
Eu = 62
|
|
71
|
-
Gd = 63
|
|
72
|
-
Tb = 64
|
|
73
|
-
Dy = 65
|
|
74
|
-
Ho = 66
|
|
75
|
-
Er = 67
|
|
76
|
-
Tm = 68
|
|
77
|
-
Yb = 69
|
|
78
|
-
Lu = 70
|
|
79
|
-
Hf = 71
|
|
80
|
-
Ta = 72
|
|
81
|
-
W = 73
|
|
82
|
-
Re = 74
|
|
83
|
-
Os = 75
|
|
84
|
-
Ir = 76
|
|
85
|
-
Pt = 77
|
|
86
|
-
Au = 78
|
|
87
|
-
Hg = 79
|
|
88
|
-
Tl = 80
|
|
89
|
-
Pb = 81
|
|
90
|
-
Bi = 82
|
|
91
|
-
Po = 83
|
|
92
|
-
At = 84
|
|
93
|
-
Rn = 85
|
|
94
|
-
Fr = 86
|
|
95
|
-
Ra = 87
|
|
96
|
-
Ac = 88
|
|
97
|
-
Th = 89
|
|
98
|
-
Pa = 90
|
|
99
|
-
U = 91
|
|
100
|
-
Np = 92
|
|
101
|
-
Pu = 93
|
|
102
|
-
Am = 94
|
|
103
|
-
Cm = 95
|
|
104
|
-
Bk = 96
|
|
105
|
-
Cf = 97
|
|
106
|
-
Es = 98
|
|
107
|
-
Fm = 99
|
|
108
|
-
Md = 100
|
|
109
|
-
No = 101
|
|
110
|
-
Lr = 102
|
|
111
|
-
Rf = 103
|
|
112
|
-
Db = 104
|
|
113
|
-
Sg = 105
|
|
114
|
-
Bh = 106
|
|
115
|
-
Hs = 107
|
|
116
|
-
Mt = 108
|
|
117
|
-
Ds = 109
|
|
118
|
-
Rg = 110
|
|
119
|
-
Cn = 111
|
|
120
|
-
Nh = 112
|
|
121
|
-
Fl = 113
|
|
122
|
-
Mc = 114
|
|
123
|
-
Lv = 115
|
|
124
|
-
Ts = 116
|
|
125
|
-
Og = 117
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
class FermionMapping(IntEnum):
|
|
129
|
-
JORDAN_WIGNER = 0
|
|
130
|
-
PARITY = 1
|
|
131
|
-
BRAVYI_KITAEV = 2
|
|
132
|
-
FAST_BRAVYI_KITAEV = 3
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
class LadderOperator(IntEnum):
|
|
136
|
-
PLUS = 0
|
|
137
|
-
MINUS = 1
|
|
138
|
-
|
|
139
|
-
|
|
140
7
|
class Optimizer(IntEnum):
|
|
141
8
|
COBYLA = 1
|
|
142
9
|
SPSA = 2
|
|
@@ -153,19 +20,7 @@ class Pauli(IntEnum):
|
|
|
153
20
|
Z = 3
|
|
154
21
|
|
|
155
22
|
|
|
156
|
-
class QSVMFeatureMapEntanglement(IntEnum):
|
|
157
|
-
FULL = 0
|
|
158
|
-
LINEAR = 1
|
|
159
|
-
CIRCULAR = 2
|
|
160
|
-
SCA = 3
|
|
161
|
-
PAIRWISE = 4
|
|
162
|
-
|
|
163
|
-
|
|
164
23
|
__all__ = [
|
|
165
|
-
"Element",
|
|
166
|
-
"FermionMapping",
|
|
167
|
-
"LadderOperator",
|
|
168
24
|
"Optimizer",
|
|
169
25
|
"Pauli",
|
|
170
|
-
"QSVMFeatureMapEntanglement",
|
|
171
26
|
]
|
|
@@ -5,7 +5,8 @@ class CompilationMetadata(BaseModel):
|
|
|
5
5
|
should_synthesize_separately: bool = Field(default=False)
|
|
6
6
|
occurrences_number: NonNegativeInt = Field(default=1)
|
|
7
7
|
_occupation_number: NonNegativeInt = PrivateAttr(default=0)
|
|
8
|
-
|
|
8
|
+
disable_perm_check: bool = Field(default=False)
|
|
9
|
+
disable_const_checks: list[str] | bool = Field(default=False)
|
|
9
10
|
|
|
10
11
|
@property
|
|
11
12
|
def occupation_number(self) -> NonNegativeInt:
|
|
@@ -14,3 +15,13 @@ class CompilationMetadata(BaseModel):
|
|
|
14
15
|
@occupation_number.setter
|
|
15
16
|
def occupation_number(self, value: NonNegativeInt) -> None:
|
|
16
17
|
self._occupation_number = value
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def has_user_directives(self) -> bool:
|
|
21
|
+
return bool(self.disable_perm_check or self.disable_const_checks)
|
|
22
|
+
|
|
23
|
+
def copy_user_directives(self) -> "CompilationMetadata":
|
|
24
|
+
return CompilationMetadata(
|
|
25
|
+
disable_perm_check=self.disable_perm_check,
|
|
26
|
+
disable_const_checks=self.disable_const_checks,
|
|
27
|
+
)
|
|
@@ -2,7 +2,7 @@ from collections import Counter, defaultdict
|
|
|
2
2
|
from collections.abc import Collection, Iterable, Mapping
|
|
3
3
|
from dataclasses import dataclass
|
|
4
4
|
from itertools import chain
|
|
5
|
-
from typing import
|
|
5
|
+
from typing import TypeVar
|
|
6
6
|
|
|
7
7
|
import networkx as nx
|
|
8
8
|
|
|
@@ -23,8 +23,8 @@ RECURRING_NAMES_ERROR_MSG = "Recurring wire names"
|
|
|
23
23
|
|
|
24
24
|
@dataclass
|
|
25
25
|
class Wire:
|
|
26
|
-
start:
|
|
27
|
-
end:
|
|
26
|
+
start: PydanticNonEmptyString | None = None
|
|
27
|
+
end: PydanticNonEmptyString | None = None
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
def _parse_call_inputs(
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
from collections import abc, defaultdict
|
|
2
|
-
from collections.abc import Collection, Mapping, Sequence
|
|
2
|
+
from collections.abc import Callable, Collection, Mapping, Sequence
|
|
3
3
|
from functools import partial
|
|
4
4
|
from typing import (
|
|
5
5
|
TYPE_CHECKING,
|
|
6
6
|
Any,
|
|
7
|
-
Callable,
|
|
8
|
-
Optional,
|
|
9
7
|
TypeVar,
|
|
10
8
|
Union,
|
|
11
9
|
)
|
|
@@ -30,7 +28,7 @@ Ret = TypeVar("Ret", bound=RetType)
|
|
|
30
28
|
|
|
31
29
|
|
|
32
30
|
class Visitor:
|
|
33
|
-
def visit(self, node: NodeType) ->
|
|
31
|
+
def visit(self, node: NodeType) -> RetType | None:
|
|
34
32
|
for cls in type(node).__mro__:
|
|
35
33
|
method = "visit_" + cls.__name__
|
|
36
34
|
if hasattr(self, method):
|
|
@@ -38,40 +36,40 @@ class Visitor:
|
|
|
38
36
|
return visitor(node)
|
|
39
37
|
return self.generic_visit(node)
|
|
40
38
|
|
|
41
|
-
def generic_visit(self, node: NodeType) ->
|
|
39
|
+
def generic_visit(self, node: NodeType) -> RetType | None:
|
|
42
40
|
if isinstance(node, BaseModel):
|
|
43
41
|
return self.visit_BaseModel(node)
|
|
44
42
|
|
|
45
43
|
return node
|
|
46
44
|
|
|
47
|
-
def visit_list(self, node: list[NodeType]) ->
|
|
45
|
+
def visit_list(self, node: list[NodeType]) -> RetType | None:
|
|
48
46
|
for elem in node:
|
|
49
47
|
self.visit(elem)
|
|
50
48
|
|
|
51
49
|
return None
|
|
52
50
|
|
|
53
|
-
def visit_dict(self, node: dict[Key, NodeType]) ->
|
|
51
|
+
def visit_dict(self, node: dict[Key, NodeType]) -> RetType | None:
|
|
54
52
|
for value in node.values():
|
|
55
53
|
self.visit(value)
|
|
56
54
|
|
|
57
55
|
return None
|
|
58
56
|
|
|
59
|
-
def visit_tuple(self, node: tuple[NodeType, ...]) ->
|
|
57
|
+
def visit_tuple(self, node: tuple[NodeType, ...]) -> tuple[RetType, ...] | None:
|
|
60
58
|
for value in node:
|
|
61
59
|
self.visit(value)
|
|
62
60
|
|
|
63
61
|
return None
|
|
64
62
|
|
|
65
|
-
def visit_BaseModel(self, node: BaseModel) ->
|
|
63
|
+
def visit_BaseModel(self, node: BaseModel) -> RetType | None:
|
|
66
64
|
for _, value in node:
|
|
67
65
|
self.visit(value)
|
|
68
66
|
|
|
69
67
|
return None
|
|
70
68
|
|
|
71
|
-
def visit_int(self, n: int) ->
|
|
69
|
+
def visit_int(self, n: int) -> RetType | None:
|
|
72
70
|
return None
|
|
73
71
|
|
|
74
|
-
def visit_bool(self, b: bool) ->
|
|
72
|
+
def visit_bool(self, b: bool) -> RetType | None:
|
|
75
73
|
return None
|
|
76
74
|
|
|
77
75
|
|
|
@@ -103,7 +101,7 @@ class Transformer(Visitor):
|
|
|
103
101
|
return tuple(self.visit(value) for value in node)
|
|
104
102
|
|
|
105
103
|
def visit_BaseModel(
|
|
106
|
-
self, node: BaseModel, fields_to_skip:
|
|
104
|
+
self, node: BaseModel, fields_to_skip: Collection[str] | None = None
|
|
107
105
|
) -> RetType:
|
|
108
106
|
fields_to_skip = fields_to_skip or set()
|
|
109
107
|
|
classiq/interface/hardware.py
CHANGED
|
@@ -32,7 +32,6 @@ class Provider(StrEnum):
|
|
|
32
32
|
OQC = "OQC"
|
|
33
33
|
INTEL = "Intel"
|
|
34
34
|
AQT = "AQT"
|
|
35
|
-
IQCC = "IQCC"
|
|
36
35
|
CINECA = "CINECA"
|
|
37
36
|
|
|
38
37
|
@property
|
|
@@ -71,7 +70,7 @@ class HardwareStatus(pydantic.BaseModel):
|
|
|
71
70
|
default=None,
|
|
72
71
|
description="The estimated queue time for the hardware in seconds.",
|
|
73
72
|
)
|
|
74
|
-
pending_jobs:
|
|
73
|
+
pending_jobs: int | None = None
|
|
75
74
|
|
|
76
75
|
|
|
77
76
|
if TYPE_CHECKING:
|
|
@@ -87,7 +86,7 @@ class HardwareInformation(pydantic.BaseModel):
|
|
|
87
86
|
display_name: str
|
|
88
87
|
device_type: DeviceType
|
|
89
88
|
number_of_qubits: int
|
|
90
|
-
connectivity_map:
|
|
89
|
+
connectivity_map: list[ConnectivityMapEntry] | None = None
|
|
91
90
|
basis_gates: list[str]
|
|
92
91
|
status: HardwareStatus
|
|
93
92
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
from typing import TYPE_CHECKING, Any
|
|
1
|
+
from typing import TYPE_CHECKING, Any
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
class classproperty(property): # noqa: N801
|
|
5
|
-
def __get__(self, owner_self: Any, owner_cls:
|
|
5
|
+
def __get__(self, owner_self: Any, owner_cls: type | None = None) -> Any:
|
|
6
6
|
if TYPE_CHECKING:
|
|
7
7
|
assert self.fget is not None
|
|
8
8
|
return self.fget(owner_cls)
|
|
@@ -3,7 +3,7 @@ from collections import Counter
|
|
|
3
3
|
from collections.abc import Iterator
|
|
4
4
|
from functools import cached_property
|
|
5
5
|
from itertools import count
|
|
6
|
-
from typing import Any
|
|
6
|
+
from typing import Any
|
|
7
7
|
|
|
8
8
|
import pydantic
|
|
9
9
|
from pydantic import ConfigDict, field_validator
|
|
@@ -43,10 +43,11 @@ class OperationType(StrEnum):
|
|
|
43
43
|
FREE = "FREE"
|
|
44
44
|
BIND = "BIND"
|
|
45
45
|
ATOMIC = "ATOMIC"
|
|
46
|
+
UNORDERED_CHILDREN = "UNORDERED_CHILDREN"
|
|
46
47
|
|
|
47
48
|
|
|
48
49
|
class OperationData(pydantic.BaseModel):
|
|
49
|
-
approximated_depth:
|
|
50
|
+
approximated_depth: int | None = None
|
|
50
51
|
width: int
|
|
51
52
|
gate_count: Counter[str] = pydantic.Field(default_factory=dict)
|
|
52
53
|
|
|
@@ -65,7 +66,7 @@ class ProgramData(pydantic.BaseModel):
|
|
|
65
66
|
|
|
66
67
|
class OperationLink(pydantic.BaseModel):
|
|
67
68
|
label: str
|
|
68
|
-
inner_label:
|
|
69
|
+
inner_label: str | None = None
|
|
69
70
|
qubits: tuple[int, ...]
|
|
70
71
|
type: str
|
|
71
72
|
is_captured: bool = False
|
|
@@ -148,14 +149,14 @@ class AtomicGate(StrEnum):
|
|
|
148
149
|
|
|
149
150
|
class Operation(pydantic.BaseModel):
|
|
150
151
|
name: str
|
|
151
|
-
inner_label:
|
|
152
|
+
inner_label: str | None = None
|
|
152
153
|
_id: int = pydantic.PrivateAttr(default_factory=_operation_id_counter.next_id)
|
|
153
154
|
qasm_name: str = pydantic.Field(default="")
|
|
154
155
|
details: str = pydantic.Field(default="")
|
|
155
156
|
children: list["Operation"] = pydantic.Field(default_factory=list)
|
|
156
157
|
# children_ids is optional in order to support backwards compatibility.
|
|
157
158
|
children_ids: list[int] = pydantic.Field(default_factory=list)
|
|
158
|
-
operation_data:
|
|
159
|
+
operation_data: OperationData | None = None
|
|
159
160
|
operation_links: OperationLinks
|
|
160
161
|
control_qubits: tuple[int, ...] = pydantic.Field(default_factory=tuple)
|
|
161
162
|
auxiliary_qubits: tuple[int, ...]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
INTERFACE_VERSION = "
|
|
1
|
+
INTERFACE_VERSION = "15"
|
classiq/interface/jobs.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Any, Generic,
|
|
1
|
+
from typing import Any, Generic, TypeVar, Union
|
|
2
2
|
|
|
3
3
|
import pydantic
|
|
4
4
|
from pydantic import BaseModel
|
|
@@ -43,8 +43,8 @@ For unsuccessful jobs, we expect failure_details to be a string and result to be
|
|
|
43
43
|
|
|
44
44
|
class JobDescription(BaseModel, Generic[T], json_encoders=CUSTOM_ENCODERS):
|
|
45
45
|
status: JobStatus
|
|
46
|
-
failure_details:
|
|
47
|
-
result:
|
|
46
|
+
failure_details: str | None = pydantic.Field(default=None)
|
|
47
|
+
result: T | None = pydantic.Field(default=None)
|
|
48
48
|
|
|
49
49
|
@pydantic.model_validator(mode="after")
|
|
50
50
|
def validate_status_and_fields(self) -> Self:
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from collections.abc import Mapping
|
|
2
|
-
from typing import Literal
|
|
2
|
+
from typing import Literal
|
|
3
3
|
|
|
4
4
|
from classiq.interface.generator.expressions.expression import Expression
|
|
5
5
|
from classiq.interface.model.handle_binding import ConcreteHandleBinding, HandleBinding
|
|
@@ -8,9 +8,9 @@ from classiq.interface.model.quantum_statement import QuantumOperation
|
|
|
8
8
|
|
|
9
9
|
class Allocate(QuantumOperation):
|
|
10
10
|
kind: Literal["Allocate"]
|
|
11
|
-
size:
|
|
12
|
-
is_signed:
|
|
13
|
-
fraction_digits:
|
|
11
|
+
size: Expression | None = None
|
|
12
|
+
is_signed: Expression | None = None
|
|
13
|
+
fraction_digits: Expression | None = None
|
|
14
14
|
target: ConcreteHandleBinding
|
|
15
15
|
|
|
16
16
|
@property
|
classiq/interface/model/block.py
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import TYPE_CHECKING, Literal
|
|
1
|
+
from typing import TYPE_CHECKING, Literal
|
|
2
2
|
|
|
3
3
|
import pydantic
|
|
4
4
|
|
|
@@ -13,4 +13,8 @@ class Block(QuantumOperation):
|
|
|
13
13
|
|
|
14
14
|
statements: "StatementBlock"
|
|
15
15
|
|
|
16
|
-
label:
|
|
16
|
+
label: str | None = pydantic.Field(default=None)
|
|
17
|
+
|
|
18
|
+
@property
|
|
19
|
+
def blocks(self) -> dict[str, "StatementBlock"]:
|
|
20
|
+
return {"statements": self.statements}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
from typing import Literal
|
|
1
|
+
from typing import Literal
|
|
2
2
|
|
|
3
3
|
from classiq.interface.generator.expressions.expression import Expression
|
|
4
4
|
from classiq.interface.model.handle_binding import ConcreteHandleBinding
|
|
@@ -9,8 +9,8 @@ class SetBoundsStatement(QuantumOperation):
|
|
|
9
9
|
kind: Literal["SetBoundsStatement"]
|
|
10
10
|
|
|
11
11
|
target: ConcreteHandleBinding
|
|
12
|
-
lower_bound:
|
|
13
|
-
upper_bound:
|
|
12
|
+
lower_bound: Expression | None
|
|
13
|
+
upper_bound: Expression | None
|
|
14
14
|
|
|
15
15
|
@property
|
|
16
16
|
def expressions(self) -> list[Expression]:
|
|
@@ -31,6 +31,10 @@ class ClassicalIf(QuantumOperation):
|
|
|
31
31
|
def expressions(self) -> list[Expression]:
|
|
32
32
|
return [self.condition]
|
|
33
33
|
|
|
34
|
+
@property
|
|
35
|
+
def blocks(self) -> dict[str, "StatementBlock"]:
|
|
36
|
+
return {"then": self.then, "else_": self.else_}
|
|
37
|
+
|
|
34
38
|
@property
|
|
35
39
|
def wiring_inputs(self) -> Mapping[str, HandleBinding]:
|
|
36
40
|
return functools.reduce(
|
|
@@ -19,7 +19,7 @@ class Control(QuantumExpressionOperation):
|
|
|
19
19
|
else_block: Optional["StatementBlock"] = None
|
|
20
20
|
|
|
21
21
|
_ctrl_size: int = pydantic.PrivateAttr(default=0)
|
|
22
|
-
_result_type:
|
|
22
|
+
_result_type: QuantumType | None = pydantic.PrivateAttr(
|
|
23
23
|
default=None,
|
|
24
24
|
)
|
|
25
25
|
|
|
@@ -47,3 +47,10 @@ class Control(QuantumExpressionOperation):
|
|
|
47
47
|
|
|
48
48
|
def _as_back_ref(self: ASTNodeType) -> ASTNodeType:
|
|
49
49
|
return reset_lists(self, ["body", "else_block"])
|
|
50
|
+
|
|
51
|
+
@property
|
|
52
|
+
def blocks(self) -> dict[str, "StatementBlock"]:
|
|
53
|
+
blocks = {"body": self.body}
|
|
54
|
+
if self.else_block is not None:
|
|
55
|
+
blocks["else_block"] = self.else_block
|
|
56
|
+
return blocks
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from collections.abc import Mapping, Sequence
|
|
2
|
-
from typing import Literal
|
|
2
|
+
from typing import Literal
|
|
3
3
|
|
|
4
4
|
from classiq.interface.enum_utils import StrEnum
|
|
5
5
|
from classiq.interface.generator.expressions.expression import Expression
|
|
@@ -16,7 +16,7 @@ class InplaceBinaryOperation(QuantumOperation):
|
|
|
16
16
|
kind: Literal["InplaceBinaryOperation"]
|
|
17
17
|
|
|
18
18
|
target: ConcreteHandleBinding
|
|
19
|
-
value:
|
|
19
|
+
value: ConcreteHandleBinding | Expression
|
|
20
20
|
operation: BinaryOperation
|
|
21
21
|
|
|
22
22
|
@property
|
classiq/interface/model/model.py
CHANGED
|
@@ -185,14 +185,14 @@ class Model(VersionedModel, ASTNode):
|
|
|
185
185
|
return constants
|
|
186
186
|
|
|
187
187
|
def dump_no_metadata(self) -> dict[str, Any]:
|
|
188
|
-
|
|
189
|
-
name:
|
|
188
|
+
compilation_metadata_user_directives = {
|
|
189
|
+
name: comp_metadata.copy_user_directives()
|
|
190
190
|
for name, comp_metadata in self.functions_compilation_metadata.items()
|
|
191
|
-
if
|
|
191
|
+
if comp_metadata.has_user_directives
|
|
192
192
|
}
|
|
193
193
|
model = self.model_copy(
|
|
194
194
|
update={
|
|
195
|
-
"functions_compilation_metadata":
|
|
195
|
+
"functions_compilation_metadata": compilation_metadata_user_directives,
|
|
196
196
|
}
|
|
197
197
|
)
|
|
198
198
|
return model.model_dump(
|
|
@@ -1,5 +1,12 @@
|
|
|
1
|
+
from collections.abc import Collection
|
|
2
|
+
|
|
3
|
+
from pydantic import BaseModel
|
|
4
|
+
|
|
1
5
|
from classiq.interface.debug_info.debug_info import DebugInfoCollection
|
|
2
|
-
from classiq.interface.generator.visitor import Transformer, Visitor
|
|
6
|
+
from classiq.interface.generator.visitor import RetType, Transformer, Visitor
|
|
7
|
+
from classiq.interface.model.model import Model
|
|
8
|
+
from classiq.interface.model.native_function_definition import NativeFunctionDefinition
|
|
9
|
+
from classiq.interface.model.quantum_statement import QuantumStatement
|
|
3
10
|
|
|
4
11
|
|
|
5
12
|
class ModelVisitor(Visitor):
|
|
@@ -7,8 +14,40 @@ class ModelVisitor(Visitor):
|
|
|
7
14
|
return
|
|
8
15
|
|
|
9
16
|
|
|
17
|
+
class ModelStatementsVisitor(ModelVisitor):
|
|
18
|
+
def visit_BaseModel(self, node: BaseModel) -> RetType | None:
|
|
19
|
+
if isinstance(node, Model):
|
|
20
|
+
return self.visit(node.functions)
|
|
21
|
+
if isinstance(node, NativeFunctionDefinition):
|
|
22
|
+
return self.visit(node.body)
|
|
23
|
+
if isinstance(node, QuantumStatement):
|
|
24
|
+
for block in node.blocks.values():
|
|
25
|
+
self.visit(block)
|
|
26
|
+
return None
|
|
27
|
+
return super().visit_BaseModel(node)
|
|
28
|
+
|
|
29
|
+
|
|
10
30
|
class ModelTransformer(Transformer):
|
|
11
31
|
def visit_DebugInfoCollection(
|
|
12
32
|
self, debug_info: DebugInfoCollection
|
|
13
33
|
) -> DebugInfoCollection:
|
|
14
34
|
return debug_info
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
class ModelStatementsTransformer(ModelTransformer):
|
|
38
|
+
def visit_BaseModel(
|
|
39
|
+
self, node: BaseModel, fields_to_skip: Collection[str] | None = None
|
|
40
|
+
) -> RetType:
|
|
41
|
+
if isinstance(node, Model):
|
|
42
|
+
new_functions = self.visit(node.functions)
|
|
43
|
+
return node.model_copy(update=dict(functions=new_functions))
|
|
44
|
+
if isinstance(node, NativeFunctionDefinition):
|
|
45
|
+
new_body = self.visit(node.body)
|
|
46
|
+
return node.model_copy(update=dict(body=new_body))
|
|
47
|
+
if isinstance(node, QuantumStatement):
|
|
48
|
+
new_blocks = {
|
|
49
|
+
block_name: self.visit(block)
|
|
50
|
+
for block_name, block in node.blocks.items()
|
|
51
|
+
}
|
|
52
|
+
return node.model_copy(update=new_blocks)
|
|
53
|
+
return super().visit_BaseModel(node, fields_to_skip)
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
from typing import Optional
|
|
2
|
-
|
|
3
1
|
from classiq.interface.ast_node import ASTNode
|
|
4
2
|
from classiq.interface.exceptions import ClassiqError
|
|
5
3
|
|
|
6
4
|
|
|
7
5
|
class Parameter(ASTNode):
|
|
8
|
-
name:
|
|
6
|
+
name: str | None
|
|
9
7
|
|
|
10
8
|
def get_name(self) -> str:
|
|
11
9
|
if self.name is None:
|
|
@@ -49,7 +49,7 @@ class AnonPortDeclaration(Parameter):
|
|
|
49
49
|
def qmod_type_name(self) -> str:
|
|
50
50
|
prefix = ""
|
|
51
51
|
suffix = ""
|
|
52
|
-
if self.type_modifier
|
|
52
|
+
if self.type_modifier is TypeModifier.Const:
|
|
53
53
|
prefix += f"{self.type_modifier.name}["
|
|
54
54
|
suffix += "]"
|
|
55
55
|
if self.direction != PortDeclarationDirection.Inout:
|
classiq/interface/model/power.py
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import abc
|
|
2
2
|
from collections.abc import Mapping
|
|
3
|
-
from typing import Optional
|
|
4
3
|
|
|
5
4
|
import pydantic
|
|
6
5
|
|
|
@@ -55,7 +54,7 @@ class QuantumAssignmentOperation(QuantumExpressionOperation):
|
|
|
55
54
|
result_var: ConcreteHandleBinding = pydantic.Field(
|
|
56
55
|
description="The variable storing the expression result"
|
|
57
56
|
)
|
|
58
|
-
_result_type:
|
|
57
|
+
_result_type: QuantumType | None = pydantic.PrivateAttr(
|
|
59
58
|
default=None,
|
|
60
59
|
)
|
|
61
60
|
|