classiq 0.44.0__py3-none-any.whl → 0.45.1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- classiq/__init__.py +1 -2
- classiq/_internals/api_wrapper.py +2 -2
- classiq/_internals/authentication/auth0.py +1 -1
- classiq/_internals/authentication/device.py +5 -1
- classiq/_internals/authentication/token_manager.py +5 -4
- classiq/_internals/client.py +1 -1
- classiq/_internals/config.py +1 -2
- classiq/_internals/host_checker.py +1 -2
- classiq/_internals/jobs.py +1 -1
- classiq/analyzer/analyzer.py +1 -1
- classiq/analyzer/analyzer_utilities.py +1 -1
- classiq/analyzer/rb.py +1 -1
- classiq/applications/chemistry/chemistry_model_constructor.py +1 -1
- classiq/applications/combinatorial_helpers/arithmetic/isolation.py +1 -1
- classiq/applications/combinatorial_helpers/encoding_mapping.py +1 -1
- classiq/applications/combinatorial_helpers/encoding_utils.py +2 -1
- classiq/applications/combinatorial_helpers/optimization_model.py +1 -1
- classiq/applications/combinatorial_helpers/pauli_helpers/pauli_utils.py +1 -1
- classiq/applications/combinatorial_helpers/pyomo_utils.py +1 -2
- classiq/applications/combinatorial_helpers/transformations/encoding.py +1 -1
- classiq/applications/combinatorial_helpers/transformations/fixed_variables.py +5 -4
- classiq/applications/combinatorial_helpers/transformations/ising_converter.py +1 -1
- classiq/applications/combinatorial_helpers/transformations/sign_seperation.py +1 -1
- classiq/applications/finance/finance_model_constructor.py +1 -1
- classiq/applications/qnn/circuit_utils.py +1 -1
- classiq/applications/qnn/datasets/dataset_base_classes.py +2 -1
- classiq/applications/qnn/datasets/dataset_not.py +2 -1
- classiq/applications/qnn/qlayer.py +2 -1
- classiq/applications/qnn/torch_utils.py +2 -1
- classiq/applications/qsvm/qsvm_model_constructor.py +1 -1
- classiq/execution/execution_session.py +1 -1
- classiq/execution/jobs.py +5 -2
- classiq/interface/_version.py +1 -1
- classiq/interface/analyzer/cytoscape_graph.py +1 -2
- classiq/interface/analyzer/result.py +2 -3
- classiq/interface/backend/backend_preferences.py +1 -2
- classiq/interface/backend/quantum_backend_providers.py +1 -1
- classiq/interface/chemistry/fermionic_operator.py +1 -2
- classiq/interface/chemistry/ground_state_problem.py +2 -3
- classiq/interface/chemistry/molecule.py +1 -2
- classiq/interface/chemistry/operator.py +3 -9
- classiq/interface/combinatorial_optimization/encoding_types.py +1 -1
- classiq/interface/combinatorial_optimization/mht_qaoa_input.py +1 -1
- classiq/interface/combinatorial_optimization/solver_types.py +1 -1
- classiq/interface/executor/aws_execution_cost.py +2 -2
- classiq/interface/executor/execution_preferences.py +1 -2
- classiq/interface/executor/execution_result.py +1 -2
- classiq/interface/executor/optimizer_preferences.py +2 -3
- classiq/interface/executor/quantum_code.py +1 -2
- classiq/interface/executor/quantum_instruction_set.py +2 -2
- classiq/interface/executor/register_initialization.py +1 -2
- classiq/interface/executor/result.py +4 -2
- classiq/interface/finance/function_input.py +6 -11
- classiq/interface/generator/amplitude_loading.py +2 -3
- classiq/interface/generator/ansatz_library.py +1 -1
- classiq/interface/generator/application_apis/finance_declarations.py +1 -22
- classiq/interface/generator/arith/arithmetic.py +10 -8
- classiq/interface/generator/arith/arithmetic_arg_type_validator.py +1 -2
- classiq/interface/generator/arith/arithmetic_expression_abc.py +1 -2
- classiq/interface/generator/arith/arithmetic_expression_parser.py +3 -4
- classiq/interface/generator/arith/arithmetic_expression_validator.py +1 -2
- classiq/interface/generator/arith/arithmetic_param_getters.py +1 -2
- classiq/interface/generator/arith/arithmetic_result_builder.py +15 -11
- classiq/interface/generator/arith/ast_node_rewrite.py +1 -1
- classiq/interface/generator/arith/binary_ops.py +2 -3
- classiq/interface/generator/arith/endianness.py +1 -1
- classiq/interface/generator/arith/extremum_operations.py +1 -2
- classiq/interface/generator/arith/logical_ops.py +1 -2
- classiq/interface/generator/arith/register_user_input.py +1 -2
- classiq/interface/generator/arith/unary_ops.py +1 -2
- classiq/interface/generator/arith/uncomputation_methods.py +1 -1
- classiq/interface/generator/chemistry_function_params.py +1 -2
- classiq/interface/generator/circuit_code/circuit_code.py +1 -2
- classiq/interface/generator/circuit_code/types_and_constants.py +1 -2
- classiq/interface/generator/commuting_pauli_exponentiation.py +1 -2
- classiq/interface/generator/control_state.py +1 -2
- classiq/interface/generator/custom_ansatz.py +1 -2
- classiq/interface/generator/expressions/enums/finance_functions.py +4 -5
- classiq/interface/generator/expressions/evaluated_expression.py +1 -2
- classiq/interface/generator/expressions/expression.py +1 -2
- classiq/interface/generator/expressions/non_symbolic_expr.py +1 -1
- classiq/interface/generator/expressions/qmod_qarray_proxy.py +2 -5
- classiq/interface/generator/expressions/qmod_qscalar_proxy.py +2 -7
- classiq/interface/generator/expressions/qmod_qstruct_proxy.py +1 -1
- classiq/interface/generator/expressions/qmod_sized_proxy.py +1 -1
- classiq/interface/generator/function_params.py +2 -3
- classiq/interface/generator/functions/classical_type.py +0 -38
- classiq/interface/generator/functions/port_declaration.py +1 -2
- classiq/interface/generator/functions/type_name.py +2 -26
- classiq/interface/generator/grover_diffuser.py +1 -2
- classiq/interface/generator/grover_operator.py +1 -2
- classiq/interface/generator/hamiltonian_evolution/exponentiation.py +1 -2
- classiq/interface/generator/hamiltonian_evolution/suzuki_trotter.py +1 -2
- classiq/interface/generator/hardware/hardware_data.py +1 -2
- classiq/interface/generator/hardware_efficient_ansatz.py +2 -3
- classiq/interface/generator/hartree_fock.py +1 -2
- classiq/interface/generator/linear_pauli_rotations.py +1 -2
- classiq/interface/generator/mcmt_method.py +1 -1
- classiq/interface/generator/mcu.py +1 -2
- classiq/interface/generator/mcx.py +1 -2
- classiq/interface/generator/model/constraints.py +2 -3
- classiq/interface/generator/model/model.py +1 -2
- classiq/interface/generator/model/preferences/preferences.py +2 -3
- classiq/interface/generator/model/quantum_register.py +1 -2
- classiq/interface/generator/oracles/arithmetic_oracle.py +1 -2
- classiq/interface/generator/oracles/custom_oracle.py +1 -2
- classiq/interface/generator/oracles/oracle_abc.py +1 -2
- classiq/interface/generator/partitioned_register.py +1 -2
- classiq/interface/generator/piecewise_linear_amplitude_loading.py +1 -2
- classiq/interface/generator/preferences/optimization.py +1 -2
- classiq/interface/generator/qpe.py +1 -2
- classiq/interface/generator/qsvm.py +2 -3
- classiq/interface/generator/quantum_function_call.py +1 -2
- classiq/interface/generator/quantum_program.py +4 -5
- classiq/interface/generator/range_types.py +1 -1
- classiq/interface/generator/register_role.py +1 -1
- classiq/interface/generator/slice_parsing_utils.py +1 -2
- classiq/interface/generator/standard_gates/controlled_standard_gates.py +1 -2
- classiq/interface/generator/state_preparation/metrics.py +2 -3
- classiq/interface/generator/state_preparation/state_preparation.py +1 -2
- classiq/interface/generator/transpiler_basis_gates.py +1 -1
- classiq/interface/generator/types/builtin_enum_declarations.py +38 -45
- classiq/interface/generator/types/enum_declaration.py +1 -2
- classiq/interface/generator/types/struct_declaration.py +1 -2
- classiq/interface/generator/ucc.py +1 -2
- classiq/interface/generator/unitary_gate.py +1 -2
- classiq/interface/generator/validations/flow_graph.py +1 -2
- classiq/interface/generator/validations/validator_functions.py +1 -2
- classiq/interface/hardware.py +1 -1
- classiq/interface/helpers/validation_helpers.py +1 -2
- classiq/interface/ide/visual_model.py +1 -2
- classiq/interface/jobs.py +2 -3
- classiq/interface/model/bind_operation.py +1 -2
- classiq/interface/model/inplace_binary_operation.py +1 -2
- classiq/interface/model/model.py +1 -2
- classiq/interface/model/parameter.py +1 -2
- classiq/interface/model/port_declaration.py +1 -2
- classiq/interface/model/quantum_expressions/amplitude_loading_operation.py +1 -2
- classiq/interface/model/quantum_function_call.py +1 -2
- classiq/interface/model/quantum_lambda_function.py +1 -2
- classiq/interface/model/quantum_type.py +1 -22
- classiq/interface/model/validation_handle.py +1 -2
- classiq/interface/server/global_versions.py +2 -2
- classiq/qmod/builtins/classical_execution_primitives.py +1 -1
- classiq/qmod/builtins/operations.py +1 -1
- classiq/qmod/classical_function.py +1 -1
- classiq/qmod/declaration_inferrer.py +9 -7
- classiq/qmod/qmod_constant.py +1 -1
- classiq/qmod/qmod_parameter.py +26 -2
- classiq/qmod/qmod_variable.py +48 -9
- classiq/qmod/quantum_expandable.py +9 -3
- classiq/qmod/quantum_function.py +9 -2
- classiq/qmod/semantics/annotation.py +1 -2
- classiq/qmod/semantics/static_semantics_visitor.py +1 -1
- classiq/qmod/semantics/validation/func_call_validation.py +1 -1
- classiq/qmod/symbolic.py +2 -1
- classiq/show.py +1 -1
- {classiq-0.44.0.dist-info → classiq-0.45.1.dist-info}/METADATA +1 -1
- {classiq-0.44.0.dist-info → classiq-0.45.1.dist-info}/RECORD +162 -162
- /classiq/{_internals → interface}/enum_utils.py +0 -0
- /classiq/{exceptions.py → interface/exceptions.py} +0 -0
- {classiq-0.44.0.dist-info → classiq-0.45.1.dist-info}/WHEEL +0 -0
classiq/__init__.py
CHANGED
@@ -15,7 +15,7 @@ from classiq.interface.generator.model import __all__ as _md_all
|
|
15
15
|
from classiq.interface.generator.quantum_program import QuantumProgram
|
16
16
|
from classiq.interface.generator.types.builtin_enum_declarations import * # noqa: F403
|
17
17
|
|
18
|
-
from classiq import applications,
|
18
|
+
from classiq import applications, execution, synthesis
|
19
19
|
from classiq._internals import logger
|
20
20
|
from classiq._internals.async_utils import (
|
21
21
|
enable_jupyter_notebook,
|
@@ -75,7 +75,6 @@ if _is_notebook():
|
|
75
75
|
_sub_modules = [
|
76
76
|
"analyzer",
|
77
77
|
"applications",
|
78
|
-
"exceptions",
|
79
78
|
"execution",
|
80
79
|
"open_help",
|
81
80
|
"qmod",
|
@@ -8,6 +8,8 @@ import classiq.interface.pyomo_extension
|
|
8
8
|
from classiq.interface.analyzer import analysis_params, result as analysis_result
|
9
9
|
from classiq.interface.analyzer.analysis_params import AnalysisRBParams
|
10
10
|
from classiq.interface.chemistry import ground_state_problem, operator
|
11
|
+
from classiq.interface.enum_utils import StrEnum
|
12
|
+
from classiq.interface.exceptions import ClassiqAPIError, ClassiqValueError
|
11
13
|
from classiq.interface.execution.jobs import (
|
12
14
|
ExecutionJobDetailsV1,
|
13
15
|
ExecutionJobsQueryResultsV1,
|
@@ -20,9 +22,7 @@ from classiq.interface.model.model import Model
|
|
20
22
|
from classiq.interface.server import routes
|
21
23
|
|
22
24
|
from classiq._internals.client import client
|
23
|
-
from classiq._internals.enum_utils import StrEnum
|
24
25
|
from classiq._internals.jobs import JobPoller
|
25
|
-
from classiq.exceptions import ClassiqAPIError, ClassiqValueError
|
26
26
|
|
27
27
|
ResultType = TypeVar("ResultType", bound=pydantic.BaseModel)
|
28
28
|
CLASSIQ_ACCEPT_HEADER = "X-Classiq-Accept-Version"
|
@@ -5,7 +5,7 @@ from typing import Any, Dict, Optional, Union
|
|
5
5
|
from httpx import AsyncClient, Response, codes
|
6
6
|
from pydantic import BaseSettings, Field
|
7
7
|
|
8
|
-
from classiq.exceptions import ClassiqAuthenticationError
|
8
|
+
from classiq.interface.exceptions import ClassiqAuthenticationError
|
9
9
|
|
10
10
|
|
11
11
|
class AuthSettings(BaseSettings):
|
@@ -3,9 +3,13 @@ import webbrowser
|
|
3
3
|
from datetime import timedelta
|
4
4
|
from typing import Any, Dict, Iterable, Optional, TypeVar
|
5
5
|
|
6
|
+
from classiq.interface.exceptions import (
|
7
|
+
ClassiqAuthenticationError,
|
8
|
+
ClassiqExpiredTokenError,
|
9
|
+
)
|
10
|
+
|
6
11
|
from classiq._internals.async_utils import poll_for
|
7
12
|
from classiq._internals.authentication.auth0 import Auth0, Tokens
|
8
|
-
from classiq.exceptions import ClassiqAuthenticationError, ClassiqExpiredTokenError
|
9
13
|
|
10
14
|
T = TypeVar("T")
|
11
15
|
|
@@ -4,14 +4,15 @@ import threading
|
|
4
4
|
import warnings
|
5
5
|
from typing import Optional, Sequence, Type
|
6
6
|
|
7
|
+
from classiq.interface.exceptions import (
|
8
|
+
ClassiqAuthenticationError,
|
9
|
+
ClassiqPasswordManagerSelectionError,
|
10
|
+
)
|
11
|
+
|
7
12
|
from classiq._internals.authentication import password_manager as pm
|
8
13
|
from classiq._internals.authentication.auth0 import Auth0
|
9
14
|
from classiq._internals.authentication.device import DeviceRegistrar, Tokens
|
10
15
|
from classiq._internals.config import Configuration
|
11
|
-
from classiq.exceptions import (
|
12
|
-
ClassiqAuthenticationError,
|
13
|
-
ClassiqPasswordManagerSelectionError,
|
14
|
-
)
|
15
16
|
|
16
17
|
PASSWORD_MANAGERS: Sequence[Type[pm.PasswordManager]] = [
|
17
18
|
pm.KeyringPasswordManager,
|
classiq/_internals/client.py
CHANGED
@@ -22,12 +22,12 @@ import httpx
|
|
22
22
|
from typing_extensions import ParamSpec
|
23
23
|
|
24
24
|
from classiq.interface._version import VERSION as _VERSION
|
25
|
+
from classiq.interface.exceptions import ClassiqAPIError, ClassiqExpiredTokenError
|
25
26
|
from classiq.interface.interface_version import INTERFACE_VERSION
|
26
27
|
|
27
28
|
from classiq._internals import config
|
28
29
|
from classiq._internals.authentication import token_manager
|
29
30
|
from classiq._internals.host_checker import HostChecker
|
30
|
-
from classiq.exceptions import ClassiqAPIError, ClassiqExpiredTokenError
|
31
31
|
|
32
32
|
_FRONTEND_VARIANT: str = "classiq-sdk"
|
33
33
|
_INTERFACE_VARIANT: str = "classiq-interface-sdk"
|
classiq/_internals/config.py
CHANGED
@@ -8,10 +8,9 @@ import configargparse # type: ignore[import]
|
|
8
8
|
import pydantic
|
9
9
|
from pydantic import BaseModel
|
10
10
|
|
11
|
+
from classiq.interface.enum_utils import StrEnum
|
11
12
|
from classiq.interface.server.routes import DEFAULT_IDE_FE_APP
|
12
13
|
|
13
|
-
from classiq._internals.enum_utils import StrEnum
|
14
|
-
|
15
14
|
DEFAULT_HOST = "https://api.classiq.io"
|
16
15
|
|
17
16
|
|
@@ -10,11 +10,10 @@ import pydantic
|
|
10
10
|
from packaging.version import Version
|
11
11
|
from pydantic import BaseModel
|
12
12
|
|
13
|
+
from classiq.interface.exceptions import ClassiqAPIError, ClassiqDeprecationWarning
|
13
14
|
from classiq.interface.interface_version import INTERFACE_VERSION
|
14
15
|
from classiq.interface.server.global_versions import DeprecationInfo, GlobalVersions
|
15
16
|
|
16
|
-
from classiq.exceptions import ClassiqAPIError, ClassiqDeprecationWarning
|
17
|
-
|
18
17
|
if TYPE_CHECKING:
|
19
18
|
from classiq._internals.client import Client
|
20
19
|
|
classiq/_internals/jobs.py
CHANGED
@@ -5,12 +5,12 @@ from typing import Callable, Dict, Iterable, Optional, Set, TypeVar
|
|
5
5
|
import httpx
|
6
6
|
import pydantic
|
7
7
|
|
8
|
+
from classiq.interface.exceptions import ClassiqAPIError
|
8
9
|
from classiq.interface.jobs import JobDescription, JobID, JSONObject
|
9
10
|
|
10
11
|
from classiq._internals.async_utils import poll_for
|
11
12
|
from classiq._internals.client import client, try_again_on_failure
|
12
13
|
from classiq._internals.config import SDKMode
|
13
|
-
from classiq.exceptions import ClassiqAPIError
|
14
14
|
|
15
15
|
_URL_PATH_SEP = "/"
|
16
16
|
GeneralJobDescription = JobDescription[JSONObject]
|
classiq/analyzer/analyzer.py
CHANGED
@@ -10,6 +10,7 @@ import plotly.graph_objects as go
|
|
10
10
|
|
11
11
|
from classiq.interface.analyzer import analysis_params
|
12
12
|
from classiq.interface.backend.quantum_backend_providers import AnalyzerProviderVendor
|
13
|
+
from classiq.interface.exceptions import ClassiqAnalyzerError
|
13
14
|
from classiq.interface.generator import quantum_program as generator_result
|
14
15
|
|
15
16
|
from classiq._internals import async_utils, client
|
@@ -20,7 +21,6 @@ from classiq.analyzer.analyzer_utilities import (
|
|
20
21
|
ProviderNameEnum,
|
21
22
|
)
|
22
23
|
from classiq.analyzer.url_utils import circuit_page_uri, client_ide_base_url
|
23
|
-
from classiq.exceptions import ClassiqAnalyzerError
|
24
24
|
|
25
25
|
find_ipywidgets = find_spec("ipywidgets")
|
26
26
|
VBox = Any
|
@@ -2,10 +2,10 @@ from typing import Dict, List, Union
|
|
2
2
|
|
3
3
|
from classiq.interface.analyzer import analysis_params
|
4
4
|
from classiq.interface.backend.quantum_backend_providers import AnalyzerProviderVendor
|
5
|
+
from classiq.interface.exceptions import ClassiqAnalyzerError
|
5
6
|
from classiq.interface.generator.quantum_program import QuantumProgram
|
6
7
|
|
7
8
|
from classiq._internals.api_wrapper import ApiWrapper
|
8
|
-
from classiq.exceptions import ClassiqAnalyzerError
|
9
9
|
|
10
10
|
DeviceName = str
|
11
11
|
ProviderName = str
|
classiq/analyzer/rb.py
CHANGED
@@ -8,9 +8,9 @@ import plotly.graph_objects as go
|
|
8
8
|
|
9
9
|
from classiq.interface.analyzer.analysis_params import AnalysisRBParams
|
10
10
|
from classiq.interface.analyzer.result import RbResults
|
11
|
+
from classiq.interface.exceptions import ClassiqAnalyzerError
|
11
12
|
|
12
13
|
from classiq._internals.api_wrapper import ApiWrapper
|
13
|
-
from classiq.exceptions import ClassiqAnalyzerError
|
14
14
|
from classiq.executor import BackendPreferencesAndResult
|
15
15
|
|
16
16
|
|
@@ -50,7 +50,7 @@ from classiq.applications.chemistry.ansatz_parameters import (
|
|
50
50
|
from classiq.applications.chemistry.chemistry_execution_parameters import (
|
51
51
|
ChemistryExecutionParameters,
|
52
52
|
)
|
53
|
-
from classiq.exceptions import ClassiqError
|
53
|
+
from classiq.interface.exceptions import ClassiqError
|
54
54
|
from classiq.qmod.utilities import qmod_val_to_expr_str
|
55
55
|
|
56
56
|
_LADDER_OPERATOR_TYPE_INDICATOR_TO_QMOD_MAPPING: Dict[str, str] = {
|
@@ -1,7 +1,7 @@
|
|
1
1
|
from sympy import Eq, Expr, GreaterThan, LessThan, Rational, Symbol, solve
|
2
2
|
from sympy.core.relational import Relational
|
3
3
|
|
4
|
-
from classiq.exceptions import ClassiqCombOptNoSolutionError
|
4
|
+
from classiq.interface.exceptions import ClassiqCombOptNoSolutionError
|
5
5
|
|
6
6
|
|
7
7
|
def isolate(expression: Expr, var: Symbol) -> Expr:
|
@@ -7,9 +7,9 @@ from pyomo.core.base import _GeneralVarData
|
|
7
7
|
from pyomo.core.expr.visitor import clone_expression, identify_variables
|
8
8
|
|
9
9
|
from classiq.interface.combinatorial_optimization.encoding_types import EncodingType
|
10
|
+
from classiq.interface.exceptions import ClassiqCombOptError
|
10
11
|
|
11
12
|
from classiq.applications.combinatorial_helpers import pyomo_utils
|
12
|
-
from classiq.exceptions import ClassiqCombOptError
|
13
13
|
|
14
14
|
|
15
15
|
@dataclass
|
@@ -14,8 +14,9 @@ from pyomo.core.expr.numeric_expr import (
|
|
14
14
|
)
|
15
15
|
from sympy import Expr
|
16
16
|
|
17
|
+
from classiq.interface.exceptions import ClassiqCombOptNoSolutionError
|
18
|
+
|
17
19
|
from classiq.applications.combinatorial_helpers import pyomo_utils
|
18
|
-
from classiq.exceptions import ClassiqCombOptNoSolutionError
|
19
20
|
|
20
21
|
_INTEGER_TYPES = [pyo.NonNegativeIntegers, pyo.Integers, pyo.PositiveIntegers]
|
21
22
|
|
@@ -12,6 +12,7 @@ from classiq.interface.chemistry.operator import PauliOperator
|
|
12
12
|
from classiq.interface.combinatorial_optimization import sense
|
13
13
|
from classiq.interface.combinatorial_optimization.encoding_types import EncodingType
|
14
14
|
from classiq.interface.combinatorial_optimization.solver_types import QSolver
|
15
|
+
from classiq.interface.exceptions import ClassiqCombOptError
|
15
16
|
|
16
17
|
from classiq.applications.combinatorial_helpers import (
|
17
18
|
encoding_utils,
|
@@ -33,7 +34,6 @@ from classiq.applications.combinatorial_helpers.transformations.fixed_variables
|
|
33
34
|
from classiq.applications.combinatorial_helpers.transformations.penalty_support import (
|
34
35
|
is_model_penalty_supported,
|
35
36
|
)
|
36
|
-
from classiq.exceptions import ClassiqCombOptError
|
37
37
|
|
38
38
|
|
39
39
|
class OptimizationModel:
|
@@ -1,9 +1,9 @@
|
|
1
1
|
from typing import List
|
2
2
|
|
3
|
+
from classiq.interface.exceptions import ClassiqNonNumericCoefficientInPauliError
|
3
4
|
from classiq.interface.generator.functions.qmod_python_interface import QmodPyStruct
|
4
5
|
from classiq.interface.helpers.custom_pydantic_types import PydanticPauliList
|
5
6
|
|
6
|
-
from classiq.exceptions import ClassiqNonNumericCoefficientInPauliError
|
7
7
|
from classiq.qmod.builtins import PauliTerm
|
8
8
|
from classiq.qmod.builtins.enums import Pauli
|
9
9
|
|
@@ -18,11 +18,10 @@ from pyomo.core.expr.sympy_tools import (
|
|
18
18
|
Sympy2PyomoVisitor,
|
19
19
|
)
|
20
20
|
|
21
|
+
from classiq.interface.exceptions import ClassiqValueError
|
21
22
|
from classiq.interface.generator.expressions.expression import Expression
|
22
23
|
from classiq.interface.generator.types.struct_declaration import StructDeclaration
|
23
24
|
|
24
|
-
from classiq.exceptions import ClassiqValueError
|
25
|
-
|
26
25
|
ListVars = List[_GeneralVarData]
|
27
26
|
|
28
27
|
|
@@ -9,11 +9,11 @@ from pyomo.core.expr.relational_expr import EqualityExpression
|
|
9
9
|
|
10
10
|
from classiq.interface.combinatorial_optimization.encoding_types import EncodingType
|
11
11
|
from classiq.interface.combinatorial_optimization.solver_types import QSolver
|
12
|
+
from classiq.interface.exceptions import ClassiqCombOptInvalidEncodingTypeError
|
12
13
|
|
13
14
|
from classiq.applications.combinatorial_helpers import encoding_utils, pyomo_utils
|
14
15
|
from classiq.applications.combinatorial_helpers.encoding_mapping import EncodingMapping
|
15
16
|
from classiq.applications.combinatorial_helpers.encoding_utils import ONE_HOT_SUFFIX
|
16
|
-
from classiq.exceptions import ClassiqCombOptInvalidEncodingTypeError
|
17
17
|
|
18
18
|
|
19
19
|
def _make_invalid_encoding_type_error(
|
@@ -7,6 +7,11 @@ from pyomo.core.expr.relational_expr import EqualityExpression
|
|
7
7
|
from pyomo.core.expr.visitor import identify_variables
|
8
8
|
from pyomo.repn.standard_repn import _GeneralVarData
|
9
9
|
|
10
|
+
from classiq.interface.exceptions import (
|
11
|
+
ClassiqCombOptNoSolutionError,
|
12
|
+
ClassiqCombOptTrivialProblemError,
|
13
|
+
)
|
14
|
+
|
10
15
|
from classiq.applications.combinatorial_helpers import (
|
11
16
|
encoding_utils,
|
12
17
|
pyomo_utils,
|
@@ -20,10 +25,6 @@ from classiq.applications.combinatorial_helpers.sympy_utils import (
|
|
20
25
|
sympyify_expression,
|
21
26
|
sympyify_vars,
|
22
27
|
)
|
23
|
-
from classiq.exceptions import (
|
24
|
-
ClassiqCombOptNoSolutionError,
|
25
|
-
ClassiqCombOptTrivialProblemError,
|
26
|
-
)
|
27
28
|
|
28
29
|
|
29
30
|
def remove_fixed_variables(model: ConcreteModel) -> ConcreteModel:
|
@@ -5,6 +5,7 @@ import sympy as sp
|
|
5
5
|
from pyomo.core.base import _GeneralVarData
|
6
6
|
|
7
7
|
from classiq.interface.chemistry.operator import PauliOperator
|
8
|
+
from classiq.interface.exceptions import ClassiqCombOptNotSupportedProblemError
|
8
9
|
from classiq.interface.helpers import custom_pydantic_types
|
9
10
|
|
10
11
|
from classiq.applications.combinatorial_helpers import memory
|
@@ -13,7 +14,6 @@ from classiq.applications.combinatorial_helpers.sympy_utils import (
|
|
13
14
|
sympyify_expression,
|
14
15
|
sympyify_vars,
|
15
16
|
)
|
16
|
-
from classiq.exceptions import ClassiqCombOptNotSupportedProblemError
|
17
17
|
|
18
18
|
PYOMO_PARSING_ERROR_MESAGE = "Parsing of this pyomo model is not supported."
|
19
19
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
from math import floor, log
|
2
2
|
from typing import Union
|
3
3
|
|
4
|
+
from classiq.interface.exceptions import ClassiqError
|
4
5
|
from classiq.interface.finance.function_input import FinanceFunctionInput
|
5
6
|
from classiq.interface.finance.gaussian_model_input import GaussianModelInput
|
6
7
|
from classiq.interface.finance.log_normal_model_input import LogNormalModelInput
|
@@ -20,7 +21,6 @@ from classiq.interface.model.variable_declaration_statement import (
|
|
20
21
|
)
|
21
22
|
|
22
23
|
from classiq.applications.libraries.qmci_library import QMCI_LIBRARY
|
23
|
-
from classiq.exceptions import ClassiqError
|
24
24
|
from classiq.qmod.utilities import qmod_val_to_expr_str
|
25
25
|
|
26
26
|
_OUTPUT_VARIABLE_NAME = "payoff_estimation"
|
@@ -4,12 +4,12 @@ from typing import Iterable, List, Tuple, Union
|
|
4
4
|
|
5
5
|
from torch import Tensor
|
6
6
|
|
7
|
+
from classiq.interface.exceptions import ClassiqQNNError, ClassiqValueError
|
7
8
|
from classiq.interface.generator.circuit_code.types_and_constants import QasmVersion
|
8
9
|
from classiq.interface.generator.model.preferences.preferences import QuantumFormat
|
9
10
|
from classiq.interface.generator.quantum_program import QuantumProgram
|
10
11
|
|
11
12
|
from classiq.applications.qnn.types import Arguments, Circuit
|
12
|
-
from classiq.exceptions import ClassiqQNNError, ClassiqValueError
|
13
13
|
|
14
14
|
WEIGHT_INITIALS = ["weight_", "w_"]
|
15
15
|
INPUT_INITIALS = ["input_", "i_"]
|
@@ -4,8 +4,9 @@ from typing import List, Literal, Optional, Sequence, Tuple, TypeVar, Union
|
|
4
4
|
from torch import Tensor, tensor
|
5
5
|
from torch.utils.data import Dataset
|
6
6
|
|
7
|
+
from classiq.interface.exceptions import ClassiqIndexError, ClassiqValueError
|
8
|
+
|
7
9
|
from classiq.applications.qnn.types import DataAndLabel, Transform
|
8
|
-
from classiq.exceptions import ClassiqIndexError, ClassiqValueError
|
9
10
|
|
10
11
|
T = TypeVar("T")
|
11
12
|
|
@@ -1,10 +1,11 @@
|
|
1
|
+
from classiq.interface.exceptions import ClassiqIndexError
|
2
|
+
|
1
3
|
from classiq.applications.qnn.datasets.dataset_base_classes import MyDataset
|
2
4
|
from classiq.applications.qnn.datasets.datasets_utils import (
|
3
5
|
all_bits_to_one,
|
4
6
|
all_bits_to_zero,
|
5
7
|
)
|
6
8
|
from classiq.applications.qnn.types import DataAndLabel
|
7
|
-
from classiq.exceptions import ClassiqIndexError
|
8
9
|
|
9
10
|
|
10
11
|
class DatasetNot(MyDataset):
|
@@ -6,6 +6,8 @@ import torch.nn as nn
|
|
6
6
|
from torch import Tensor
|
7
7
|
from torch.nn.parameter import Parameter
|
8
8
|
|
9
|
+
from classiq.interface.exceptions import ClassiqQNNError, ClassiqTorchError
|
10
|
+
|
9
11
|
from classiq.applications.qnn.circuit_utils import (
|
10
12
|
extract_parameters,
|
11
13
|
is_single_layer_circuit,
|
@@ -26,7 +28,6 @@ from classiq.applications.qnn.types import (
|
|
26
28
|
MultipleArguments,
|
27
29
|
PostProcessFunction,
|
28
30
|
)
|
29
|
-
from classiq.exceptions import ClassiqQNNError, ClassiqTorchError
|
30
31
|
from classiq.synthesis import SerializedQuantumProgram
|
31
32
|
|
32
33
|
|
@@ -6,6 +6,8 @@ import torch
|
|
6
6
|
import torch.nn as nn
|
7
7
|
from torch import Tensor
|
8
8
|
|
9
|
+
from classiq.interface.exceptions import ClassiqValueError
|
10
|
+
|
9
11
|
from classiq.applications.qnn.circuit_utils import is_single_layer_circuit
|
10
12
|
from classiq.applications.qnn.types import (
|
11
13
|
ExecuteFuncitonOnlyArguments,
|
@@ -13,7 +15,6 @@ from classiq.applications.qnn.types import (
|
|
13
15
|
Shape,
|
14
16
|
TensorToArgumentsCallable,
|
15
17
|
)
|
16
|
-
from classiq.exceptions import ClassiqValueError
|
17
18
|
|
18
19
|
|
19
20
|
def get_shape_second_dimension(shape: torch.Size) -> int:
|
@@ -1,6 +1,7 @@
|
|
1
1
|
from typing import Any, List, Tuple
|
2
2
|
|
3
3
|
from classiq.interface.applications.qsvm import DataList, LabelsInt
|
4
|
+
from classiq.interface.exceptions import ClassiqValueError
|
4
5
|
from classiq.interface.generator.expressions.expression import Expression
|
5
6
|
from classiq.interface.generator.functions.port_declaration import (
|
6
7
|
PortDeclarationDirection,
|
@@ -11,7 +12,6 @@ from classiq.interface.model.native_function_definition import NativeFunctionDef
|
|
11
12
|
from classiq.interface.model.port_declaration import PortDeclaration
|
12
13
|
from classiq.interface.model.quantum_function_call import QuantumFunctionCall
|
13
14
|
|
14
|
-
from classiq.exceptions import ClassiqValueError
|
15
15
|
from classiq.qmod.builtins.enums import Pauli, QSVMFeatureMapEntanglement
|
16
16
|
from classiq.qmod.utilities import qmod_val_to_expr_str
|
17
17
|
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import json
|
2
2
|
from typing import Any, Callable, Dict, List, Optional, Tuple, Union, cast
|
3
3
|
|
4
|
+
from classiq.interface.exceptions import ClassiqValueError
|
4
5
|
from classiq.interface.executor.execution_preferences import ExecutionPreferences
|
5
6
|
from classiq.interface.executor.execution_result import ResultsCollection
|
6
7
|
from classiq.interface.executor.result import (
|
@@ -16,7 +17,6 @@ from classiq.applications.combinatorial_helpers.pauli_helpers.pauli_utils import
|
|
16
17
|
_pauli_dict_to_str,
|
17
18
|
_pauli_terms_to_qmod,
|
18
19
|
)
|
19
|
-
from classiq.exceptions import ClassiqValueError
|
20
20
|
from classiq.executor import execute
|
21
21
|
from classiq.qmod.builtins import PauliTerm
|
22
22
|
from classiq.qmod.builtins.classical_execution_primitives import (
|
classiq/execution/jobs.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1
1
|
import webbrowser
|
2
2
|
from datetime import datetime
|
3
|
-
from typing import List, Optional, Union
|
3
|
+
from typing import Any, List, Optional, Union
|
4
4
|
from urllib.parse import urljoin
|
5
5
|
|
6
|
+
from classiq.interface.exceptions import ClassiqAPIError
|
6
7
|
from classiq.interface.execution.jobs import ExecutionJobDetailsV1
|
7
8
|
from classiq.interface.executor.execution_request import ExecutionJobDetails
|
8
9
|
from classiq.interface.executor.execution_result import ResultsCollection
|
@@ -13,7 +14,6 @@ from classiq._internals.api_wrapper import CLASSIQ_ACCEPT_HEADER, ApiWrapper
|
|
13
14
|
from classiq._internals.async_utils import syncify_function
|
14
15
|
from classiq._internals.client import client
|
15
16
|
from classiq._internals.jobs import JobID, JobPoller
|
16
|
-
from classiq.exceptions import ClassiqAPIError
|
17
17
|
|
18
18
|
_JobDetails = Union[ExecutionJobDetails, ExecutionJobDetailsV1]
|
19
19
|
|
@@ -109,6 +109,9 @@ class ExecutionJob:
|
|
109
109
|
|
110
110
|
result = syncify_function(result_async)
|
111
111
|
|
112
|
+
def result_value(self, *args: Any, **kwargs: Any) -> Any:
|
113
|
+
return self.result(*args, **kwargs)[0].value
|
114
|
+
|
112
115
|
async def poll_async(self, timeout_sec: Optional[float] = None) -> None:
|
113
116
|
if not self.status.is_final():
|
114
117
|
await self._poll_job(timeout_sec=timeout_sec)
|
classiq/interface/_version.py
CHANGED
@@ -2,10 +2,9 @@ from typing import Any, Dict, List, Optional
|
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
|
5
|
+
from classiq.interface.enum_utils import StrEnum
|
5
6
|
from classiq.interface.helpers.versioned_model import VersionedModel
|
6
7
|
|
7
|
-
from classiq._internals.enum_utils import StrEnum
|
8
|
-
|
9
8
|
|
10
9
|
class CytoScapePosition(pydantic.BaseModel):
|
11
10
|
x: int = pydantic.Field(
|
@@ -6,12 +6,11 @@ from pydantic import Field
|
|
6
6
|
from typing_extensions import Annotated
|
7
7
|
|
8
8
|
from classiq.interface.analyzer.analysis_params import MAX_FILE_LENGTH
|
9
|
+
from classiq.interface.enum_utils import StrEnum
|
10
|
+
from classiq.interface.exceptions import ClassiqValueError
|
9
11
|
from classiq.interface.helpers.custom_pydantic_types import PydanticNonEmptyString
|
10
12
|
from classiq.interface.helpers.versioned_model import VersionedModel
|
11
13
|
|
12
|
-
from classiq._internals.enum_utils import StrEnum
|
13
|
-
from classiq.exceptions import ClassiqValueError
|
14
|
-
|
15
14
|
Match = List[List[int]]
|
16
15
|
|
17
16
|
|
@@ -18,11 +18,10 @@ from classiq.interface.backend.quantum_backend_providers import (
|
|
18
18
|
ProviderTypeVendor,
|
19
19
|
ProviderVendor,
|
20
20
|
)
|
21
|
+
from classiq.interface.exceptions import ClassiqValueError
|
21
22
|
from classiq.interface.hardware import Provider
|
22
23
|
from classiq.interface.helpers.pydantic_model_helpers import values_with_discriminator
|
23
24
|
|
24
|
-
from classiq.exceptions import ClassiqValueError
|
25
|
-
|
26
25
|
|
27
26
|
class BackendPreferences(BaseModel):
|
28
27
|
# Due to the way the field is currently implemented, i.e. it redefined with different types
|
@@ -6,12 +6,11 @@ from typing import Set, Tuple, Union
|
|
6
6
|
import numpy as np
|
7
7
|
import pydantic
|
8
8
|
|
9
|
+
from classiq.interface.exceptions import ClassiqValueError
|
9
10
|
from classiq.interface.helpers.hashable_pydantic_base_model import (
|
10
11
|
HashablePydanticBaseModel,
|
11
12
|
)
|
12
13
|
|
13
|
-
from classiq.exceptions import ClassiqValueError
|
14
|
-
|
15
14
|
LadderOperator = Tuple[str, int]
|
16
15
|
FermionicOperatorTuple = Tuple["FermionicOperator", float]
|
17
16
|
|
@@ -6,13 +6,12 @@ from typing_extensions import Annotated
|
|
6
6
|
|
7
7
|
from classiq.interface.chemistry.fermionic_operator import SummedFermionicOperator
|
8
8
|
from classiq.interface.chemistry.molecule import Molecule
|
9
|
+
from classiq.interface.enum_utils import StrEnum
|
10
|
+
from classiq.interface.exceptions import ClassiqValueError
|
9
11
|
from classiq.interface.helpers.hashable_pydantic_base_model import (
|
10
12
|
HashablePydanticBaseModel,
|
11
13
|
)
|
12
14
|
|
13
|
-
from classiq._internals.enum_utils import StrEnum
|
14
|
-
from classiq.exceptions import ClassiqValueError
|
15
|
-
|
16
15
|
"""
|
17
16
|
The correct type hint is:
|
18
17
|
NumSpinUpParticles = pydantic.NonNegativeInt
|
@@ -3,13 +3,12 @@ from typing import List, Literal, Union
|
|
3
3
|
import pydantic
|
4
4
|
|
5
5
|
from classiq.interface.chemistry.elements import ELEMENTS
|
6
|
+
from classiq.interface.exceptions import ClassiqValueError
|
6
7
|
from classiq.interface.helpers.custom_pydantic_types import AtomType
|
7
8
|
from classiq.interface.helpers.hashable_pydantic_base_model import (
|
8
9
|
HashablePydanticBaseModel,
|
9
10
|
)
|
10
11
|
|
11
|
-
from classiq.exceptions import ClassiqValueError
|
12
|
-
|
13
12
|
|
14
13
|
class Atom(HashablePydanticBaseModel):
|
15
14
|
symbol: Literal[tuple(ELEMENTS)] = pydantic.Field(description="The atom symbol") # type: ignore[valid-type]
|
@@ -1,6 +1,5 @@
|
|
1
1
|
from functools import reduce
|
2
2
|
from typing import (
|
3
|
-
TYPE_CHECKING,
|
4
3
|
Any,
|
5
4
|
Collection,
|
6
5
|
Dict,
|
@@ -16,12 +15,14 @@ import pydantic
|
|
16
15
|
import sympy
|
17
16
|
from more_itertools import all_equal
|
18
17
|
|
18
|
+
from classiq.interface.exceptions import ClassiqValueError
|
19
19
|
from classiq.interface.generator.function_params import validate_expression_str
|
20
20
|
from classiq.interface.generator.parameters import (
|
21
21
|
ParameterComplexType,
|
22
22
|
ParameterType,
|
23
23
|
PydanticParameterComplexType,
|
24
24
|
)
|
25
|
+
from classiq.interface.generator.types.builtin_enum_declarations import Pauli
|
25
26
|
from classiq.interface.helpers.custom_pydantic_types import (
|
26
27
|
PydanticPauliList,
|
27
28
|
PydanticPauliMonomial,
|
@@ -32,11 +33,6 @@ from classiq.interface.helpers.hashable_pydantic_base_model import (
|
|
32
33
|
)
|
33
34
|
from classiq.interface.helpers.versioned_model import VersionedModel
|
34
35
|
|
35
|
-
from classiq.exceptions import ClassiqValueError
|
36
|
-
|
37
|
-
if TYPE_CHECKING:
|
38
|
-
from classiq.qmod.builtins.enums import Pauli
|
39
|
-
|
40
36
|
|
41
37
|
class PauliOperator(HashablePydanticBaseModel, VersionedModel):
|
42
38
|
"""
|
@@ -482,9 +478,7 @@ def validate_operator_has_no_complex_coefficients(
|
|
482
478
|
return pauli_operator
|
483
479
|
|
484
480
|
|
485
|
-
def pauli_integers_to_str(paulis: List[
|
486
|
-
from classiq.qmod.builtins.enums import Pauli
|
487
|
-
|
481
|
+
def pauli_integers_to_str(paulis: List[Pauli]) -> str:
|
488
482
|
return "".join([Pauli(pauli).name for pauli in paulis])
|
489
483
|
|
490
484
|
|