classiq 0.52.0__py3-none-any.whl → 0.54.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- classiq/__init__.py +1 -3
- classiq/_analyzer_extras/_ipywidgets_async_extension.py +2 -1
- classiq/_internals/__init__.py +0 -20
- classiq/_internals/api_wrapper.py +23 -17
- classiq/_internals/async_utils.py +1 -3
- classiq/_internals/authentication/auth0.py +5 -5
- classiq/_internals/authentication/device.py +5 -4
- classiq/_internals/authentication/password_manager.py +3 -3
- classiq/_internals/authentication/token_manager.py +3 -2
- classiq/_internals/client.py +11 -13
- classiq/_internals/config.py +2 -2
- classiq/_internals/jobs.py +7 -6
- classiq/_internals/type_validation.py +9 -9
- classiq/analyzer/__init__.py +1 -3
- classiq/analyzer/analyzer.py +8 -7
- classiq/analyzer/analyzer_utilities.py +8 -8
- classiq/analyzer/rb.py +11 -11
- classiq/applications/__init__.py +1 -3
- classiq/applications/chemistry/__init__.py +1 -3
- classiq/applications/chemistry/ansatz_parameters.py +4 -4
- classiq/applications/chemistry/chemistry_model_constructor.py +10 -9
- classiq/applications/combinatorial_helpers/combinatorial_problem_utils.py +26 -9
- classiq/applications/combinatorial_helpers/encoding_mapping.py +10 -10
- classiq/applications/combinatorial_helpers/encoding_utils.py +4 -4
- classiq/applications/combinatorial_helpers/memory.py +5 -7
- classiq/applications/combinatorial_helpers/optimization_model.py +43 -24
- classiq/applications/combinatorial_helpers/pauli_helpers/pauli_utils.py +4 -6
- classiq/applications/combinatorial_helpers/pyomo_utils.py +95 -24
- classiq/applications/combinatorial_helpers/sympy_utils.py +2 -2
- classiq/applications/combinatorial_helpers/transformations/encoding.py +8 -8
- classiq/applications/combinatorial_helpers/transformations/fixed_variables.py +5 -5
- classiq/applications/combinatorial_helpers/transformations/ising_converter.py +7 -9
- classiq/applications/combinatorial_helpers/transformations/penalty.py +1 -2
- classiq/applications/combinatorial_helpers/transformations/sign_seperation.py +1 -2
- classiq/applications/combinatorial_helpers/transformations/slack_variables.py +1 -2
- classiq/applications/combinatorial_optimization/__init__.py +1 -3
- classiq/applications/combinatorial_optimization/combinatorial_optimization_config.py +2 -2
- classiq/applications/combinatorial_optimization/examples/__init__.py +1 -3
- classiq/applications/finance/__init__.py +1 -3
- classiq/applications/grover/__init__.py +1 -3
- classiq/applications/grover/grover_model_constructor.py +7 -9
- classiq/applications/hamiltonian/pauli_decomposition.py +6 -6
- classiq/applications/qnn/__init__.py +1 -3
- classiq/applications/qnn/circuit_utils.py +5 -5
- classiq/applications/qnn/datasets/__init__.py +1 -3
- classiq/applications/qnn/datasets/dataset_base_classes.py +5 -4
- classiq/applications/qnn/datasets/dataset_parity.py +2 -2
- classiq/applications/qnn/gradients/simple_quantum_gradient.py +2 -1
- classiq/applications/qnn/qlayer.py +25 -6
- classiq/applications/qnn/torch_utils.py +2 -2
- classiq/applications/qnn/types.py +5 -5
- classiq/applications/qsvm/qsvm.py +1 -3
- classiq/applications/qsvm/qsvm_data_generation.py +3 -3
- classiq/applications/qsvm/qsvm_model_constructor.py +5 -5
- classiq/execution/__init__.py +3 -3
- classiq/execution/all_hardware_devices.py +1 -3
- classiq/execution/execution_session.py +57 -16
- classiq/execution/iqcc.py +1 -1
- classiq/execution/jobs.py +4 -4
- classiq/execution/qaoa.py +84 -0
- classiq/execution/qnn.py +3 -3
- classiq/executor.py +4 -4
- classiq/interface/_version.py +1 -1
- classiq/interface/analyzer/analysis_params.py +9 -10
- classiq/interface/analyzer/cytoscape_graph.py +5 -5
- classiq/interface/analyzer/result.py +17 -17
- classiq/interface/applications/qsvm.py +6 -10
- classiq/interface/backend/backend_preferences.py +4 -3
- classiq/interface/backend/ionq/ionq_quantum_program.py +4 -5
- classiq/interface/backend/pydantic_backend.py +1 -2
- classiq/interface/chemistry/fermionic_operator.py +5 -5
- classiq/interface/chemistry/ground_state_problem.py +7 -8
- classiq/interface/chemistry/molecule.py +4 -4
- classiq/interface/chemistry/operator.py +11 -13
- classiq/interface/combinatorial_optimization/examples/ascending_sequence.py +1 -3
- classiq/interface/combinatorial_optimization/examples/integer_portfolio_optimization.py +2 -4
- classiq/interface/combinatorial_optimization/examples/knapsack.py +3 -3
- classiq/interface/combinatorial_optimization/examples/mht.py +2 -3
- classiq/interface/combinatorial_optimization/examples/portfolio_variations.py +2 -2
- classiq/interface/combinatorial_optimization/examples/set_cover.py +1 -2
- classiq/interface/combinatorial_optimization/mht_qaoa_input.py +5 -7
- classiq/interface/combinatorial_optimization/optimization_problem.py +2 -2
- classiq/interface/combinatorial_optimization/result.py +1 -3
- classiq/interface/debug_info/debug_info.py +8 -7
- classiq/interface/exceptions.py +11 -7
- classiq/interface/execution/iqcc.py +1 -3
- classiq/interface/execution/jobs.py +2 -2
- classiq/interface/execution/primitives.py +3 -3
- classiq/interface/executor/aws_execution_cost.py +4 -4
- classiq/interface/executor/execution_request.py +2 -3
- classiq/interface/executor/execution_result.py +3 -3
- classiq/interface/executor/iqae_result.py +3 -5
- classiq/interface/executor/optimizer_preferences.py +2 -2
- classiq/interface/executor/quantum_code.py +6 -6
- classiq/interface/executor/register_initialization.py +2 -4
- classiq/interface/executor/result.py +35 -28
- classiq/interface/executor/vqe_result.py +8 -8
- classiq/interface/finance/function_input.py +2 -2
- classiq/interface/finance/gaussian_model_input.py +5 -5
- classiq/interface/finance/log_normal_model_input.py +2 -2
- classiq/interface/finance/model_input.py +1 -2
- classiq/interface/generator/adjacency.py +1 -3
- classiq/interface/generator/ansatz_library.py +4 -4
- classiq/interface/generator/application_apis/finance_declarations.py +1 -1
- classiq/interface/generator/arith/argument_utils.py +3 -3
- classiq/interface/generator/arith/arithmetic.py +7 -7
- classiq/interface/generator/arith/arithmetic_arg_type_validator.py +5 -5
- classiq/interface/generator/arith/arithmetic_expression_abc.py +11 -11
- classiq/interface/generator/arith/arithmetic_expression_parser.py +8 -7
- classiq/interface/generator/arith/arithmetic_expression_validator.py +8 -8
- classiq/interface/generator/arith/arithmetic_operations.py +4 -3
- classiq/interface/generator/arith/arithmetic_param_getters.py +6 -6
- classiq/interface/generator/arith/arithmetic_result_builder.py +9 -9
- classiq/interface/generator/arith/ast_node_rewrite.py +2 -1
- classiq/interface/generator/arith/binary_ops.py +10 -13
- classiq/interface/generator/arith/extremum_operations.py +3 -2
- classiq/interface/generator/arith/logical_ops.py +7 -6
- classiq/interface/generator/arith/number_utils.py +4 -4
- classiq/interface/generator/arith/register_user_input.py +4 -4
- classiq/interface/generator/arith/unary_ops.py +2 -1
- classiq/interface/generator/builtin_api_builder.py +2 -1
- classiq/interface/generator/circuit_code/circuit_code.py +4 -4
- classiq/interface/generator/circuit_code/types_and_constants.py +3 -5
- classiq/interface/generator/complex_type.py +1 -2
- classiq/interface/generator/control_state.py +2 -2
- classiq/interface/generator/custom_ansatz.py +1 -3
- classiq/interface/generator/distance.py +3 -5
- classiq/interface/generator/excitations.py +3 -2
- classiq/interface/generator/expressions/enums/finance_functions.py +1 -3
- classiq/interface/generator/expressions/evaluated_expression.py +4 -3
- classiq/interface/generator/expressions/expression.py +4 -5
- classiq/interface/generator/expressions/expression_constants.py +4 -4
- classiq/interface/generator/expressions/qmod_qarray_proxy.py +2 -1
- classiq/interface/generator/expressions/qmod_qscalar_proxy.py +2 -1
- classiq/interface/generator/expressions/qmod_qstruct_proxy.py +2 -1
- classiq/interface/generator/expressions/qmod_sized_proxy.py +2 -1
- classiq/interface/generator/expressions/qmod_struct_instance.py +2 -1
- classiq/interface/generator/expressions/sympy_supported_expressions.py +11 -13
- classiq/interface/generator/finance.py +2 -2
- classiq/interface/generator/function_param_library.py +6 -6
- classiq/interface/generator/function_params.py +13 -19
- classiq/interface/generator/functions/classical_function_declaration.py +4 -3
- classiq/interface/generator/functions/classical_type.py +13 -13
- classiq/interface/generator/functions/concrete_types.py +1 -2
- classiq/interface/generator/functions/function_declaration.py +1 -1
- classiq/interface/generator/functions/qmod_python_interface.py +2 -1
- classiq/interface/generator/functions/type_name.py +3 -2
- classiq/interface/generator/generated_circuit_data.py +34 -22
- classiq/interface/generator/grover_diffuser.py +7 -7
- classiq/interface/generator/grover_operator.py +2 -2
- classiq/interface/generator/hardware/hardware_data.py +7 -6
- classiq/interface/generator/hardware_efficient_ansatz.py +8 -8
- classiq/interface/generator/identity.py +5 -6
- classiq/interface/generator/linear_pauli_rotations.py +6 -6
- classiq/interface/generator/mcu.py +2 -2
- classiq/interface/generator/mcx.py +6 -6
- classiq/interface/generator/model/__init__.py +1 -3
- classiq/interface/generator/model/constraints.py +2 -2
- classiq/interface/generator/model/model.py +5 -6
- classiq/interface/generator/model/preferences/preferences.py +7 -6
- classiq/interface/generator/model/quantum_register.py +6 -11
- classiq/interface/generator/oracles/arithmetic_oracle.py +1 -2
- classiq/interface/generator/oracles/custom_oracle.py +2 -2
- classiq/interface/generator/oracles/oracle_abc.py +6 -5
- classiq/interface/generator/partitioned_register.py +6 -5
- classiq/interface/generator/piecewise_linear_amplitude_loading.py +8 -7
- classiq/interface/generator/qpe.py +4 -4
- classiq/interface/generator/qsvm.py +3 -3
- classiq/interface/generator/quantum_function_call.py +24 -29
- classiq/interface/generator/quantum_program.py +9 -9
- classiq/interface/generator/register_role.py +2 -4
- classiq/interface/generator/slice_parsing_utils.py +4 -3
- classiq/interface/generator/standard_gates/standard_gates.py +3 -3
- classiq/interface/generator/state_preparation/bell_state_preparation.py +3 -3
- classiq/interface/generator/state_preparation/distributions.py +6 -5
- classiq/interface/generator/state_preparation/metrics.py +2 -4
- classiq/interface/generator/state_preparation/state_preparation.py +4 -4
- classiq/interface/generator/synthesis_metadata/synthesis_execution_data.py +3 -3
- classiq/interface/generator/transpiler_basis_gates.py +2 -2
- classiq/interface/generator/types/enum_declaration.py +2 -3
- classiq/interface/generator/types/qstruct_declaration.py +2 -1
- classiq/interface/generator/types/struct_declaration.py +3 -2
- classiq/interface/generator/ucc.py +2 -1
- classiq/interface/generator/unitary_gate.py +2 -2
- classiq/interface/generator/user_defined_function_params.py +1 -1
- classiq/interface/generator/validations/flow_graph.py +6 -5
- classiq/interface/generator/validations/validator_functions.py +3 -2
- classiq/interface/generator/visitor.py +9 -14
- classiq/interface/hardware.py +5 -6
- classiq/interface/helpers/custom_encoders.py +2 -2
- classiq/interface/helpers/custom_pydantic_types.py +8 -9
- classiq/interface/helpers/dotdict.py +18 -0
- classiq/interface/helpers/hashable_mixin.py +3 -2
- classiq/interface/helpers/hashable_pydantic_base_model.py +2 -1
- classiq/interface/helpers/pydantic_model_helpers.py +4 -3
- classiq/interface/helpers/validation_helpers.py +2 -2
- classiq/interface/ide/ide_data.py +11 -15
- classiq/interface/ide/visual_model.py +33 -22
- classiq/interface/jobs.py +2 -2
- classiq/interface/model/bind_operation.py +5 -4
- classiq/interface/model/classical_parameter_declaration.py +2 -2
- classiq/interface/model/handle_binding.py +3 -2
- classiq/interface/model/inplace_binary_operation.py +2 -1
- classiq/interface/model/model.py +12 -11
- classiq/interface/model/native_function_definition.py +10 -0
- classiq/interface/model/port_declaration.py +2 -2
- classiq/interface/model/quantum_expressions/amplitude_loading_operation.py +3 -2
- classiq/interface/model/quantum_expressions/arithmetic_operation.py +3 -2
- classiq/interface/model/quantum_expressions/quantum_expression.py +8 -7
- classiq/interface/model/quantum_function_call.py +9 -14
- classiq/interface/model/quantum_function_declaration.py +10 -12
- classiq/interface/model/quantum_lambda_function.py +3 -16
- classiq/interface/model/quantum_statement.py +4 -3
- classiq/interface/model/quantum_type.py +5 -5
- classiq/interface/model/statement_block.py +2 -3
- classiq/interface/model/validation_handle.py +5 -4
- classiq/interface/server/global_versions.py +3 -3
- classiq/model_expansions/atomic_expression_functions_defs.py +3 -2
- classiq/model_expansions/call_to_model_converter.py +190 -0
- classiq/model_expansions/capturing/captured_var_manager.py +4 -6
- classiq/model_expansions/capturing/propagated_var_stack.py +7 -7
- classiq/model_expansions/closure.py +17 -9
- classiq/model_expansions/evaluators/arg_type_match.py +3 -2
- classiq/model_expansions/evaluators/argument_types.py +3 -3
- classiq/model_expansions/evaluators/control.py +3 -3
- classiq/model_expansions/evaluators/parameter_types.py +7 -7
- classiq/model_expansions/evaluators/quantum_type_utils.py +2 -1
- classiq/model_expansions/evaluators/type_type_match.py +1 -1
- classiq/model_expansions/expression_evaluator.py +10 -9
- classiq/model_expansions/expression_renamer.py +6 -6
- classiq/model_expansions/function_builder.py +19 -12
- classiq/model_expansions/generative_functions.py +3 -2
- classiq/model_expansions/interpreter.py +31 -19
- classiq/model_expansions/model_tables.py +14 -14
- classiq/model_expansions/quantum_operations/bind.py +2 -4
- classiq/model_expansions/quantum_operations/classicalif.py +1 -1
- classiq/model_expansions/quantum_operations/control.py +2 -4
- classiq/model_expansions/quantum_operations/emitter.py +10 -13
- classiq/model_expansions/quantum_operations/expression_operation.py +23 -16
- classiq/model_expansions/quantum_operations/inplace_binary_operation.py +164 -38
- classiq/model_expansions/quantum_operations/phase.py +6 -6
- classiq/model_expansions/quantum_operations/quantum_assignment_operation.py +25 -5
- classiq/model_expansions/quantum_operations/quantum_function_call.py +41 -2
- classiq/model_expansions/quantum_operations/repeat.py +1 -3
- classiq/model_expansions/scope.py +11 -10
- classiq/model_expansions/scope_initialization.py +6 -5
- classiq/model_expansions/sympy_conversion/expression_to_sympy.py +6 -6
- classiq/model_expansions/sympy_conversion/sympy_to_python.py +2 -2
- classiq/model_expansions/visitors/variable_references.py +5 -4
- classiq/qmod/__init__.py +2 -0
- classiq/qmod/builtins/classical_execution_primitives.py +9 -9
- classiq/qmod/builtins/functions/__init__.py +75 -53
- classiq/qmod/builtins/functions/amplitude_estimation.py +4 -1
- classiq/qmod/builtins/functions/arithmetic.py +14 -1
- classiq/qmod/builtins/functions/discrete_sine_cosine_transform.py +86 -6
- classiq/qmod/builtins/functions/grover.py +41 -45
- classiq/qmod/builtins/functions/hea.py +60 -4
- classiq/qmod/builtins/functions/linear_pauli_rotation.py +26 -4
- classiq/qmod/builtins/functions/modular_exponentiation.py +90 -29
- classiq/qmod/builtins/functions/operators.py +1 -1
- classiq/qmod/builtins/functions/qaoa_penalty.py +14 -5
- classiq/qmod/builtins/functions/qft_functions.py +57 -0
- classiq/qmod/builtins/functions/qpe.py +20 -4
- classiq/qmod/builtins/functions/qsvt.py +49 -4
- classiq/qmod/builtins/functions/standard_gates.py +18 -18
- classiq/qmod/builtins/functions/state_preparation.py +92 -10
- classiq/qmod/builtins/functions/swap_test.py +7 -1
- classiq/qmod/builtins/functions/utility_functions.py +43 -0
- classiq/qmod/builtins/functions/variational.py +53 -0
- classiq/qmod/builtins/operations.py +4 -5
- classiq/qmod/cfunc.py +2 -2
- classiq/qmod/classical_function.py +3 -7
- classiq/qmod/create_model_function.py +19 -8
- classiq/qmod/declaration_inferrer.py +7 -10
- classiq/qmod/expression_query.py +3 -3
- classiq/qmod/generative.py +2 -1
- classiq/qmod/model_state_container.py +5 -7
- classiq/qmod/native/__init__.py +1 -3
- classiq/qmod/native/expression_to_qmod.py +9 -8
- classiq/qmod/native/pretty_printer.py +6 -5
- classiq/qmod/pretty_print/__init__.py +1 -3
- classiq/qmod/pretty_print/expression_to_python.py +13 -12
- classiq/qmod/pretty_print/pretty_printer.py +13 -12
- classiq/qmod/python_classical_type.py +8 -4
- classiq/qmod/qfunc.py +4 -4
- classiq/qmod/qmod_parameter.py +3 -1
- classiq/qmod/qmod_variable.py +11 -10
- classiq/qmod/quantum_expandable.py +32 -15
- classiq/qmod/quantum_function.py +34 -5
- classiq/qmod/semantics/annotation.py +1 -1
- classiq/qmod/semantics/error_manager.py +8 -7
- classiq/qmod/semantics/static_semantics_visitor.py +19 -24
- classiq/qmod/semantics/validation/constants_validation.py +1 -1
- classiq/qmod/semantics/validation/func_call_validation.py +2 -2
- classiq/qmod/semantics/validation/main_validation.py +33 -0
- classiq/qmod/semantics/validation/types_validation.py +2 -1
- classiq/qmod/symbolic.py +5 -8
- classiq/qmod/symbolic_type.py +2 -2
- classiq/qmod/synthesize_separately.py +16 -0
- {classiq-0.52.0.dist-info → classiq-0.54.0.dist-info}/METADATA +1 -1
- {classiq-0.52.0.dist-info → classiq-0.54.0.dist-info}/RECORD +302 -295
- classiq/qmod/builtins/functions/qft.py +0 -23
- {classiq-0.52.0.dist-info → classiq-0.54.0.dist-info}/WHEEL +0 -0
classiq/__init__.py
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
"""Classiq SDK."""
|
2
2
|
|
3
|
-
from typing import List
|
4
|
-
|
5
3
|
from classiq.interface._version import VERSION as _VERSION
|
6
4
|
from classiq.interface.generator.application_apis import * # noqa: F403
|
7
5
|
from classiq.interface.generator.arith.register_user_input import (
|
@@ -117,5 +115,5 @@ __all__ = (
|
|
117
115
|
)
|
118
116
|
|
119
117
|
|
120
|
-
def __dir__() ->
|
118
|
+
def __dir__() -> list[str]:
|
121
119
|
return __all__
|
classiq/_internals/__init__.py
CHANGED
@@ -1,20 +0,0 @@
|
|
1
|
-
import sys
|
2
|
-
import warnings
|
3
|
-
|
4
|
-
from classiq.interface.exceptions import ClassiqDeprecationWarning
|
5
|
-
|
6
|
-
|
7
|
-
def _check_python_version() -> None:
|
8
|
-
if sys.version_info >= (3, 9):
|
9
|
-
return
|
10
|
-
warnings.warn( # type: ignore[unreachable]
|
11
|
-
"Python version 3.8 is expected to reach its end-of-life on October 2024.\n"
|
12
|
-
"See https://devguide.python.org/versions/#supported-versions\n"
|
13
|
-
"The Classiq SDK is expected to drop support for 3.8 around the same time.\n"
|
14
|
-
"Please upgrade to a newer version of Python to avoid issues in the future.",
|
15
|
-
ClassiqDeprecationWarning,
|
16
|
-
stacklevel=2,
|
17
|
-
)
|
18
|
-
|
19
|
-
|
20
|
-
_check_python_version()
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import json
|
2
|
-
from typing import Any,
|
2
|
+
from typing import Any, Optional, Protocol, TypeVar
|
3
3
|
|
4
4
|
import pydantic
|
5
5
|
|
@@ -52,7 +52,7 @@ class StatusType(Protocol):
|
|
52
52
|
|
53
53
|
def _parse_job_response(
|
54
54
|
job_result: JobDescription[JSONObject],
|
55
|
-
output_type:
|
55
|
+
output_type: type[ResultType],
|
56
56
|
) -> ResultType:
|
57
57
|
if job_result.result is not None:
|
58
58
|
return output_type.model_validate(job_result.result)
|
@@ -84,10 +84,10 @@ class ApiWrapper:
|
|
84
84
|
cls,
|
85
85
|
http_method: str,
|
86
86
|
url: str,
|
87
|
-
body: Optional[
|
88
|
-
params: Optional[
|
87
|
+
body: Optional[dict] = None,
|
88
|
+
params: Optional[dict] = None,
|
89
89
|
use_versioned_url: bool = True,
|
90
|
-
headers: Optional[
|
90
|
+
headers: Optional[dict[str, str]] = None,
|
91
91
|
allow_none: bool = False,
|
92
92
|
) -> dict:
|
93
93
|
res: Any = await client().call_api(
|
@@ -295,10 +295,10 @@ class ApiWrapper:
|
|
295
295
|
|
296
296
|
@staticmethod
|
297
297
|
def _get_devices_from_hardware_info(
|
298
|
-
hardware_info:
|
298
|
+
hardware_info: list[HardwareInformation],
|
299
299
|
params: analysis_params.AnalysisOptionalDevicesParams,
|
300
300
|
) -> analysis_result.DevicesResult:
|
301
|
-
available_hardware:
|
301
|
+
available_hardware: dict[Provider, dict[str, bool]] = {
|
302
302
|
Provider.IBM_QUANTUM: {},
|
303
303
|
Provider.AMAZON_BRAKET: {},
|
304
304
|
Provider.AZURE_QUANTUM: {},
|
@@ -318,7 +318,7 @@ class ApiWrapper:
|
|
318
318
|
)
|
319
319
|
|
320
320
|
@classmethod
|
321
|
-
async def call_get_all_hardware_devices(cls) ->
|
321
|
+
async def call_get_all_hardware_devices(cls) -> list[HardwareInformation]:
|
322
322
|
data = await client().call_api(
|
323
323
|
http_method=HTTPMethod.GET,
|
324
324
|
url="/hardware-catalog/v1/hardwares",
|
@@ -342,19 +342,25 @@ class ApiWrapper:
|
|
342
342
|
@classmethod
|
343
343
|
async def call_iqcc_init_auth(cls, data: IQCCInitAuthData) -> IQCCInitAuthResponse:
|
344
344
|
response = await cls._call_task_pydantic(
|
345
|
-
http_method=HTTPMethod.
|
345
|
+
http_method=HTTPMethod.PUT,
|
346
346
|
url=f"{routes.IQCC_INIT_AUTH_FULL_PATH}",
|
347
347
|
model=data,
|
348
348
|
)
|
349
|
-
return IQCCInitAuthResponse.
|
349
|
+
return IQCCInitAuthResponse.model_validate(response)
|
350
350
|
|
351
351
|
@classmethod
|
352
352
|
async def call_iqcc_probe_auth(
|
353
353
|
cls, data: IQCCProbeAuthData
|
354
|
-
) -> IQCCProbeAuthResponse:
|
355
|
-
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
|
360
|
-
|
354
|
+
) -> Optional[IQCCProbeAuthResponse]:
|
355
|
+
try:
|
356
|
+
response = await cls._call_task_pydantic(
|
357
|
+
http_method=HTTPMethod.PUT,
|
358
|
+
url=f"{routes.IQCC_PROBE_AUTH_FULL_PATH}",
|
359
|
+
model=data,
|
360
|
+
)
|
361
|
+
except ClassiqAPIError as ex:
|
362
|
+
if ex.status_code == 418:
|
363
|
+
return None
|
364
|
+
raise
|
365
|
+
|
366
|
+
return IQCCProbeAuthResponse.model_validate(response)
|
@@ -3,12 +3,10 @@ import functools
|
|
3
3
|
import itertools
|
4
4
|
import logging
|
5
5
|
import time
|
6
|
+
from collections.abc import AsyncGenerator, Awaitable, Iterable
|
6
7
|
from typing import (
|
7
8
|
Any,
|
8
|
-
AsyncGenerator,
|
9
|
-
Awaitable,
|
10
9
|
Callable,
|
11
|
-
Iterable,
|
12
10
|
Optional,
|
13
11
|
SupportsFloat,
|
14
12
|
TypeVar,
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import urllib.parse
|
2
2
|
from dataclasses import dataclass
|
3
|
-
from typing import Any,
|
3
|
+
from typing import Any, Optional, Union
|
4
4
|
|
5
5
|
from httpx import AsyncClient, Response, codes
|
6
6
|
from pydantic import Field
|
@@ -56,9 +56,9 @@ class Auth0:
|
|
56
56
|
async def _make_request(
|
57
57
|
self,
|
58
58
|
url: str,
|
59
|
-
payload:
|
59
|
+
payload: dict[str, str],
|
60
60
|
allow_error: Union[bool, int] = False,
|
61
|
-
) ->
|
61
|
+
) -> dict[str, Any]:
|
62
62
|
encoded_payload = urllib.parse.urlencode(payload)
|
63
63
|
client: AsyncClient
|
64
64
|
async with AsyncClient(
|
@@ -76,7 +76,7 @@ class Auth0:
|
|
76
76
|
f"Request to Auth0 failed with error code {code}: {data.get('error')}"
|
77
77
|
)
|
78
78
|
|
79
|
-
async def get_device_data(self, get_refresh_token: bool = True) ->
|
79
|
+
async def get_device_data(self, get_refresh_token: bool = True) -> dict[str, Any]:
|
80
80
|
payload = {
|
81
81
|
"client_id": self._auth_settings.client_id,
|
82
82
|
"audience": self._auth_settings.audience,
|
@@ -89,7 +89,7 @@ class Auth0:
|
|
89
89
|
payload=payload,
|
90
90
|
)
|
91
91
|
|
92
|
-
async def poll_tokens(self, device_code: str) ->
|
92
|
+
async def poll_tokens(self, device_code: str) -> dict[str, Any]:
|
93
93
|
payload = {
|
94
94
|
"client_id": self._client_id,
|
95
95
|
"device_code": device_code,
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import asyncio
|
2
2
|
import webbrowser
|
3
|
+
from collections.abc import Iterable
|
3
4
|
from datetime import timedelta
|
4
|
-
from typing import Any,
|
5
|
+
from typing import Any, Optional, TypeVar
|
5
6
|
|
6
7
|
from classiq.interface.exceptions import (
|
7
8
|
ClassiqAuthenticationError,
|
@@ -26,7 +27,7 @@ class DeviceRegistrar:
|
|
26
27
|
cls, get_refresh_token: bool = True, text_only: bool = False
|
27
28
|
) -> Tokens:
|
28
29
|
auth0_client = Auth0()
|
29
|
-
data:
|
30
|
+
data: dict[str, Any] = await auth0_client.get_device_data(
|
30
31
|
get_refresh_token=get_refresh_token
|
31
32
|
)
|
32
33
|
|
@@ -48,7 +49,7 @@ class DeviceRegistrar:
|
|
48
49
|
|
49
50
|
@classmethod
|
50
51
|
def _handle_ready_data(
|
51
|
-
cls, data:
|
52
|
+
cls, data: dict[str, Any], get_refresh_token: bool
|
52
53
|
) -> Tokens:
|
53
54
|
access_token: Optional[str] = data.get("access_token")
|
54
55
|
# If refresh token was not requested, this would be None
|
@@ -72,7 +73,7 @@ class DeviceRegistrar:
|
|
72
73
|
timeout: float,
|
73
74
|
get_refresh_token: bool = True,
|
74
75
|
) -> Tokens:
|
75
|
-
async def poller() ->
|
76
|
+
async def poller() -> dict[str, Any]:
|
76
77
|
nonlocal device_code
|
77
78
|
return await auth0_client.poll_tokens(device_code=device_code)
|
78
79
|
|
@@ -5,7 +5,7 @@ import os
|
|
5
5
|
import pathlib
|
6
6
|
import platform
|
7
7
|
import stat
|
8
|
-
from typing import Any,
|
8
|
+
from typing import Any, Optional
|
9
9
|
|
10
10
|
import keyring
|
11
11
|
from keyring.backends import fail
|
@@ -124,12 +124,12 @@ class FilePasswordManager(PasswordManager):
|
|
124
124
|
super().__init__()
|
125
125
|
self.credentials_file = pathlib.Path(self._CLASSIQ_CREDENTIALS_FILE_PATH)
|
126
126
|
|
127
|
-
def _update_file(self, token_dict:
|
127
|
+
def _update_file(self, token_dict: dict) -> None:
|
128
128
|
self.credentials_file.touch()
|
129
129
|
self.credentials_file.chmod(stat.S_IRUSR | stat.S_IWUSR)
|
130
130
|
self.credentials_file.write_text(json.dumps(token_dict))
|
131
131
|
|
132
|
-
def _get_token_dict(self) ->
|
132
|
+
def _get_token_dict(self) -> dict:
|
133
133
|
if self.credentials_file.exists():
|
134
134
|
return json.loads(self.credentials_file.read_text())
|
135
135
|
return {}
|
@@ -2,7 +2,8 @@ import argparse
|
|
2
2
|
import logging
|
3
3
|
import threading
|
4
4
|
import warnings
|
5
|
-
from
|
5
|
+
from collections.abc import Sequence
|
6
|
+
from typing import Optional
|
6
7
|
|
7
8
|
from classiq.interface.exceptions import (
|
8
9
|
ClassiqAuthenticationError,
|
@@ -14,7 +15,7 @@ from classiq._internals.authentication.auth0 import Auth0
|
|
14
15
|
from classiq._internals.authentication.device import DeviceRegistrar, Tokens
|
15
16
|
from classiq._internals.config import Configuration
|
16
17
|
|
17
|
-
PASSWORD_MANAGERS: Sequence[
|
18
|
+
PASSWORD_MANAGERS: Sequence[type[pm.PasswordManager]] = [
|
18
19
|
pm.KeyringPasswordManager,
|
19
20
|
pm.FilePasswordManager,
|
20
21
|
]
|
classiq/_internals/client.py
CHANGED
@@ -6,12 +6,10 @@ import os
|
|
6
6
|
import platform
|
7
7
|
import ssl
|
8
8
|
import sys
|
9
|
+
from collections.abc import Awaitable
|
9
10
|
from typing import (
|
10
11
|
Any,
|
11
|
-
Awaitable,
|
12
12
|
Callable,
|
13
|
-
Dict,
|
14
|
-
List,
|
15
13
|
NoReturn,
|
16
14
|
Optional,
|
17
15
|
TypeVar,
|
@@ -37,7 +35,7 @@ _logger = logging.getLogger(__name__)
|
|
37
35
|
|
38
36
|
_RETRY_COUNT = 2
|
39
37
|
|
40
|
-
Headers =
|
38
|
+
Headers = dict[str, str]
|
41
39
|
|
42
40
|
APPROVED_API_ERROR_MESSAGES_FOR_RESTART = [
|
43
41
|
"Call to API failed with code 502",
|
@@ -203,9 +201,9 @@ class Client:
|
|
203
201
|
message += f": {detail}"
|
204
202
|
except Exception: # noqa: S110
|
205
203
|
pass
|
206
|
-
raise ClassiqAPIError(message)
|
204
|
+
raise ClassiqAPIError(message, response.status_code)
|
207
205
|
|
208
|
-
def _make_client_args(self) ->
|
206
|
+
def _make_client_args(self) -> dict[str, Any]:
|
209
207
|
return {
|
210
208
|
"base_url": str(self._config.host),
|
211
209
|
"timeout": self._HTTP_TIMEOUT_SECONDS,
|
@@ -217,11 +215,11 @@ class Client:
|
|
217
215
|
self,
|
218
216
|
http_method: str,
|
219
217
|
url: str,
|
220
|
-
body: Optional[
|
221
|
-
params: Optional[
|
218
|
+
body: Optional[dict] = None,
|
219
|
+
params: Optional[dict] = None,
|
222
220
|
use_versioned_url: bool = True,
|
223
|
-
headers: Optional[
|
224
|
-
) -> Union[
|
221
|
+
headers: Optional[dict[str, str]] = None,
|
222
|
+
) -> Union[dict, list, str]:
|
225
223
|
if use_versioned_url:
|
226
224
|
url = self.make_versioned_url(url)
|
227
225
|
async with self.async_client() as async_client:
|
@@ -239,10 +237,10 @@ class Client:
|
|
239
237
|
self,
|
240
238
|
http_method: str,
|
241
239
|
url: str,
|
242
|
-
body: Optional[
|
243
|
-
headers: Optional[
|
240
|
+
body: Optional[dict] = None,
|
241
|
+
headers: Optional[dict] = None,
|
244
242
|
use_versioned_url: bool = True,
|
245
|
-
) -> Union[
|
243
|
+
) -> Union[dict, str]:
|
246
244
|
if use_versioned_url:
|
247
245
|
url = self.make_versioned_url(url)
|
248
246
|
with httpx.Client(**self._make_client_args()) as sync_client:
|
classiq/_internals/config.py
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
import os
|
4
4
|
import pathlib
|
5
|
-
from typing import
|
5
|
+
from typing import Optional, Union
|
6
6
|
|
7
7
|
import configargparse # type: ignore[import]
|
8
8
|
import pydantic
|
@@ -53,7 +53,7 @@ if os.name == "posix":
|
|
53
53
|
] + _DEFAULT_CONFIG_FILES
|
54
54
|
|
55
55
|
|
56
|
-
def init(args: Optional[Union[str,
|
56
|
+
def init(args: Optional[Union[str, list[str]]] = None) -> Configuration:
|
57
57
|
"""Initialize the configuration object.
|
58
58
|
|
59
59
|
Args:
|
classiq/_internals/jobs.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import json
|
2
2
|
import logging
|
3
|
-
from
|
3
|
+
from collections.abc import Iterable
|
4
|
+
from typing import Callable, Optional, TypeVar
|
4
5
|
|
5
6
|
import httpx
|
6
7
|
import pydantic
|
@@ -52,9 +53,9 @@ class JobPoller:
|
|
52
53
|
def __init__(
|
53
54
|
self,
|
54
55
|
base_url: str,
|
55
|
-
required_headers: Optional[
|
56
|
+
required_headers: Optional[set[str]] = None,
|
56
57
|
use_versioned_url: bool = True,
|
57
|
-
additional_headers: Optional[
|
58
|
+
additional_headers: Optional[dict[str, str]] = None,
|
58
59
|
) -> None:
|
59
60
|
self._required_headers = required_headers or set()
|
60
61
|
self._additional_headers = additional_headers
|
@@ -88,7 +89,7 @@ class JobPoller:
|
|
88
89
|
|
89
90
|
@try_again_on_failure
|
90
91
|
async def _request(
|
91
|
-
self, http_method: str, url: str, body: Optional[
|
92
|
+
self, http_method: str, url: str, body: Optional[dict] = None
|
92
93
|
) -> httpx.Response:
|
93
94
|
# Update headers in case they change
|
94
95
|
self._async_client.headers.update(client().get_headers())
|
@@ -98,7 +99,7 @@ class JobPoller:
|
|
98
99
|
client().handle_response(response)
|
99
100
|
return response
|
100
101
|
|
101
|
-
async def _submit(self, body:
|
102
|
+
async def _submit(self, body: dict) -> httpx.Response:
|
102
103
|
return await self._request(http_method="POST", url=self._base_url, body=body)
|
103
104
|
|
104
105
|
def _interval_sec(self) -> Iterable[float]:
|
@@ -152,7 +153,7 @@ class JobPoller:
|
|
152
153
|
await self._request(http_method="PUT", url=cancel_url)
|
153
154
|
|
154
155
|
async def run(
|
155
|
-
self, body:
|
156
|
+
self, body: dict, timeout_sec: Optional[float]
|
156
157
|
) -> GeneralJobDescription:
|
157
158
|
async with self._async_client:
|
158
159
|
submit_response = await self._submit(body=body)
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import Any,
|
1
|
+
from typing import Any, TypeVar, Union, overload
|
2
2
|
|
3
3
|
T = TypeVar("T")
|
4
4
|
U = TypeVar("U")
|
@@ -10,37 +10,37 @@ U = TypeVar("U")
|
|
10
10
|
|
11
11
|
@overload
|
12
12
|
def validate_type(
|
13
|
-
obj: Any, expected_type:
|
13
|
+
obj: Any, expected_type: type[T], operation: str, exception_type: type[Exception]
|
14
14
|
) -> T: ...
|
15
15
|
|
16
16
|
|
17
17
|
@overload
|
18
18
|
def validate_type(
|
19
19
|
obj: Any,
|
20
|
-
expected_type:
|
20
|
+
expected_type: tuple[type[T], type[U]],
|
21
21
|
operation: str,
|
22
|
-
exception_type:
|
22
|
+
exception_type: type[Exception],
|
23
23
|
) -> Union[T, U]: ...
|
24
24
|
|
25
25
|
|
26
26
|
@overload
|
27
27
|
def validate_type(
|
28
28
|
obj: Any,
|
29
|
-
expected_type:
|
29
|
+
expected_type: tuple[type[T], ...],
|
30
30
|
operation: str,
|
31
|
-
exception_type:
|
31
|
+
exception_type: type[Exception],
|
32
32
|
) -> Any: ...
|
33
33
|
|
34
34
|
|
35
35
|
def validate_type(
|
36
36
|
obj: Any,
|
37
|
-
expected_type: Union[
|
37
|
+
expected_type: Union[tuple[type, ...], type],
|
38
38
|
operation: str,
|
39
|
-
exception_type:
|
39
|
+
exception_type: type[Exception],
|
40
40
|
) -> Any:
|
41
41
|
operation = operation[0].upper() + operation[1:]
|
42
42
|
if not isinstance(obj, expected_type):
|
43
|
-
expected_types:
|
43
|
+
expected_types: tuple[type, ...]
|
44
44
|
if isinstance(expected_type, type):
|
45
45
|
expected_types = (expected_type,)
|
46
46
|
else:
|
classiq/analyzer/__init__.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
1
|
import classiq.analyzer.show_interactive_hack
|
4
2
|
from classiq.analyzer.analyzer import Analyzer
|
5
3
|
|
@@ -8,5 +6,5 @@ from ..analyzer import rb
|
|
8
6
|
__all__ = ["rb"]
|
9
7
|
|
10
8
|
|
11
|
-
def __dir__() ->
|
9
|
+
def __dir__() -> list[str]:
|
12
10
|
return ["rb"]
|
classiq/analyzer/analyzer.py
CHANGED
@@ -2,8 +2,9 @@
|
|
2
2
|
|
3
3
|
import json
|
4
4
|
import webbrowser
|
5
|
+
from collections.abc import Sequence
|
5
6
|
from importlib.util import find_spec
|
6
|
-
from typing import Any,
|
7
|
+
from typing import Any, Optional, Union
|
7
8
|
from urllib.parse import urljoin
|
8
9
|
|
9
10
|
import plotly.graph_objects as go
|
@@ -79,8 +80,8 @@ class Analyzer(AnalyzerUtilities):
|
|
79
80
|
)
|
80
81
|
|
81
82
|
def get_available_devices(
|
82
|
-
self, providers: Optional[
|
83
|
-
) ->
|
83
|
+
self, providers: Optional[list[ProviderNameEnum]] = None
|
84
|
+
) -> dict[ProviderNameEnum, list[DeviceName]]:
|
84
85
|
"""Deprecated. Use get_all_hardware_devices instead.
|
85
86
|
|
86
87
|
Returns dict of the available devices by the providers. only devices
|
@@ -133,7 +134,7 @@ class Analyzer(AnalyzerUtilities):
|
|
133
134
|
def get_hardware_comparison_table(
|
134
135
|
self,
|
135
136
|
providers: Optional[Sequence[Union[str, AnalyzerProviderVendor]]] = None,
|
136
|
-
devices: Optional[
|
137
|
+
devices: Optional[list[str]] = None,
|
137
138
|
) -> None:
|
138
139
|
"""create a comparison table between the transpiled circuits result on different hardware.
|
139
140
|
The comparison table included the depth, multi qubit gates count,and total gates count of the circuits.
|
@@ -159,8 +160,8 @@ class Analyzer(AnalyzerUtilities):
|
|
159
160
|
|
160
161
|
def plot_hardware_comparison_table(
|
161
162
|
self,
|
162
|
-
providers: Optional[
|
163
|
-
devices: Optional[
|
163
|
+
providers: Optional[list[Union[str, AnalyzerProviderVendor]]] = None,
|
164
|
+
devices: Optional[list[str]] = None,
|
164
165
|
) -> None:
|
165
166
|
"""plot the comparison table. if it has not been created it, it first creates the table using all the
|
166
167
|
available hardware.
|
@@ -174,7 +175,7 @@ class Analyzer(AnalyzerUtilities):
|
|
174
175
|
def _hardware_comparison_condition(
|
175
176
|
self,
|
176
177
|
providers: Optional[Sequence[Union[str, AnalyzerProviderVendor]]] = None,
|
177
|
-
devices: Optional[
|
178
|
+
devices: Optional[list[str]] = None,
|
178
179
|
) -> None:
|
179
180
|
if (
|
180
181
|
providers is not None
|
@@ -1,4 +1,4 @@
|
|
1
|
-
from typing import
|
1
|
+
from typing import Union
|
2
2
|
|
3
3
|
from classiq.interface.analyzer import analysis_params
|
4
4
|
from classiq.interface.backend.quantum_backend_providers import AnalyzerProviderVendor
|
@@ -13,9 +13,9 @@ ProviderLowerName = str
|
|
13
13
|
HardwareGraphJson = str
|
14
14
|
Availability = bool
|
15
15
|
ProviderNameEnum = Union[ProviderName, AnalyzerProviderVendor]
|
16
|
-
AvailableDevices =
|
17
|
-
ProviderAvailableDevices =
|
18
|
-
HardwareGraphs =
|
16
|
+
AvailableDevices = dict[DeviceName, Availability]
|
17
|
+
ProviderAvailableDevices = dict[ProviderLowerName, AvailableDevices]
|
18
|
+
HardwareGraphs = dict[DeviceName, HardwareGraphJson]
|
19
19
|
|
20
20
|
|
21
21
|
class AnalyzerUtilities:
|
@@ -32,7 +32,7 @@ class AnalyzerUtilities:
|
|
32
32
|
self.hardware_graphs = hardware_graphs
|
33
33
|
|
34
34
|
async def _request_available_devices_async(
|
35
|
-
self, providers:
|
35
|
+
self, providers: list[ProviderNameEnum]
|
36
36
|
) -> None:
|
37
37
|
requested_providers = self._requested_providers_filter(providers)
|
38
38
|
if not requested_providers:
|
@@ -69,8 +69,8 @@ class AnalyzerUtilities:
|
|
69
69
|
)
|
70
70
|
|
71
71
|
def _requested_providers_filter(
|
72
|
-
self, providers:
|
73
|
-
) ->
|
72
|
+
self, providers: list[ProviderNameEnum]
|
73
|
+
) -> list[ProviderNameEnum]:
|
74
74
|
return list(
|
75
75
|
filter(
|
76
76
|
lambda provider: self.available_devices.get(_to_lower_case(provider))
|
@@ -81,7 +81,7 @@ class AnalyzerUtilities:
|
|
81
81
|
|
82
82
|
def _filter_devices_by_qubits_count(
|
83
83
|
self, provider: ProviderNameEnum
|
84
|
-
) ->
|
84
|
+
) -> list[DeviceName]:
|
85
85
|
device_avail_dict = self.available_devices[_to_lower_case(provider)]
|
86
86
|
return list(
|
87
87
|
filter(lambda device: device_avail_dict[device], device_avail_dict.keys())
|
classiq/analyzer/rb.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
from enum import Enum as PythonEnum
|
2
|
-
from typing import
|
2
|
+
from typing import Optional, Union
|
3
3
|
|
4
4
|
import matplotlib.pyplot as plt
|
5
5
|
import numpy as np
|
@@ -15,7 +15,7 @@ from classiq.executor import BackendPreferencesAndResult
|
|
15
15
|
|
16
16
|
|
17
17
|
class RBAnalysis:
|
18
|
-
def __init__(self, experiments_data:
|
18
|
+
def __init__(self, experiments_data: list[AnalysisRBParams]) -> None:
|
19
19
|
"""Init self.
|
20
20
|
|
21
21
|
Args:
|
@@ -25,8 +25,8 @@ class RBAnalysis:
|
|
25
25
|
self.experiments_data = experiments_data
|
26
26
|
self._total_results: pd.DataFrame = pd.DataFrame()
|
27
27
|
|
28
|
-
async def _get_multiple_hardware_results_async(self) ->
|
29
|
-
total_result:
|
28
|
+
async def _get_multiple_hardware_results_async(self) -> dict[str, RbResults]:
|
29
|
+
total_result: dict[str, RbResults] = {}
|
30
30
|
for batch in self.experiments_data:
|
31
31
|
if len(batch.num_clifford) < 5:
|
32
32
|
raise ClassiqAnalyzerError(
|
@@ -38,7 +38,7 @@ class RBAnalysis:
|
|
38
38
|
return total_result
|
39
39
|
|
40
40
|
@staticmethod
|
41
|
-
def _get_df_indices(results:
|
41
|
+
def _get_df_indices(results: dict[str, RbResults]) -> list[str]:
|
42
42
|
temp_res = results.copy()
|
43
43
|
_, rb_result_keys = temp_res.popitem()
|
44
44
|
return list(rb_result_keys.__dict__.keys())
|
@@ -85,15 +85,15 @@ def _strict_string(arg: Union[PythonEnum, str]) -> str:
|
|
85
85
|
|
86
86
|
|
87
87
|
def order_executor_data_by_hardware(
|
88
|
-
mixed_data:
|
89
|
-
) ->
|
90
|
-
hardware_names:
|
88
|
+
mixed_data: list[BackendPreferencesAndResult],
|
89
|
+
) -> list[AnalysisRBParams]:
|
90
|
+
hardware_names: set[str] = {
|
91
91
|
_strict_string(hardware.backend_name) for hardware, _, _ in mixed_data
|
92
92
|
}
|
93
|
-
counts_dicts:
|
93
|
+
counts_dicts: dict[str, list[dict[str, int]]] = {
|
94
94
|
name: list() for name in hardware_names
|
95
95
|
}
|
96
|
-
cliffords_dicts:
|
96
|
+
cliffords_dicts: dict[str, list[int]] = {name: list() for name in hardware_names}
|
97
97
|
for hardware, num_clifford, result in mixed_data:
|
98
98
|
hw_name: str = _strict_string(hardware.backend_name)
|
99
99
|
counts_dicts[hw_name].append(result.counts) # type: ignore[union-attr]
|
@@ -110,7 +110,7 @@ def order_executor_data_by_hardware(
|
|
110
110
|
|
111
111
|
|
112
112
|
def fit_to_exponential_function(
|
113
|
-
result: RbResults, num_clifford:
|
113
|
+
result: RbResults, num_clifford: list[int], ax: Optional[plt.Axes] = None
|
114
114
|
) -> None:
|
115
115
|
if ax is None:
|
116
116
|
plt.figure()
|
classiq/applications/__init__.py
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
1
|
from classiq.applications import chemistry, combinatorial_optimization, finance, qsvm
|
4
2
|
|
5
3
|
__all__ = [
|
@@ -13,5 +11,5 @@ __all__ = [
|
|
13
11
|
_NON_IMPORTED_PUBLIC_SUBMODULES = ["qnn"]
|
14
12
|
|
15
13
|
|
16
|
-
def __dir__() ->
|
14
|
+
def __dir__() -> list[str]:
|
17
15
|
return __all__ + _NON_IMPORTED_PUBLIC_SUBMODULES
|
@@ -1,5 +1,3 @@
|
|
1
|
-
from typing import List
|
2
|
-
|
3
1
|
from classiq.interface.chemistry.fermionic_operator import (
|
4
2
|
FermionicOperator,
|
5
3
|
SummedFermionicOperator,
|
@@ -38,5 +36,5 @@ __all__ = [
|
|
38
36
|
]
|
39
37
|
|
40
38
|
|
41
|
-
def __dir__() ->
|
39
|
+
def __dir__() -> list[str]:
|
42
40
|
return __all__
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import dataclasses
|
2
|
-
from typing import
|
2
|
+
from typing import Union
|
3
3
|
|
4
4
|
from classiq.interface.generator.excitations import EXCITATIONS_TYPE_EXACT
|
5
5
|
from classiq.interface.generator.ucc import default_excitation_factory
|
@@ -21,9 +21,9 @@ class HVAParameters:
|
|
21
21
|
class HEAParameters:
|
22
22
|
reps: int
|
23
23
|
num_qubits: int
|
24
|
-
connectivity_map:
|
25
|
-
one_qubit_gates:
|
26
|
-
two_qubit_gates:
|
24
|
+
connectivity_map: list[tuple[int, int]]
|
25
|
+
one_qubit_gates: list[str]
|
26
|
+
two_qubit_gates: list[str]
|
27
27
|
|
28
28
|
|
29
29
|
AnsatzParameters = Union[UCCParameters, HVAParameters, HEAParameters]
|