luna-quantum 1.1.0__cp312-cp312-win_amd64.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.
- luna_quantum/__init__.py +139 -0
- luna_quantum/__init__.pyi +98 -0
- luna_quantum/_core.cp312-win_amd64.pyd +0 -0
- luna_quantum/_core.pyi +4286 -0
- luna_quantum/_utility.py +148 -0
- luna_quantum/_utility.pyi +20 -0
- luna_quantum/algorithms/__init__.py +1 -0
- luna_quantum/aqm_overwrites/__init__.py +3 -0
- luna_quantum/aqm_overwrites/model.py +184 -0
- luna_quantum/backends/__init__.py +1 -0
- luna_quantum/client/__init__.py +0 -0
- luna_quantum/client/controllers/__init__.py +4 -0
- luna_quantum/client/controllers/luna_http_client.py +37 -0
- luna_quantum/client/controllers/luna_platform_client.py +256 -0
- luna_quantum/client/controllers/luna_q.py +67 -0
- luna_quantum/client/controllers/luna_solve.py +129 -0
- luna_quantum/client/error/__init__.py +0 -0
- luna_quantum/client/error/luna_api_key_invalid_error.py +10 -0
- luna_quantum/client/error/luna_api_key_missing_error.py +10 -0
- luna_quantum/client/error/luna_error.py +2 -0
- luna_quantum/client/error/luna_server_error.py +20 -0
- luna_quantum/client/error/timeout_error.py +12 -0
- luna_quantum/client/error/transformation_error.py +18 -0
- luna_quantum/client/error/utils/__init__.py +0 -0
- luna_quantum/client/error/utils/http_error_utils.py +112 -0
- luna_quantum/client/interfaces/__init__.py +4 -0
- luna_quantum/client/interfaces/clients/__init__.py +25 -0
- luna_quantum/client/interfaces/clients/circuit_rest_client_i.py +68 -0
- luna_quantum/client/interfaces/clients/info_rest_client_i.py +53 -0
- luna_quantum/client/interfaces/clients/model_rest_client_i.py +139 -0
- luna_quantum/client/interfaces/clients/qpu_token_rest_client_i.py +364 -0
- luna_quantum/client/interfaces/clients/rest_client_i.py +21 -0
- luna_quantum/client/interfaces/clients/solve_job_rest_client_i.py +201 -0
- luna_quantum/client/interfaces/clients/users_rest_client_i.py +29 -0
- luna_quantum/client/interfaces/services/__init__.py +0 -0
- luna_quantum/client/interfaces/services/luna_q_i.py +34 -0
- luna_quantum/client/interfaces/services/luna_solve_i.py +72 -0
- luna_quantum/client/interfaces/services/service_i.py +56 -0
- luna_quantum/client/rest_client/__init__.py +15 -0
- luna_quantum/client/rest_client/circuit_rest_client.py +107 -0
- luna_quantum/client/rest_client/info_rest_client.py +74 -0
- luna_quantum/client/rest_client/model_rest_client.py +216 -0
- luna_quantum/client/rest_client/qpu_token_rest_client.py +508 -0
- luna_quantum/client/rest_client/solve_job_rest_client.py +286 -0
- luna_quantum/client/rest_client/users_rest_client.py +35 -0
- luna_quantum/client/schemas/__init__.py +26 -0
- luna_quantum/client/schemas/circuit.py +48 -0
- luna_quantum/client/schemas/create/__init__.py +15 -0
- luna_quantum/client/schemas/create/circuit.py +30 -0
- luna_quantum/client/schemas/create/optimization.py +39 -0
- luna_quantum/client/schemas/create/qpu_token.py +22 -0
- luna_quantum/client/schemas/create/qpu_token_time_quota.py +35 -0
- luna_quantum/client/schemas/create/qpu_token_time_quota_update.py +24 -0
- luna_quantum/client/schemas/create/qubo.py +19 -0
- luna_quantum/client/schemas/create/solve_job_create.py +43 -0
- luna_quantum/client/schemas/enums/__init__.py +0 -0
- luna_quantum/client/schemas/enums/call_style.py +13 -0
- luna_quantum/client/schemas/enums/circuit.py +42 -0
- luna_quantum/client/schemas/enums/model_format.py +11 -0
- luna_quantum/client/schemas/enums/problem.py +50 -0
- luna_quantum/client/schemas/enums/qpu_token_type.py +20 -0
- luna_quantum/client/schemas/enums/sense.py +8 -0
- luna_quantum/client/schemas/enums/status.py +40 -0
- luna_quantum/client/schemas/enums/timeframe.py +11 -0
- luna_quantum/client/schemas/error_message.py +14 -0
- luna_quantum/client/schemas/model_metadata.py +35 -0
- luna_quantum/client/schemas/qpu_token/__init__.py +0 -0
- luna_quantum/client/schemas/qpu_token/qpu_token.py +154 -0
- luna_quantum/client/schemas/qpu_token/qpu_token_source.py +19 -0
- luna_quantum/client/schemas/qpu_token/qpu_token_time_quota.py +30 -0
- luna_quantum/client/schemas/qpu_token/token_provider.py +132 -0
- luna_quantum/client/schemas/representation.py +19 -0
- luna_quantum/client/schemas/solution.py +106 -0
- luna_quantum/client/schemas/solve_job.py +50 -0
- luna_quantum/client/schemas/solver_info.py +11 -0
- luna_quantum/client/schemas/user.py +11 -0
- luna_quantum/client/schemas/wrappers/__init__.py +5 -0
- luna_quantum/client/schemas/wrappers/datetime_wrapper.py +32 -0
- luna_quantum/client/utils/__init__.py +0 -0
- luna_quantum/client/utils/qpu_token_utils.py +147 -0
- luna_quantum/config.py +11 -0
- luna_quantum/decorators.py +248 -0
- luna_quantum/errors.py +34 -0
- luna_quantum/errors.pyi +287 -0
- luna_quantum/exceptions/__init__.py +0 -0
- luna_quantum/exceptions/base_luna_quantum_error.py +2 -0
- luna_quantum/exceptions/luna_quantum_call_type_error.py +9 -0
- luna_quantum/exceptions/patch_class_field_exists_error.py +10 -0
- luna_quantum/factories/__init__.py +4 -0
- luna_quantum/factories/luna_solve_client_factory.py +100 -0
- luna_quantum/factories/usecase_factory.py +489 -0
- luna_quantum/py.typed +0 -0
- luna_quantum/solve/__init__.py +13 -0
- luna_quantum/solve/default_token.py +304 -0
- luna_quantum/solve/domain/__init__.py +0 -0
- luna_quantum/solve/domain/abstract/__init__.py +4 -0
- luna_quantum/solve/domain/abstract/luna_algorithm.py +205 -0
- luna_quantum/solve/domain/abstract/qpu_token_backend.py +34 -0
- luna_quantum/solve/domain/model_metadata.py +56 -0
- luna_quantum/solve/domain/solve_job.py +230 -0
- luna_quantum/solve/errors/__init__.py +0 -0
- luna_quantum/solve/errors/incompatible_backend_error.py +15 -0
- luna_quantum/solve/errors/model_metadata_missing_error.py +11 -0
- luna_quantum/solve/errors/solve_base_error.py +5 -0
- luna_quantum/solve/errors/token_missing_error.py +11 -0
- luna_quantum/solve/interfaces/__init__.py +0 -0
- luna_quantum/solve/interfaces/algorithm_i.py +49 -0
- luna_quantum/solve/interfaces/backend_i.py +28 -0
- luna_quantum/solve/interfaces/usecases/__init__.py +59 -0
- luna_quantum/solve/interfaces/usecases/model_delete_usecase_i.py +27 -0
- luna_quantum/solve/interfaces/usecases/model_fetch_metadata_usecase_i.py +33 -0
- luna_quantum/solve/interfaces/usecases/model_get_solutions_usecase_i.py +33 -0
- luna_quantum/solve/interfaces/usecases/model_get_solve_jobs_usecase_i.py +33 -0
- luna_quantum/solve/interfaces/usecases/model_load_by_id_usecase_i.py +32 -0
- luna_quantum/solve/interfaces/usecases/model_load_by_metadata_usecase_i.py +37 -0
- luna_quantum/solve/interfaces/usecases/model_load_metadata_by_hash_usecase_i.py +38 -0
- luna_quantum/solve/interfaces/usecases/model_save_usecase_i.py +36 -0
- luna_quantum/solve/interfaces/usecases/solve_job_cancel_usecase_i.py +33 -0
- luna_quantum/solve/interfaces/usecases/solve_job_create_usecase_i.py +44 -0
- luna_quantum/solve/interfaces/usecases/solve_job_delete_usecase_i.py +32 -0
- luna_quantum/solve/interfaces/usecases/solve_job_fetch_updates_usecase_i.py +38 -0
- luna_quantum/solve/interfaces/usecases/solve_job_get_by_id_usecase_i.py +27 -0
- luna_quantum/solve/interfaces/usecases/solve_job_get_result_usecase_i.py +63 -0
- luna_quantum/solve/parameters/__init__.py +0 -0
- luna_quantum/solve/parameters/algorithms/__init__.py +51 -0
- luna_quantum/solve/parameters/algorithms/base_params/__init__.py +24 -0
- luna_quantum/solve/parameters/algorithms/base_params/decomposer.py +57 -0
- luna_quantum/solve/parameters/algorithms/base_params/qaoa_circuit_params.py +95 -0
- luna_quantum/solve/parameters/algorithms/base_params/quantum_annealing_params.py +79 -0
- luna_quantum/solve/parameters/algorithms/base_params/scipy_optimizer.py +122 -0
- luna_quantum/solve/parameters/algorithms/base_params/simulated_annealing_params.py +106 -0
- luna_quantum/solve/parameters/algorithms/base_params/tabu_kerberos_params.py +39 -0
- luna_quantum/solve/parameters/algorithms/base_params/tabu_search_params.py +129 -0
- luna_quantum/solve/parameters/algorithms/flexible_parameter_algorithm.py +59 -0
- luna_quantum/solve/parameters/algorithms/genetic_algorithms/__init__.py +4 -0
- luna_quantum/solve/parameters/algorithms/genetic_algorithms/qaga.py +131 -0
- luna_quantum/solve/parameters/algorithms/genetic_algorithms/saga.py +139 -0
- luna_quantum/solve/parameters/algorithms/lq_fda/__init__.py +3 -0
- luna_quantum/solve/parameters/algorithms/lq_fda/fujits_da_base.py +85 -0
- luna_quantum/solve/parameters/algorithms/lq_fda/fujitsu_da_v3c.py +155 -0
- luna_quantum/solve/parameters/algorithms/optimization_solvers/__init__.py +3 -0
- luna_quantum/solve/parameters/algorithms/optimization_solvers/scip.py +51 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/__init__.py +19 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/kerberos.py +149 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/leap_hybrid_bqm.py +75 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/leap_hybrid_cqm.py +75 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/parallel_tempering_qpu.py +139 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/population_annealing_qpu.py +109 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/qbsolv_like_qpu.py +111 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/quantum_annealing.py +121 -0
- luna_quantum/solve/parameters/algorithms/quantum_annealing/repeated_reverse_quantum_annealing.py +174 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/__init__.py +6 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flex_qaoa/__init__.py +10 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/__init__.py +29 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/config.py +58 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/flexqaoa.py +188 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/optimizers.py +53 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/flexqaoa/pipeline.py +164 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/qaoa.py +112 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/qaoa_fo.py +69 -0
- luna_quantum/solve/parameters/algorithms/quantum_gate/vqe.py +108 -0
- luna_quantum/solve/parameters/algorithms/search_algorithms/__init__.py +5 -0
- luna_quantum/solve/parameters/algorithms/search_algorithms/dialectic_search.py +136 -0
- luna_quantum/solve/parameters/algorithms/search_algorithms/qbsolv_like_tabu_search.py +117 -0
- luna_quantum/solve/parameters/algorithms/search_algorithms/tabu_search.py +126 -0
- luna_quantum/solve/parameters/algorithms/simulated_annealing/__init__.py +13 -0
- luna_quantum/solve/parameters/algorithms/simulated_annealing/parallel_tempering.py +131 -0
- luna_quantum/solve/parameters/algorithms/simulated_annealing/population_annealing.py +95 -0
- luna_quantum/solve/parameters/algorithms/simulated_annealing/qbsolv_like_simulated_annealing.py +141 -0
- luna_quantum/solve/parameters/algorithms/simulated_annealing/repeated_reverse_simulated_annealing.py +172 -0
- luna_quantum/solve/parameters/algorithms/simulated_annealing/simulated_annealing.py +126 -0
- luna_quantum/solve/parameters/backends/__init__.py +27 -0
- luna_quantum/solve/parameters/backends/aqarios.py +17 -0
- luna_quantum/solve/parameters/backends/aqarios_gpu.py +17 -0
- luna_quantum/solve/parameters/backends/aws/__init__.py +11 -0
- luna_quantum/solve/parameters/backends/aws/aws.py +36 -0
- luna_quantum/solve/parameters/backends/aws/aws_backend_base.py +74 -0
- luna_quantum/solve/parameters/backends/aws/ionq.py +43 -0
- luna_quantum/solve/parameters/backends/aws/iqm.py +31 -0
- luna_quantum/solve/parameters/backends/aws/rigetti.py +31 -0
- luna_quantum/solve/parameters/backends/cudaq/__init__.py +5 -0
- luna_quantum/solve/parameters/backends/cudaq/cudaq_base.py +16 -0
- luna_quantum/solve/parameters/backends/cudaq/cudaq_cpu.py +30 -0
- luna_quantum/solve/parameters/backends/cudaq/cudaq_gpu.py +32 -0
- luna_quantum/solve/parameters/backends/dwave.py +17 -0
- luna_quantum/solve/parameters/backends/dwave_qpu.py +166 -0
- luna_quantum/solve/parameters/backends/fda.py +17 -0
- luna_quantum/solve/parameters/backends/ibm.py +138 -0
- luna_quantum/solve/parameters/backends/qctrl.py +103 -0
- luna_quantum/solve/parameters/backends/zib.py +17 -0
- luna_quantum/solve/parameters/constants.py +11 -0
- luna_quantum/solve/parameters/errors.py +30 -0
- luna_quantum/solve/parameters/mixins/__init__.py +0 -0
- luna_quantum/solve/parameters/mixins/fujitsu_common_params_mixin.py +239 -0
- luna_quantum/solve/parameters/mixins/fujitsu_v2_mixin.py +70 -0
- luna_quantum/solve/parameters/mixins/qbsolv_like_mixin.py +60 -0
- luna_quantum/solve/use_cases/__init__.py +119 -0
- luna_quantum/solve/use_cases/arbitrage_edge_based.py +50 -0
- luna_quantum/solve/use_cases/arbitrage_node_based.py +55 -0
- luna_quantum/solve/use_cases/base.py +7 -0
- luna_quantum/solve/use_cases/binary_integer_linear_programming.py +54 -0
- luna_quantum/solve/use_cases/binary_paint_shop_problem.py +37 -0
- luna_quantum/solve/use_cases/credit_scoring_feature_selection.py +40 -0
- luna_quantum/solve/use_cases/dynamic_portfolio_optimization.py +64 -0
- luna_quantum/solve/use_cases/exact_cover.py +51 -0
- luna_quantum/solve/use_cases/flight_gate_assignment.py +79 -0
- luna_quantum/solve/use_cases/graph_coloring.py +42 -0
- luna_quantum/solve/use_cases/graph_isomorphism.py +52 -0
- luna_quantum/solve/use_cases/graph_partitioning.py +46 -0
- luna_quantum/solve/use_cases/hamiltonian_cycle.py +49 -0
- luna_quantum/solve/use_cases/induced_subgraph_isomorphism.py +50 -0
- luna_quantum/solve/use_cases/job_shop_scheduling.py +44 -0
- luna_quantum/solve/use_cases/k_medoids_clustering.py +49 -0
- luna_quantum/solve/use_cases/knapsack_integer_weights.py +56 -0
- luna_quantum/solve/use_cases/linear_regression.py +60 -0
- luna_quantum/solve/use_cases/lmwcs.py +84 -0
- luna_quantum/solve/use_cases/longest_path.py +50 -0
- luna_quantum/solve/use_cases/market_graph_clustering.py +61 -0
- luna_quantum/solve/use_cases/max2sat.py +54 -0
- luna_quantum/solve/use_cases/max3sat.py +55 -0
- luna_quantum/solve/use_cases/max_clique.py +60 -0
- luna_quantum/solve/use_cases/max_cut.py +48 -0
- luna_quantum/solve/use_cases/max_independent_set.py +37 -0
- luna_quantum/solve/use_cases/minimal_maximal_matching.py +54 -0
- luna_quantum/solve/use_cases/minimal_spanning_tree.py +90 -0
- luna_quantum/solve/use_cases/minimum_vertex_cover.py +45 -0
- luna_quantum/solve/use_cases/number_partitioning.py +32 -0
- luna_quantum/solve/use_cases/portfolio_optimization.py +46 -0
- luna_quantum/solve/use_cases/portfolio_optimization_ib_tv.py +63 -0
- luna_quantum/solve/use_cases/quadratic_assignment.py +49 -0
- luna_quantum/solve/use_cases/quadratic_knapsack.py +48 -0
- luna_quantum/solve/use_cases/satellite_scheduling.py +73 -0
- luna_quantum/solve/use_cases/sensor_placement.py +58 -0
- luna_quantum/solve/use_cases/set_cover.py +56 -0
- luna_quantum/solve/use_cases/set_packing.py +54 -0
- luna_quantum/solve/use_cases/set_partitioning.py +52 -0
- luna_quantum/solve/use_cases/subgraph_isomorphism.py +55 -0
- luna_quantum/solve/use_cases/subset_sum.py +37 -0
- luna_quantum/solve/use_cases/support_vector_machine.py +64 -0
- luna_quantum/solve/use_cases/traffic_flow.py +35 -0
- luna_quantum/solve/use_cases/travelling_salesman_problem.py +53 -0
- luna_quantum/solve/use_cases/type_aliases.py +9 -0
- luna_quantum/solve/use_cases/weighted_max_cut.py +37 -0
- luna_quantum/solve/usecases/__init__.py +45 -0
- luna_quantum/solve/usecases/model_delete_usecase.py +49 -0
- luna_quantum/solve/usecases/model_fetch_metadata_usecase.py +50 -0
- luna_quantum/solve/usecases/model_get_solution_usecase.py +59 -0
- luna_quantum/solve/usecases/model_get_solve_jobs_usecase.py +62 -0
- luna_quantum/solve/usecases/model_load_by_id_usecase.py +47 -0
- luna_quantum/solve/usecases/model_load_by_metadata_usecase.py +52 -0
- luna_quantum/solve/usecases/model_load_metadata_by_hash_usecase.py +51 -0
- luna_quantum/solve/usecases/model_save_usecase.py +63 -0
- luna_quantum/solve/usecases/solve_job_cancel_usecase.py +51 -0
- luna_quantum/solve/usecases/solve_job_create_usecase.py +112 -0
- luna_quantum/solve/usecases/solve_job_delete_usecase.py +38 -0
- luna_quantum/solve/usecases/solve_job_fetch_updates_usecase.py +49 -0
- luna_quantum/solve/usecases/solve_job_get_by_id_usecase.py +44 -0
- luna_quantum/solve/usecases/solve_job_get_result_usecase.py +105 -0
- luna_quantum/transformations.py +18 -0
- luna_quantum/transformations.pyi +371 -0
- luna_quantum/translator.py +23 -0
- luna_quantum/translator.pyi +869 -0
- luna_quantum/util/__init__.py +0 -0
- luna_quantum/util/active_waiting.py +79 -0
- luna_quantum/util/class_patcher.py +164 -0
- luna_quantum/util/debug_info.py +52 -0
- luna_quantum/util/log_utils.py +187 -0
- luna_quantum/util/pretty_base.py +67 -0
- luna_quantum/util/pydantic_utils.py +38 -0
- luna_quantum/utils.py +3 -0
- luna_quantum/utils.pyi +67 -0
- luna_quantum-1.1.0.dist-info/METADATA +36 -0
- luna_quantum-1.1.0.dist-info/RECORD +276 -0
- luna_quantum-1.1.0.dist-info/WHEEL +4 -0
- luna_quantum-1.1.0.dist-info/licenses/LICENSE +176 -0
- luna_quantum-1.1.0.dist-info/licenses/NOTICE +13 -0
|
@@ -0,0 +1,364 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import TYPE_CHECKING, Any
|
|
5
|
+
|
|
6
|
+
from luna_quantum.client.interfaces.clients.rest_client_i import IRestClient
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from datetime import datetime
|
|
10
|
+
|
|
11
|
+
from luna_quantum.client.schemas import QpuTokenOut
|
|
12
|
+
from luna_quantum.client.schemas.enums.qpu_token_type import QpuTokenTypeEnum
|
|
13
|
+
from luna_quantum.client.schemas.qpu_token.qpu_token_time_quota import (
|
|
14
|
+
QpuTokenTimeQuotaOut,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class IQpuTokenRestClient(IRestClient, ABC):
|
|
19
|
+
"""Inteface of a solve job REST client."""
|
|
20
|
+
|
|
21
|
+
@abstractmethod
|
|
22
|
+
def create(
|
|
23
|
+
self,
|
|
24
|
+
name: str,
|
|
25
|
+
provider: str,
|
|
26
|
+
token: str,
|
|
27
|
+
token_type: QpuTokenTypeEnum,
|
|
28
|
+
**kwargs: dict[str, Any],
|
|
29
|
+
) -> QpuTokenOut:
|
|
30
|
+
"""
|
|
31
|
+
Create QPU token.
|
|
32
|
+
|
|
33
|
+
Parameters
|
|
34
|
+
----------
|
|
35
|
+
name: str
|
|
36
|
+
Name of the QPU token
|
|
37
|
+
provider: str
|
|
38
|
+
Name of provider
|
|
39
|
+
token: str
|
|
40
|
+
Token
|
|
41
|
+
token_type: QpuTokenTypeEnum
|
|
42
|
+
There are two types of QPU tokens: PERSONAL and GROUP.
|
|
43
|
+
All users of a group can use group QPU tokens.
|
|
44
|
+
User QPU tokens can only be used by the user who created them.
|
|
45
|
+
**kwargs
|
|
46
|
+
Parameters to pass to `httpx.request`.
|
|
47
|
+
|
|
48
|
+
Returns
|
|
49
|
+
-------
|
|
50
|
+
QpuTokenOut
|
|
51
|
+
QpuToken instances.
|
|
52
|
+
"""
|
|
53
|
+
raise NotImplementedError
|
|
54
|
+
|
|
55
|
+
@abstractmethod
|
|
56
|
+
def get_all(
|
|
57
|
+
self,
|
|
58
|
+
filter_provider: str | None = None,
|
|
59
|
+
token_type: QpuTokenTypeEnum | None = None,
|
|
60
|
+
limit: int | None = None,
|
|
61
|
+
offset: int | None = None,
|
|
62
|
+
**kwargs: dict[str, Any],
|
|
63
|
+
) -> dict[QpuTokenTypeEnum, list[QpuTokenOut]]:
|
|
64
|
+
"""
|
|
65
|
+
Retrieve a list of QPU tokens.
|
|
66
|
+
|
|
67
|
+
Parameters
|
|
68
|
+
----------
|
|
69
|
+
filter_provider: Optional[str]
|
|
70
|
+
The provider for which qpu tokens should be retrieved
|
|
71
|
+
token_type: Optional[QpuTokenTypeEnum]
|
|
72
|
+
If you want to retrieve only user or group QPU tokens
|
|
73
|
+
otherwise all QPU tokens will be retrieved
|
|
74
|
+
limit: Optional[int]
|
|
75
|
+
Number of items to fetch. Default is 10.
|
|
76
|
+
offset: Optional[int]
|
|
77
|
+
Optional. Number of items to skip. Default is 0.
|
|
78
|
+
**kwargs
|
|
79
|
+
Parameters to pass to `httpx.request`.
|
|
80
|
+
|
|
81
|
+
Returns
|
|
82
|
+
-------
|
|
83
|
+
Dict[QpuTokenTypeEnum, List[QpuTokenOut]]
|
|
84
|
+
List of QpuTokenOut instances.
|
|
85
|
+
"""
|
|
86
|
+
raise NotImplementedError
|
|
87
|
+
|
|
88
|
+
@abstractmethod
|
|
89
|
+
def get(
|
|
90
|
+
self, name: str, token_type: QpuTokenTypeEnum, **kwargs: dict[str, Any]
|
|
91
|
+
) -> QpuTokenOut:
|
|
92
|
+
"""
|
|
93
|
+
Retrieve user QPU token by id.
|
|
94
|
+
|
|
95
|
+
Parameters
|
|
96
|
+
----------
|
|
97
|
+
name: str
|
|
98
|
+
Name of the QPU token that should be retrieved
|
|
99
|
+
token_type: QpuTokenTypeEnum
|
|
100
|
+
There are two types of QPU tokens: PERSONAL and GROUP.
|
|
101
|
+
All users of a group can use group QPU tokens.
|
|
102
|
+
User QPU tokens can only be used by the user who created them.
|
|
103
|
+
**kwargs
|
|
104
|
+
Parameters to pass to `httpx.request`.
|
|
105
|
+
|
|
106
|
+
Returns
|
|
107
|
+
-------
|
|
108
|
+
QpuTokenOut
|
|
109
|
+
QpuToken instance.
|
|
110
|
+
"""
|
|
111
|
+
raise NotImplementedError
|
|
112
|
+
|
|
113
|
+
@abstractmethod
|
|
114
|
+
def rename(
|
|
115
|
+
self,
|
|
116
|
+
name: str,
|
|
117
|
+
new_name: str,
|
|
118
|
+
token_type: QpuTokenTypeEnum,
|
|
119
|
+
**kwargs: dict[str, Any],
|
|
120
|
+
) -> QpuTokenOut:
|
|
121
|
+
"""
|
|
122
|
+
Update QPU token by id.
|
|
123
|
+
|
|
124
|
+
Parameters
|
|
125
|
+
----------
|
|
126
|
+
name: str
|
|
127
|
+
Current name of the QPU token that should be updated
|
|
128
|
+
new_name: str
|
|
129
|
+
The new name
|
|
130
|
+
token_type: QpuTokenTypeEnum
|
|
131
|
+
There are two types of QPU tokens: PERSONAL and GROUP.
|
|
132
|
+
All users of a group can use group QPU tokens.
|
|
133
|
+
User QPU tokens can only be used by the user who created them.
|
|
134
|
+
**kwargs
|
|
135
|
+
Parameters to pass to `httpx.request`.
|
|
136
|
+
|
|
137
|
+
Returns
|
|
138
|
+
-------
|
|
139
|
+
QpuTokenOut
|
|
140
|
+
QpuToken instance.
|
|
141
|
+
"""
|
|
142
|
+
raise NotImplementedError
|
|
143
|
+
|
|
144
|
+
@abstractmethod
|
|
145
|
+
def delete(
|
|
146
|
+
self, name: str, token_type: QpuTokenTypeEnum, **kwargs: dict[str, Any]
|
|
147
|
+
) -> None:
|
|
148
|
+
"""
|
|
149
|
+
Delete QPU token by name.
|
|
150
|
+
|
|
151
|
+
Parameters
|
|
152
|
+
----------
|
|
153
|
+
name: str
|
|
154
|
+
Name of the QPU token that should be deleted
|
|
155
|
+
token_type: QpuTokenTypeEnum
|
|
156
|
+
There are two types of QPU tokens: PERSONAL and GROUP.
|
|
157
|
+
All users of a group can use organization QPU tokens.
|
|
158
|
+
User QPU tokens can only be used by the user who created them.
|
|
159
|
+
**kwargs
|
|
160
|
+
Parameters to pass to `httpx.request`.
|
|
161
|
+
"""
|
|
162
|
+
raise NotImplementedError
|
|
163
|
+
|
|
164
|
+
@abstractmethod
|
|
165
|
+
def create_group_time_quota(
|
|
166
|
+
self,
|
|
167
|
+
qpu_token_name: str,
|
|
168
|
+
quota: int,
|
|
169
|
+
start: datetime | None = None,
|
|
170
|
+
end: datetime | None = None,
|
|
171
|
+
**kwargs: dict[str, Any],
|
|
172
|
+
) -> None:
|
|
173
|
+
"""Create a time quota policy for a shared QPU token.
|
|
174
|
+
|
|
175
|
+
This affects every user of the group.
|
|
176
|
+
|
|
177
|
+
Parameters
|
|
178
|
+
----------
|
|
179
|
+
qpu_token_name : str
|
|
180
|
+
The name of the qpu token. Currently, only DWave tokens are supported.
|
|
181
|
+
quota : int
|
|
182
|
+
quota : int
|
|
183
|
+
The amount of quota to add. For DWave Quantum Annealing, which is currently
|
|
184
|
+
the only algorithm that supports time quota, this is the qpu access time in
|
|
185
|
+
nanoseconds.
|
|
186
|
+
start : Optional[datetime], optional
|
|
187
|
+
The date and time from which the policy is active. If None, the current date
|
|
188
|
+
and time will be used. If the policy is currently not effective, the token
|
|
189
|
+
cannot be used at all.
|
|
190
|
+
Default: None
|
|
191
|
+
end : Optional[datetime], optional
|
|
192
|
+
The date and time until which the policy is active. If None, the policy if
|
|
193
|
+
effective until 265 days after the start date. If the policy is currently
|
|
194
|
+
not effective, the token cannot be used at all.
|
|
195
|
+
Default: None
|
|
196
|
+
"""
|
|
197
|
+
raise NotImplementedError
|
|
198
|
+
|
|
199
|
+
@abstractmethod
|
|
200
|
+
def get_group_time_quota(
|
|
201
|
+
self, qpu_token_name: str, **kwargs: dict[str, Any]
|
|
202
|
+
) -> QpuTokenTimeQuotaOut | None:
|
|
203
|
+
"""Get the group time quota policy for a qpu token.
|
|
204
|
+
|
|
205
|
+
Parameters
|
|
206
|
+
----------
|
|
207
|
+
qpu_token_name : str
|
|
208
|
+
The name of the qpu token.
|
|
209
|
+
|
|
210
|
+
Returns
|
|
211
|
+
-------
|
|
212
|
+
Optional[QpuTokenTimeQuotaOut]
|
|
213
|
+
The token policy. None, if no group policy is set on this token.
|
|
214
|
+
"""
|
|
215
|
+
raise NotImplementedError
|
|
216
|
+
|
|
217
|
+
@abstractmethod
|
|
218
|
+
def update_group_time_quota(
|
|
219
|
+
self,
|
|
220
|
+
qpu_token_name: str,
|
|
221
|
+
quota: int | None = None,
|
|
222
|
+
start: datetime | None = None,
|
|
223
|
+
end: datetime | None = None,
|
|
224
|
+
**kwargs: dict[str, Any],
|
|
225
|
+
) -> None:
|
|
226
|
+
"""Update the details on a group qpu time quota policy.
|
|
227
|
+
|
|
228
|
+
Parameters
|
|
229
|
+
----------
|
|
230
|
+
qpu_token_name : str
|
|
231
|
+
The name of the qpu token.
|
|
232
|
+
quota : Optional[int], optional
|
|
233
|
+
The amount of quota. For DWave Quantum Annealing, which is currently the
|
|
234
|
+
only supported solver, this is the qpu access time in nanoseconds. If None,
|
|
235
|
+
the available quota won't be updated.
|
|
236
|
+
Default: None
|
|
237
|
+
start : Optional[datetime], optional
|
|
238
|
+
The date and time from which the policy is active. If None, the start date
|
|
239
|
+
won't be updated.
|
|
240
|
+
Default: None
|
|
241
|
+
end : Optional[datetime], optional
|
|
242
|
+
The date and time until which the policy is active. If None, the end date
|
|
243
|
+
won't be updated.
|
|
244
|
+
Default: None
|
|
245
|
+
"""
|
|
246
|
+
raise NotImplementedError
|
|
247
|
+
|
|
248
|
+
@abstractmethod
|
|
249
|
+
def delete_group_time_quota(
|
|
250
|
+
self, qpu_token_name: str, **kwargs: dict[str, Any]
|
|
251
|
+
) -> None:
|
|
252
|
+
"""Delete the group policy set on a qpu token.
|
|
253
|
+
|
|
254
|
+
Parameters
|
|
255
|
+
----------
|
|
256
|
+
qpu_token_name : str
|
|
257
|
+
The name of the qpu token.
|
|
258
|
+
"""
|
|
259
|
+
raise NotImplementedError
|
|
260
|
+
|
|
261
|
+
@abstractmethod
|
|
262
|
+
def create_user_time_quota(
|
|
263
|
+
self,
|
|
264
|
+
qpu_token_name: str,
|
|
265
|
+
user_email: str,
|
|
266
|
+
quota: int,
|
|
267
|
+
start: datetime | None = None,
|
|
268
|
+
end: datetime | None = None,
|
|
269
|
+
**kwargs: dict[str, Any],
|
|
270
|
+
) -> None:
|
|
271
|
+
"""Create a time quota policy for a shared QPU token.
|
|
272
|
+
|
|
273
|
+
This affects a single user of the group.
|
|
274
|
+
|
|
275
|
+
Parameters
|
|
276
|
+
----------
|
|
277
|
+
qpu_token_name : str
|
|
278
|
+
The name of the qpu token. Currently, only DWave tokens are supported.
|
|
279
|
+
user_email : str
|
|
280
|
+
Email of the user for whom to add the policy.
|
|
281
|
+
quota : int
|
|
282
|
+
The amount of quota to add. For DWave Quantum Annealing, which is currently
|
|
283
|
+
the only algorithm that supports time quota, this is the qpu access time in
|
|
284
|
+
nanoseconds.
|
|
285
|
+
start : Optional[datetime], optional
|
|
286
|
+
The date and time from which the policy is active. If None, the current date
|
|
287
|
+
and time will be used. If the policy is currently not effective, the token
|
|
288
|
+
cannot be used at all.
|
|
289
|
+
Default: None
|
|
290
|
+
end : Optional[datetime], optional
|
|
291
|
+
The date and time until which the policy is active. If None, the policy if
|
|
292
|
+
effective until 265 days after the start date. If the policy is currently
|
|
293
|
+
not effective, the token cannot be used at all.
|
|
294
|
+
Default: None
|
|
295
|
+
"""
|
|
296
|
+
raise NotImplementedError
|
|
297
|
+
|
|
298
|
+
@abstractmethod
|
|
299
|
+
def get_user_time_quota(
|
|
300
|
+
self, qpu_token_name: str, user_email: str, **kwargs: dict[str, Any]
|
|
301
|
+
) -> QpuTokenTimeQuotaOut | None:
|
|
302
|
+
"""Get a user-specific time quota policy for a qpu token.
|
|
303
|
+
|
|
304
|
+
Parameters
|
|
305
|
+
----------
|
|
306
|
+
qpu_token_name : str
|
|
307
|
+
The name of the qpu token.
|
|
308
|
+
user_email : str
|
|
309
|
+
Email of the user for whom to get the policy.
|
|
310
|
+
|
|
311
|
+
Returns
|
|
312
|
+
-------
|
|
313
|
+
Optional[QpuTokenTimeQuotaOut]
|
|
314
|
+
The token policy. None, if no policy is set on this token for the specified
|
|
315
|
+
user.
|
|
316
|
+
"""
|
|
317
|
+
raise NotImplementedError
|
|
318
|
+
|
|
319
|
+
@abstractmethod
|
|
320
|
+
def update_user_time_quota(
|
|
321
|
+
self,
|
|
322
|
+
qpu_token_name: str,
|
|
323
|
+
user_email: str,
|
|
324
|
+
quota: int | None = None,
|
|
325
|
+
start: datetime | None = None,
|
|
326
|
+
end: datetime | None = None,
|
|
327
|
+
**kwargs: dict[str, Any],
|
|
328
|
+
) -> None:
|
|
329
|
+
"""Update the details on a user-specific qpu time quota policy.
|
|
330
|
+
|
|
331
|
+
Parameters
|
|
332
|
+
----------
|
|
333
|
+
qpu_token_name : str
|
|
334
|
+
The name of the qpu token.
|
|
335
|
+
user_email : str
|
|
336
|
+
Email of the user for whom to update the policy.
|
|
337
|
+
quota : Optional[int], optional
|
|
338
|
+
The amount of quota. For DWave Quantum Annealing, which is currently the
|
|
339
|
+
only supported solver, this is the qpu access time in nanoseconds. If None,
|
|
340
|
+
the available quota won't be updated.
|
|
341
|
+
Default: None
|
|
342
|
+
start : Optional[datetime], optional
|
|
343
|
+
The date and time from which the policy is active. If None, the start date
|
|
344
|
+
won't be updated.
|
|
345
|
+
Default: None
|
|
346
|
+
end : Optional[datetime], optional
|
|
347
|
+
The date and time until which the policy is active. If None, the end date
|
|
348
|
+
won't be updated.
|
|
349
|
+
Default: None
|
|
350
|
+
"""
|
|
351
|
+
raise NotImplementedError
|
|
352
|
+
|
|
353
|
+
@abstractmethod
|
|
354
|
+
def delete_user_time_quota(
|
|
355
|
+
self, qpu_token_name: str, user_email: str, **kwargs: dict[str, Any]
|
|
356
|
+
) -> None:
|
|
357
|
+
"""Delete a user-specific policy set on a qpu token.
|
|
358
|
+
|
|
359
|
+
Parameters
|
|
360
|
+
----------
|
|
361
|
+
qpu_token_name : str
|
|
362
|
+
The name of the qpu token.
|
|
363
|
+
"""
|
|
364
|
+
raise NotImplementedError
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
|
|
3
|
+
from httpx import Client
|
|
4
|
+
|
|
5
|
+
from luna_quantum.client.interfaces.services.service_i import IService
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class IRestClient(ABC):
|
|
9
|
+
"""Inteface for rest client."""
|
|
10
|
+
|
|
11
|
+
_lc_client: IService
|
|
12
|
+
_client: Client
|
|
13
|
+
|
|
14
|
+
def __init__(self, service: IService) -> None:
|
|
15
|
+
self._lc_client = service
|
|
16
|
+
self._client = service.client
|
|
17
|
+
|
|
18
|
+
@property
|
|
19
|
+
@abstractmethod
|
|
20
|
+
def _endpoint(self) -> str:
|
|
21
|
+
raise NotImplementedError
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import TYPE_CHECKING, Any
|
|
5
|
+
|
|
6
|
+
from luna_quantum.client.interfaces.clients.rest_client_i import IRestClient
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from pydantic import BaseModel
|
|
10
|
+
|
|
11
|
+
from luna_quantum import Solution
|
|
12
|
+
from luna_quantum.client.schemas.enums.timeframe import TimeframeEnum
|
|
13
|
+
from luna_quantum.client.schemas.qpu_token.qpu_token import TokenProvider
|
|
14
|
+
from luna_quantum.client.schemas.solution import (
|
|
15
|
+
UseCaseRepresentation,
|
|
16
|
+
UseCaseResult,
|
|
17
|
+
)
|
|
18
|
+
from luna_quantum.client.schemas.solve_job import SolveJobSchema
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
class ISolveJobRestClient(IRestClient, ABC):
|
|
22
|
+
"""Interface for a solve job REST client."""
|
|
23
|
+
|
|
24
|
+
@abstractmethod
|
|
25
|
+
def get_all(
|
|
26
|
+
self,
|
|
27
|
+
timeframe: TimeframeEnum | None = None,
|
|
28
|
+
limit: int = 50,
|
|
29
|
+
offset: int = 0,
|
|
30
|
+
model_id: str | None = None,
|
|
31
|
+
**kwargs: Any,
|
|
32
|
+
) -> list[SolveJobSchema]:
|
|
33
|
+
"""
|
|
34
|
+
Get list of available SolveJobs.
|
|
35
|
+
|
|
36
|
+
Parameters
|
|
37
|
+
----------
|
|
38
|
+
timeframe: Optional[TimeframeEnum]
|
|
39
|
+
Only return SolveJobs created within a specified timeframe. Default None.
|
|
40
|
+
limit:
|
|
41
|
+
Limit the number of SolveJobs to be returned. Default value 10.
|
|
42
|
+
offset:
|
|
43
|
+
Offset the list of solve job by this amount. Default value 0.
|
|
44
|
+
model_id: Optional[str]
|
|
45
|
+
Show solve job for only this model id. Default None.
|
|
46
|
+
**kwargs
|
|
47
|
+
Parameters to pass to `httpx.request`.
|
|
48
|
+
|
|
49
|
+
Returns
|
|
50
|
+
-------
|
|
51
|
+
List[SolveJobSchema]
|
|
52
|
+
List of SolveJob instances.
|
|
53
|
+
"""
|
|
54
|
+
|
|
55
|
+
@abstractmethod
|
|
56
|
+
def get(self, solve_job_id: str, **kwargs: Any) -> SolveJobSchema:
|
|
57
|
+
"""
|
|
58
|
+
Retrieve one SolveJob by id.
|
|
59
|
+
|
|
60
|
+
Parameters
|
|
61
|
+
----------
|
|
62
|
+
solve_job_id: str
|
|
63
|
+
Id of the solve job that should be retrieved.
|
|
64
|
+
**kwargs
|
|
65
|
+
Parameters to pass to `httpx.request`.
|
|
66
|
+
|
|
67
|
+
Returns
|
|
68
|
+
-------
|
|
69
|
+
SolveJobSchema
|
|
70
|
+
Instance of SolveJob.
|
|
71
|
+
"""
|
|
72
|
+
|
|
73
|
+
@abstractmethod
|
|
74
|
+
def get_solution(self, solve_job_id: str, **kwargs: Any) -> Solution:
|
|
75
|
+
"""
|
|
76
|
+
Retrieve one solution by id.
|
|
77
|
+
|
|
78
|
+
Parameters
|
|
79
|
+
----------
|
|
80
|
+
solve_job_id: str
|
|
81
|
+
Id of the solve job for which a solution should be retrieved.
|
|
82
|
+
**kwargs
|
|
83
|
+
Parameters to pass to `httpx.request`.
|
|
84
|
+
|
|
85
|
+
Returns
|
|
86
|
+
-------
|
|
87
|
+
Solution
|
|
88
|
+
Solution instance
|
|
89
|
+
"""
|
|
90
|
+
|
|
91
|
+
@abstractmethod
|
|
92
|
+
def get_use_case_representation(
|
|
93
|
+
self, solve_job_id: str, **kwargs: Any
|
|
94
|
+
) -> UseCaseRepresentation:
|
|
95
|
+
"""
|
|
96
|
+
Get the use-case-specific representation of a solution.
|
|
97
|
+
|
|
98
|
+
Parameters
|
|
99
|
+
----------
|
|
100
|
+
solve_job_id: str
|
|
101
|
+
Id of the solve job that should be retrieved.
|
|
102
|
+
**kwargs
|
|
103
|
+
Parameters to pass to `httpx.request`.
|
|
104
|
+
|
|
105
|
+
Returns
|
|
106
|
+
-------
|
|
107
|
+
UseCaseRepresentation
|
|
108
|
+
The use-case-specific representation
|
|
109
|
+
"""
|
|
110
|
+
|
|
111
|
+
@abstractmethod
|
|
112
|
+
def delete(self, solve_job_id: str, **kwargs: Any) -> None:
|
|
113
|
+
"""
|
|
114
|
+
Delete one solution by id.
|
|
115
|
+
|
|
116
|
+
Parameters
|
|
117
|
+
----------
|
|
118
|
+
solve_job_id: str
|
|
119
|
+
Id of the solve job that should be deleted.
|
|
120
|
+
**kwargs
|
|
121
|
+
Parameters to pass to `httpx.request`.
|
|
122
|
+
"""
|
|
123
|
+
|
|
124
|
+
@abstractmethod
|
|
125
|
+
def create( # noqa: PLR0913
|
|
126
|
+
self,
|
|
127
|
+
model_id: str,
|
|
128
|
+
solver_name: str,
|
|
129
|
+
provider: str,
|
|
130
|
+
qpu_tokens: TokenProvider | None = None,
|
|
131
|
+
solver_parameters: dict[str, Any] | BaseModel | None = None,
|
|
132
|
+
name: str | None = None,
|
|
133
|
+
**kwargs: Any,
|
|
134
|
+
) -> SolveJobSchema:
|
|
135
|
+
"""
|
|
136
|
+
Create a solution for a model.
|
|
137
|
+
|
|
138
|
+
Parameters
|
|
139
|
+
----------
|
|
140
|
+
model_id: str
|
|
141
|
+
The id of the model for which solution should be created.
|
|
142
|
+
solver_name: str
|
|
143
|
+
The name of the solver to use.
|
|
144
|
+
provider: str
|
|
145
|
+
The name of the provider to use.
|
|
146
|
+
qpu_tokens: Optional[TokenProvider]
|
|
147
|
+
The tokens to be used for the QPU.
|
|
148
|
+
solver_parameters: Optional[Union[Dict[str, Any], BaseModel]]
|
|
149
|
+
Parameters to be passed to the solver.
|
|
150
|
+
name: Optional[str]
|
|
151
|
+
Default: None, The name of the solution to create.
|
|
152
|
+
**kwargs
|
|
153
|
+
Parameters to pass to `httpx.request`.
|
|
154
|
+
|
|
155
|
+
Returns
|
|
156
|
+
-------
|
|
157
|
+
SolveJobSchema
|
|
158
|
+
The created solve job, which can be used to retrieve the solution later.
|
|
159
|
+
"""
|
|
160
|
+
|
|
161
|
+
@abstractmethod
|
|
162
|
+
def get_best_use_case_result(
|
|
163
|
+
self, use_case_representation: UseCaseRepresentation
|
|
164
|
+
) -> UseCaseResult | None:
|
|
165
|
+
"""
|
|
166
|
+
Retrieve the best result from a solution's use case representation.
|
|
167
|
+
|
|
168
|
+
Parameters
|
|
169
|
+
----------
|
|
170
|
+
use_case_representation : UseCaseRepresentation
|
|
171
|
+
A solution's use case representation.
|
|
172
|
+
|
|
173
|
+
Returns
|
|
174
|
+
-------
|
|
175
|
+
Optional[UseCaseResult]
|
|
176
|
+
The best result of the solution. If there are several best solve job with
|
|
177
|
+
the same objective value, return only the first. If the solution results are
|
|
178
|
+
not (yet) available or the solution sense is `None`, `None` is returned.
|
|
179
|
+
"""
|
|
180
|
+
|
|
181
|
+
@abstractmethod
|
|
182
|
+
def cancel(
|
|
183
|
+
self,
|
|
184
|
+
solve_job_id: str,
|
|
185
|
+
**kwargs: Any,
|
|
186
|
+
) -> SolveJobSchema:
|
|
187
|
+
"""
|
|
188
|
+
Cancel a solve job for an id.
|
|
189
|
+
|
|
190
|
+
Parameters
|
|
191
|
+
----------
|
|
192
|
+
solve_job_id: str
|
|
193
|
+
The id of the solve job which should be canceled.
|
|
194
|
+
**kwargs
|
|
195
|
+
Parameters to pass to `httpx.request`.
|
|
196
|
+
|
|
197
|
+
Returns
|
|
198
|
+
-------
|
|
199
|
+
SolveJobSchema
|
|
200
|
+
The updated solve job, which can be used to retrieve the solution later.
|
|
201
|
+
"""
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from abc import ABC, abstractmethod
|
|
4
|
+
from typing import TYPE_CHECKING, Any
|
|
5
|
+
|
|
6
|
+
from luna_quantum.client.interfaces.clients.rest_client_i import IRestClient
|
|
7
|
+
|
|
8
|
+
if TYPE_CHECKING:
|
|
9
|
+
from luna_quantum.client.schemas.user import User
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
class IUsersRestClient(IRestClient, ABC):
|
|
13
|
+
"""Inteface for user rest client."""
|
|
14
|
+
|
|
15
|
+
@abstractmethod
|
|
16
|
+
def get_me(self, **kwargs: dict[str, Any]) -> User:
|
|
17
|
+
"""
|
|
18
|
+
Retrieve information about user.
|
|
19
|
+
|
|
20
|
+
Parameters
|
|
21
|
+
----------
|
|
22
|
+
**kwargs
|
|
23
|
+
Parameters to pass to `httpx.request`.
|
|
24
|
+
|
|
25
|
+
Returns
|
|
26
|
+
-------
|
|
27
|
+
User:
|
|
28
|
+
User data.
|
|
29
|
+
"""
|
|
File without changes
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
from abc import ABC, abstractmethod
|
|
2
|
+
|
|
3
|
+
from luna_quantum.client.interfaces.clients import ICircuitRestClient
|
|
4
|
+
from luna_quantum.client.interfaces.clients.qpu_token_rest_client_i import (
|
|
5
|
+
IQpuTokenRestClient,
|
|
6
|
+
)
|
|
7
|
+
from luna_quantum.client.interfaces.services.service_i import IService
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class ILunaQ(IService, ABC):
|
|
11
|
+
"""Interface for the LunaQ client."""
|
|
12
|
+
|
|
13
|
+
@property
|
|
14
|
+
@abstractmethod
|
|
15
|
+
def qpu_token(self) -> IQpuTokenRestClient:
|
|
16
|
+
"""
|
|
17
|
+
Returns a QPU token repository.
|
|
18
|
+
|
|
19
|
+
Examples
|
|
20
|
+
--------
|
|
21
|
+
>>> add(4.0, 2.0)
|
|
22
|
+
6.0
|
|
23
|
+
>>> add(4, 2)
|
|
24
|
+
6.0
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
"""
|
|
28
|
+
raise NotImplementedError
|
|
29
|
+
|
|
30
|
+
@property
|
|
31
|
+
@abstractmethod
|
|
32
|
+
def circuit(self) -> ICircuitRestClient:
|
|
33
|
+
"""Returns a circuit :py:class: repository."""
|
|
34
|
+
raise NotImplementedError
|