classiq 0.48.1__py3-none-any.whl → 0.49.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 +7 -1
- classiq/analyzer/show_interactive_hack.py +15 -4
- classiq/interface/_version.py +1 -1
- classiq/interface/backend/backend_preferences.py +23 -0
- classiq/interface/backend/quantum_backend_providers.py +9 -0
- classiq/interface/debug_info/debug_info.py +1 -0
- classiq/interface/exceptions.py +1 -1
- classiq/interface/generator/generated_circuit_data.py +15 -1
- classiq/interface/hardware.py +1 -0
- classiq/synthesis.py +139 -15
- {classiq-0.48.1.dist-info → classiq-0.49.0.dist-info}/METADATA +1 -1
- {classiq-0.48.1.dist-info → classiq-0.49.0.dist-info}/RECORD +13 -14
- classiq/show.py +0 -44
- {classiq-0.48.1.dist-info → classiq-0.49.0.dist-info}/WHEEL +0 -0
classiq/__init__.py
CHANGED
@@ -48,13 +48,16 @@ from classiq.executor import (
|
|
48
48
|
)
|
49
49
|
from classiq.qmod import * # noqa: F403
|
50
50
|
from classiq.qmod import __all__ as _qmod_all
|
51
|
-
from classiq.show import show
|
52
51
|
from classiq.synthesis import (
|
53
52
|
set_constraints,
|
54
53
|
set_execution_preferences,
|
55
54
|
set_preferences,
|
55
|
+
show,
|
56
56
|
synthesize,
|
57
57
|
synthesize_async,
|
58
|
+
update_constraints,
|
59
|
+
update_execution_preferences,
|
60
|
+
update_preferences,
|
58
61
|
)
|
59
62
|
|
60
63
|
_application_constructors_all = [
|
@@ -95,6 +98,9 @@ __all__ = (
|
|
95
98
|
"set_preferences",
|
96
99
|
"set_constraints",
|
97
100
|
"set_execution_preferences",
|
101
|
+
"update_preferences",
|
102
|
+
"update_constraints",
|
103
|
+
"update_execution_preferences",
|
98
104
|
"set_quantum_program_execution_preferences",
|
99
105
|
"show",
|
100
106
|
"hamiltonian_to_matrix",
|
@@ -1,6 +1,8 @@
|
|
1
1
|
import webbrowser
|
2
2
|
from urllib.parse import urljoin
|
3
3
|
|
4
|
+
from classiq.interface.exceptions import ClassiqAnalyzerVisualizationError
|
5
|
+
from classiq.interface.generator.model.preferences.preferences import QuantumFormat
|
4
6
|
from classiq.interface.generator.quantum_program import QuantumProgram
|
5
7
|
|
6
8
|
from classiq._internals.api_wrapper import ApiWrapper
|
@@ -8,18 +10,27 @@ from classiq._internals.async_utils import syncify_function
|
|
8
10
|
from classiq.analyzer.url_utils import circuit_page_uri, client_ide_base_url
|
9
11
|
|
10
12
|
|
11
|
-
async def handle_remote_app(circuit: QuantumProgram) -> None:
|
13
|
+
async def handle_remote_app(circuit: QuantumProgram, dispaly_url: bool = False) -> None:
|
14
|
+
if circuit.outputs.get(QuantumFormat.QASM) is None:
|
15
|
+
raise ClassiqAnalyzerVisualizationError(
|
16
|
+
"Missing QASM transpilation: visualization is only supported "
|
17
|
+
"for QASM programs. Try adding QASM to the output formats "
|
18
|
+
"synthesis preferences"
|
19
|
+
)
|
12
20
|
circuit_dataid = await ApiWrapper.call_analyzer_app(circuit)
|
13
21
|
app_url = urljoin(
|
14
22
|
client_ide_base_url(),
|
15
23
|
circuit_page_uri(circuit_id=circuit_dataid.id, circuit_version=circuit.version),
|
16
24
|
)
|
17
|
-
|
25
|
+
|
26
|
+
if dispaly_url:
|
27
|
+
print(f"Opening: {app_url}") # noqa: T201
|
28
|
+
|
18
29
|
webbrowser.open_new_tab(app_url)
|
19
30
|
|
20
31
|
|
21
|
-
async def _show_interactive(self: QuantumProgram) -> None:
|
22
|
-
await handle_remote_app(
|
32
|
+
async def _show_interactive(self: QuantumProgram, dispaly_url: bool = False) -> None:
|
33
|
+
await handle_remote_app(self, dispaly_url)
|
23
34
|
|
24
35
|
|
25
36
|
QuantumProgram.show = syncify_function(_show_interactive) # type: ignore[attr-defined]
|
classiq/interface/_version.py
CHANGED
@@ -13,6 +13,7 @@ from classiq.interface.backend.quantum_backend_providers import (
|
|
13
13
|
AzureQuantumBackendNames,
|
14
14
|
ClassiqNvidiaBackendNames,
|
15
15
|
ClassiqSimulatorBackendNames,
|
16
|
+
IntelBackendNames,
|
16
17
|
IonqBackendNames,
|
17
18
|
OQCBackendNames,
|
18
19
|
ProviderTypeVendor,
|
@@ -427,6 +428,25 @@ class OQCBackendPreferences(BackendPreferences):
|
|
427
428
|
)
|
428
429
|
|
429
430
|
|
431
|
+
class IntelBackendPreferences(BackendPreferences):
|
432
|
+
"""
|
433
|
+
Represents backend preferences specific to Classiq quantum computing targets.
|
434
|
+
|
435
|
+
This class is used to configure the backend options for executing quantum circuits on Classiq's platform.
|
436
|
+
The relevant backend names for Classiq targets are specified in `ClassiqSimulatorBackendNames` & `ClassiqNvidiaBackendNames`.
|
437
|
+
|
438
|
+
For more details, refer to the [Classiq Backend Documentation](https://docs.classiq.io/latest/reference-manual/executor/cloud-providers/classiq-backends/).
|
439
|
+
"""
|
440
|
+
|
441
|
+
backend_service_provider: ProviderTypeVendor.INTEL
|
442
|
+
|
443
|
+
@pydantic.root_validator(pre=True)
|
444
|
+
def _set_backend_service_provider(cls, values: Dict[str, Any]) -> Dict[str, Any]:
|
445
|
+
return values_with_discriminator(
|
446
|
+
values, "backend_service_provider", ProviderVendor.INTEL
|
447
|
+
)
|
448
|
+
|
449
|
+
|
430
450
|
def is_exact_simulator(backend_preferences: BackendPreferences) -> bool:
|
431
451
|
return backend_preferences.backend_name in EXACT_SIMULATORS
|
432
452
|
|
@@ -456,6 +476,7 @@ BackendPreferencesTypes = Union[
|
|
456
476
|
GCPBackendPreferences,
|
457
477
|
AliceBobBackendPreferences,
|
458
478
|
OQCBackendPreferences,
|
479
|
+
IntelBackendPreferences,
|
459
480
|
]
|
460
481
|
|
461
482
|
__all__ = [
|
@@ -471,11 +492,13 @@ __all__ = [
|
|
471
492
|
"IonqBackendPreferences",
|
472
493
|
"IonqBackendNames",
|
473
494
|
"ClassiqNvidiaBackendNames",
|
495
|
+
"IntelBackendNames",
|
474
496
|
"GCPBackendPreferences",
|
475
497
|
"AliceBobBackendPreferences",
|
476
498
|
"AliceBobBackendNames",
|
477
499
|
"OQCBackendPreferences",
|
478
500
|
"OQCBackendNames",
|
501
|
+
"IntelBackendPreferences",
|
479
502
|
]
|
480
503
|
|
481
504
|
|
@@ -18,6 +18,7 @@ class ProviderVendor(StrEnum):
|
|
18
18
|
GOOGLE = "Google"
|
19
19
|
ALICE_AND_BOB = "Alice & Bob"
|
20
20
|
OQC = "OQC"
|
21
|
+
INTEL = "Intel"
|
21
22
|
|
22
23
|
|
23
24
|
class ProviderTypeVendor:
|
@@ -29,6 +30,7 @@ class ProviderTypeVendor:
|
|
29
30
|
GOOGLE = Literal[ProviderVendor.GOOGLE]
|
30
31
|
ALICE_BOB = Literal[ProviderVendor.ALICE_AND_BOB]
|
31
32
|
OQC = Literal[ProviderVendor.OQC]
|
33
|
+
INTEL = Literal[ProviderVendor.INTEL]
|
32
34
|
|
33
35
|
|
34
36
|
class ClassiqSimulatorBackendNames(StrEnum):
|
@@ -167,6 +169,10 @@ class ClassiqNvidiaBackendNames(StrEnum):
|
|
167
169
|
SIMULATOR = "nvidia_state_vector_simulator"
|
168
170
|
|
169
171
|
|
172
|
+
class IntelBackendNames(StrEnum):
|
173
|
+
SIMULATOR = "intel_qsdk_simulator"
|
174
|
+
|
175
|
+
|
170
176
|
AllClassiqBackendNames = Union[ClassiqSimulatorBackendNames, ClassiqNvidiaBackendNames]
|
171
177
|
|
172
178
|
|
@@ -205,6 +211,7 @@ EXACT_SIMULATORS = {
|
|
205
211
|
AmazonBraketBackendNames.AMAZON_BRAKET_TN1,
|
206
212
|
AmazonBraketBackendNames.AMAZON_BRAKET_DM1,
|
207
213
|
*ClassiqSimulatorBackendNames,
|
214
|
+
*IntelBackendNames,
|
208
215
|
*ClassiqNvidiaBackendNames,
|
209
216
|
}
|
210
217
|
|
@@ -215,6 +222,7 @@ AllBackendsNameByVendor = Union[
|
|
215
222
|
AzureQuantumBackendNames,
|
216
223
|
AmazonBraketBackendNames,
|
217
224
|
IonqBackendNames,
|
225
|
+
IntelBackendNames,
|
218
226
|
ClassiqNvidiaBackendNames,
|
219
227
|
AliceBobBackendNames,
|
220
228
|
OQCBackendNames,
|
@@ -226,6 +234,7 @@ AllBackendsNameEnums = [
|
|
226
234
|
AmazonBraketBackendNames,
|
227
235
|
IonqBackendNames,
|
228
236
|
AliceBobBackendNames,
|
237
|
+
IntelBackendNames,
|
229
238
|
ClassiqNvidiaBackendNames,
|
230
239
|
OQCBackendNames,
|
231
240
|
]
|
@@ -19,6 +19,7 @@ class FunctionDebugInfo(BaseModel):
|
|
19
19
|
parameters: Dict[str, str] = Field(type=Dict[str, ParameterValue])
|
20
20
|
level: OperationLevel
|
21
21
|
is_allocate_or_free: bool = Field(default=False)
|
22
|
+
is_inverse: bool = Field(default=False)
|
22
23
|
port_to_passed_variable_map: Dict[str, str] = Field(default_factory=dict)
|
23
24
|
|
24
25
|
@staticmethod
|
classiq/interface/exceptions.py
CHANGED
@@ -9,7 +9,7 @@ from classiq.interface.generator.register_role import RegisterRole
|
|
9
9
|
from classiq.interface.generator.synthesis_metadata.synthesis_execution_data import (
|
10
10
|
ExecutionData,
|
11
11
|
)
|
12
|
-
from classiq.interface.ide.visual_model import OperationParameter
|
12
|
+
from classiq.interface.ide.visual_model import OperationLevel, OperationParameter
|
13
13
|
|
14
14
|
_logger = logging.getLogger(__name__)
|
15
15
|
ParameterName = str
|
@@ -102,9 +102,17 @@ class FunctionDebugInfoInterface(pydantic.BaseModel):
|
|
102
102
|
relative_qubits: Tuple[int, ...]
|
103
103
|
absolute_qubits: Optional[Tuple[int, ...]]
|
104
104
|
is_basis_gate: Optional[bool]
|
105
|
+
is_inverse: bool = pydantic.Field(default=False)
|
106
|
+
level: OperationLevel = pydantic.Field(default=OperationLevel.UNKNOWN)
|
105
107
|
parameters: List[OperationParameter] = list()
|
106
108
|
port_to_passed_variable_map: Dict[str, str] = pydantic.Field(default_factory=dict)
|
107
109
|
|
110
|
+
@property
|
111
|
+
def name(self) -> str:
|
112
|
+
if self.generated_function is None:
|
113
|
+
return ""
|
114
|
+
return self.generated_function.name
|
115
|
+
|
108
116
|
@property
|
109
117
|
def registers(self) -> List[GeneratedRegister]:
|
110
118
|
if self.generated_function is None:
|
@@ -153,6 +161,12 @@ class FunctionDebugInfoInterface(pydantic.BaseModel):
|
|
153
161
|
)
|
154
162
|
child.propagate_absolute_qubits()
|
155
163
|
|
164
|
+
def inverse(self) -> None:
|
165
|
+
self.is_inverse = not self.is_inverse
|
166
|
+
for child in self.children:
|
167
|
+
child.inverse()
|
168
|
+
self.children = self.children[::-1]
|
169
|
+
|
156
170
|
|
157
171
|
def _get_absolute_from_relative(
|
158
172
|
absolute_qubits: Tuple[int, ...], relative_qubits: Tuple[int, ...]
|
classiq/interface/hardware.py
CHANGED
classiq/synthesis.py
CHANGED
@@ -1,17 +1,41 @@
|
|
1
|
-
from typing import NewType
|
1
|
+
from typing import Any, NewType, Optional
|
2
2
|
|
3
3
|
import pydantic
|
4
4
|
|
5
|
+
from classiq.interface.exceptions import ClassiqValueError
|
5
6
|
from classiq.interface.executor.execution_preferences import ExecutionPreferences
|
6
7
|
from classiq.interface.generator.model.constraints import Constraints
|
7
8
|
from classiq.interface.generator.model.preferences.preferences import Preferences
|
8
9
|
from classiq.interface.model.model import Model, SerializedModel
|
9
10
|
|
11
|
+
from classiq import QuantumProgram
|
10
12
|
from classiq._internals import async_utils
|
11
13
|
from classiq._internals.api_wrapper import ApiWrapper
|
12
14
|
|
13
15
|
SerializedQuantumProgram = NewType("SerializedQuantumProgram", str)
|
14
16
|
|
17
|
+
CANT_PARSE_QUANTUM_PROGRAM_MSG = (
|
18
|
+
"Can not parse quantum_program into GeneratedCircuit, \n"
|
19
|
+
)
|
20
|
+
|
21
|
+
|
22
|
+
def show(quantum_program: SerializedQuantumProgram) -> None:
|
23
|
+
"""
|
24
|
+
Displays the interactive representation of the quantum program in the Classiq IDE.
|
25
|
+
|
26
|
+
Args:
|
27
|
+
quantum_program:
|
28
|
+
The serialized quantum program to be displayed.
|
29
|
+
|
30
|
+
Links:
|
31
|
+
[Visualization tool](https://docs.classiq.io/latest/reference-manual/analyzer/quantum-program-visualization-tool/)
|
32
|
+
"""
|
33
|
+
try:
|
34
|
+
circuit = QuantumProgram.parse_raw(quantum_program)
|
35
|
+
except pydantic.error_wrappers.ValidationError as exc:
|
36
|
+
raise ClassiqValueError(CANT_PARSE_QUANTUM_PROGRAM_MSG) from exc
|
37
|
+
circuit.show() # type: ignore[attr-defined]
|
38
|
+
|
15
39
|
|
16
40
|
async def synthesize_async(
|
17
41
|
serialized_model: SerializedModel,
|
@@ -21,82 +45,182 @@ async def synthesize_async(
|
|
21
45
|
return SerializedQuantumProgram(quantum_program.json(indent=2))
|
22
46
|
|
23
47
|
|
24
|
-
def synthesize(
|
48
|
+
def synthesize(
|
49
|
+
serialized_model: SerializedModel, auto_show: bool = False
|
50
|
+
) -> SerializedQuantumProgram:
|
25
51
|
"""
|
26
52
|
Synthesize a model with the Classiq engine to receive a quantum program.
|
27
53
|
[More details](https://docs.classiq.io/latest/reference-manual/synthesis/)
|
28
54
|
|
29
55
|
Args:
|
30
56
|
serialized_model: A model object serialized as a string.
|
57
|
+
auto_show: boolean. whether to call `show` on the output
|
31
58
|
|
32
59
|
Returns:
|
33
60
|
SerializedQuantumProgram: Quantum program serialized as a string. (See: QuantumProgram)
|
34
61
|
"""
|
35
|
-
|
62
|
+
result = async_utils.run(synthesize_async(serialized_model))
|
63
|
+
if auto_show:
|
64
|
+
show(result)
|
65
|
+
return result
|
36
66
|
|
37
67
|
|
38
68
|
def set_preferences(
|
39
|
-
serialized_model: SerializedModel,
|
69
|
+
serialized_model: SerializedModel,
|
70
|
+
preferences: Optional[Preferences] = None,
|
71
|
+
**kwargs: Any
|
40
72
|
) -> SerializedModel:
|
41
73
|
"""
|
42
|
-
|
74
|
+
Overrides the preferences of a (serialized) model and returns the updated model.
|
43
75
|
|
44
76
|
Args:
|
45
77
|
serialized_model: The model in serialized form.
|
46
|
-
preferences: The new preferences to be set for the model.
|
78
|
+
preferences: The new preferences to be set for the model. Can be passed as keyword arguments.
|
47
79
|
|
48
80
|
Returns:
|
49
81
|
SerializedModel: The updated model with the new preferences applied.
|
50
82
|
"""
|
83
|
+
if preferences is None:
|
84
|
+
if kwargs:
|
85
|
+
preferences = Preferences(**kwargs)
|
86
|
+
else:
|
87
|
+
raise ClassiqValueError(
|
88
|
+
"Missing preferences. Either pass `Preferences` object or pass keywords"
|
89
|
+
)
|
90
|
+
|
51
91
|
model = pydantic.parse_raw_as(Model, serialized_model)
|
52
92
|
model.preferences = preferences
|
53
93
|
return model.get_model()
|
54
94
|
|
55
95
|
|
96
|
+
def update_preferences(
|
97
|
+
serialized_model: SerializedModel, **kwargs: Any
|
98
|
+
) -> SerializedModel:
|
99
|
+
"""
|
100
|
+
Updates the preferences of a (serialized) model and returns the updated model.
|
101
|
+
|
102
|
+
Args:
|
103
|
+
serialized_model: The model in serialized form.
|
104
|
+
kwargs: key-value combination of preferences fields to update
|
105
|
+
|
106
|
+
Returns:
|
107
|
+
SerializedModel: The updated model with the new preferences applied.
|
108
|
+
"""
|
109
|
+
model = pydantic.parse_raw_as(Model, serialized_model)
|
110
|
+
|
111
|
+
for key, value in kwargs.items():
|
112
|
+
setattr(model.preferences, key, value)
|
113
|
+
|
114
|
+
return model.get_model()
|
115
|
+
|
116
|
+
|
56
117
|
def set_constraints(
|
57
|
-
serialized_model: SerializedModel,
|
118
|
+
serialized_model: SerializedModel,
|
119
|
+
constraints: Optional[Constraints] = None,
|
120
|
+
**kwargs: Any
|
58
121
|
) -> SerializedModel:
|
59
122
|
"""
|
60
|
-
|
123
|
+
Overrides the constraints of a (serialized) model and returns the updated model.
|
61
124
|
|
62
125
|
Args:
|
63
126
|
serialized_model: The model in serialized form.
|
64
|
-
constraints: The new constraints to be set for the model.
|
127
|
+
constraints: The new constraints to be set for the model. Can be passed as keyword arguments.
|
65
128
|
|
66
129
|
Returns:
|
67
130
|
SerializedModel: The updated model with the new constraints applied.
|
68
131
|
"""
|
132
|
+
if constraints is None:
|
133
|
+
if kwargs:
|
134
|
+
constraints = Constraints(**kwargs)
|
135
|
+
else:
|
136
|
+
raise ClassiqValueError(
|
137
|
+
"Missing constraints. Either pass `Constraints` object or pass keywords"
|
138
|
+
)
|
139
|
+
|
69
140
|
model = pydantic.parse_raw_as(Model, serialized_model)
|
70
141
|
model.constraints = constraints
|
71
142
|
return model.get_model()
|
72
143
|
|
73
144
|
|
145
|
+
def update_constraints(
|
146
|
+
serialized_model: SerializedModel, **kwargs: Any
|
147
|
+
) -> SerializedModel:
|
148
|
+
"""
|
149
|
+
Updates the constraints of a (serialized) model and returns the updated model.
|
150
|
+
|
151
|
+
Args:
|
152
|
+
serialized_model: The model in serialized form.
|
153
|
+
kwargs: key-value combination of constraints fields to update
|
154
|
+
|
155
|
+
Returns:
|
156
|
+
SerializedModel: The updated model with the new constraints applied.
|
157
|
+
"""
|
158
|
+
model = pydantic.parse_raw_as(Model, serialized_model)
|
159
|
+
|
160
|
+
for key, value in kwargs.items():
|
161
|
+
setattr(model.constraints, key, value)
|
162
|
+
|
163
|
+
return model.get_model()
|
164
|
+
|
165
|
+
|
74
166
|
def set_execution_preferences(
|
75
|
-
serialized_model: SerializedModel,
|
167
|
+
serialized_model: SerializedModel,
|
168
|
+
execution_preferences: Optional[ExecutionPreferences] = None,
|
169
|
+
**kwargs: Any
|
76
170
|
) -> SerializedModel:
|
77
171
|
"""
|
78
|
-
|
172
|
+
Overrides the execution preferences of a (serialized) model and returns the updated model.
|
79
173
|
|
80
174
|
Args:
|
81
175
|
serialized_model: A serialization of the defined model.
|
82
|
-
execution_preferences: The execution preferences
|
176
|
+
execution_preferences: The new execution preferences to be set for the model. Can be passed as keyword arguments.
|
83
177
|
Returns:
|
84
178
|
SerializedModel: The model with the attached execution preferences.
|
85
179
|
|
86
180
|
For more examples please see: [set_execution_preferences](https://docs.classiq.io/latest/reference-manual/executor/?h=set_execution_preferences#usage)
|
87
|
-
|
88
181
|
"""
|
182
|
+
if execution_preferences is None:
|
183
|
+
if kwargs:
|
184
|
+
execution_preferences = ExecutionPreferences(**kwargs)
|
185
|
+
else:
|
186
|
+
raise ClassiqValueError(
|
187
|
+
"Missing execution_preferences. Either pass `ExecutionPreferences` object or pass keywords"
|
188
|
+
)
|
89
189
|
|
90
190
|
model = pydantic.parse_raw_as(Model, serialized_model)
|
91
191
|
model.execution_preferences = execution_preferences
|
92
192
|
return model.get_model()
|
93
193
|
|
94
194
|
|
195
|
+
def update_execution_preferences(
|
196
|
+
serialized_model: SerializedModel, **kwargs: Any
|
197
|
+
) -> SerializedModel:
|
198
|
+
"""
|
199
|
+
Updates the execution_preferences of a (serialized) model and returns the updated model.
|
200
|
+
|
201
|
+
Args:
|
202
|
+
serialized_model: The model in serialized form.
|
203
|
+
kwargs: key-value combination of execution_preferences fields to update
|
204
|
+
|
205
|
+
Returns:
|
206
|
+
SerializedModel: The updated model with the new execution_preferences applied.
|
207
|
+
"""
|
208
|
+
model = pydantic.parse_raw_as(Model, serialized_model)
|
209
|
+
|
210
|
+
for key, value in kwargs.items():
|
211
|
+
setattr(model.execution_preferences, key, value)
|
212
|
+
|
213
|
+
return model.get_model()
|
214
|
+
|
215
|
+
|
95
216
|
__all__ = [
|
96
217
|
"SerializedModel",
|
97
218
|
"SerializedQuantumProgram",
|
98
|
-
"synthesize",
|
99
|
-
"set_preferences",
|
100
219
|
"set_constraints",
|
101
220
|
"set_execution_preferences",
|
221
|
+
"set_preferences",
|
222
|
+
"synthesize",
|
223
|
+
"update_constraints",
|
224
|
+
"update_execution_preferences",
|
225
|
+
"update_preferences",
|
102
226
|
]
|
@@ -1,4 +1,4 @@
|
|
1
|
-
classiq/__init__.py,sha256=
|
1
|
+
classiq/__init__.py,sha256=kJpBZtjz012nNg9KoP6bi5TtYTTGOFPi3bF7ZoRUfT4,3290
|
2
2
|
classiq/_analyzer_extras/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
3
3
|
classiq/_analyzer_extras/_ipywidgets_async_extension.py,sha256=DF-G1Dhp51P6qlxTJT-kxPMJiYy9tyNoCvqbPQOeJd0,2163
|
4
4
|
classiq/_analyzer_extras/interactive_hardware.py,sha256=f7ad2HeFq1f-2dJtPpgOE_w2IFzm49W6P_c-MzqJ5qE,3257
|
@@ -22,7 +22,7 @@ classiq/analyzer/__init__.py,sha256=qPMmlHic9bHkjQ71aPJbHph1IVrY_lsOpcvjLPOJE4s,
|
|
22
22
|
classiq/analyzer/analyzer.py,sha256=ON4k7OqPwS20IFVYyPsP7CsNUh7YsAyH9EGAbCSRsZI,7224
|
23
23
|
classiq/analyzer/analyzer_utilities.py,sha256=9UfbD3_078-KJ85L4Auwtoc5dOUbzb3ZybHwgTO7w7A,3664
|
24
24
|
classiq/analyzer/rb.py,sha256=z1AEYcxOJBmOiifVxejjAJWtJT8Lcg8ahFQEh4gRZVw,4951
|
25
|
-
classiq/analyzer/show_interactive_hack.py,sha256=
|
25
|
+
classiq/analyzer/show_interactive_hack.py,sha256=lW56gbwn83Zcl7107hIpee7Uht5sOAD03A_ZSVjkbrM,1488
|
26
26
|
classiq/analyzer/url_utils.py,sha256=FfcERpHqqNILwTt7LNwLUKURmpN21rilQVFpnvPtdHE,690
|
27
27
|
classiq/applications/__init__.py,sha256=ANRW68--0PJMxA2Z5XuhGrDKLilkTdj3U5y9EAmPUfU,331
|
28
28
|
classiq/applications/chemistry/__init__.py,sha256=JwKGDR6NiKoykoNdOSovbZges6i40N2xkxYbAMHOS2A,1119
|
@@ -93,7 +93,7 @@ classiq/execution/jobs.py,sha256=t7Wdegpi6lylthg23a98rSmoZ8xXNGfz--efHYw39JY,956
|
|
93
93
|
classiq/execution/qnn.py,sha256=qsOA2mD8Ne_4VwvyGPfuHVDTzyxVnDHwE2gfoaOMsf8,2339
|
94
94
|
classiq/executor.py,sha256=jKD5O_tJpL2NMTC_N0NEuPJEmKZIaqsTpQrgZ88sleg,2594
|
95
95
|
classiq/interface/__init__.py,sha256=cg7hD_XVu1_jJ1fgwmT0rMIoZHopNVeB8xtlmMx-E_A,83
|
96
|
-
classiq/interface/_version.py,sha256=
|
96
|
+
classiq/interface/_version.py,sha256=JUL5JBM1c6ImIoSihQYA76hNNGvABq6AvQdP5Mf11BM,197
|
97
97
|
classiq/interface/analyzer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
98
98
|
classiq/interface/analyzer/analysis_params.py,sha256=043hfS-I3Ec6tkcniKMQQUiRyEC7zlNhntTBpZQB8hw,3725
|
99
99
|
classiq/interface/analyzer/cytoscape_graph.py,sha256=_2GviubgrDMAbF57PTDMhS9W0mTCLYWdyu0HndDPh54,2116
|
@@ -102,11 +102,11 @@ classiq/interface/applications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5
|
|
102
102
|
classiq/interface/applications/qsvm.py,sha256=7LElAz4QwTeia7MeAOy8WUHvuFUOUojs8j2wDOwPMao,3363
|
103
103
|
classiq/interface/ast_node.py,sha256=EE06R8KwRA-QkK44Ou9TmMxiaa8J60G9Z9qf9T76k_k,398
|
104
104
|
classiq/interface/backend/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
105
|
-
classiq/interface/backend/backend_preferences.py,sha256=
|
105
|
+
classiq/interface/backend/backend_preferences.py,sha256=l05slQjXiIFul59f0FmI6M1WHOY67qcBT3wWn3nIqj8,20649
|
106
106
|
classiq/interface/backend/ionq/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
107
107
|
classiq/interface/backend/ionq/ionq_quantum_program.py,sha256=2DRnrzeSDC34mIdpsafWFSm7ZnHhKYspJYGULHv0XgI,1584
|
108
108
|
classiq/interface/backend/pydantic_backend.py,sha256=aRf8kljUMiLBH2odswSCJ3hbex_1nOGTK3YmBC6EfmQ,1462
|
109
|
-
classiq/interface/backend/quantum_backend_providers.py,sha256=
|
109
|
+
classiq/interface/backend/quantum_backend_providers.py,sha256=d77iUBupdvocQTALuFGbeZjkm7Foav03pimGHftmtqs,6463
|
110
110
|
classiq/interface/chemistry/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
111
111
|
classiq/interface/chemistry/ansatz_library.py,sha256=3ki3uaV77cUxUxUzDbn3mVhjvMoKejJ5bIR1kXpBT1k,360
|
112
112
|
classiq/interface/chemistry/elements.py,sha256=Yy8L80SBVgmuKQyW-GlZKzwTqnP1O9po-FGFmKMJLRA,1181
|
@@ -139,9 +139,9 @@ classiq/interface/combinatorial_optimization/result.py,sha256=noMqXdirAq7weswk3t
|
|
139
139
|
classiq/interface/combinatorial_optimization/sense.py,sha256=P8_kJRf3aUKbCkIqOP3tOc81Vpz9yW4Z74RGaYbd9TA,262
|
140
140
|
classiq/interface/combinatorial_optimization/solver_types.py,sha256=kcLt80fQucq_DWmJXmmVljwCGV4gtDnqOMlJdemhPQc,135
|
141
141
|
classiq/interface/debug_info/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
142
|
-
classiq/interface/debug_info/debug_info.py,sha256=
|
142
|
+
classiq/interface/debug_info/debug_info.py,sha256=eDOKHDdUnetvITIeOl1V_yH_Q29mTIiZxqmsBWxNCAk,3114
|
143
143
|
classiq/interface/enum_utils.py,sha256=QxkxLGgON8vdSzLZzHFlPEBJoGOqoIwpESEfLfRqN0w,312
|
144
|
-
classiq/interface/exceptions.py,sha256
|
144
|
+
classiq/interface/exceptions.py,sha256=-mM4XQV-PCsyPvnYWYRHNQgyGairmI6qpCNa65KljUg,4121
|
145
145
|
classiq/interface/execution/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
146
146
|
classiq/interface/execution/jobs.py,sha256=24QKl98LBAYm7OgUk64Ch4bYasuivGFhG33L9KWunCw,585
|
147
147
|
classiq/interface/execution/primitives.py,sha256=a_vH8YgdMeEVYx1h9sgNAqbDQmqca3ePvHfsADHJMn4,584
|
@@ -247,7 +247,7 @@ classiq/interface/generator/functions/function_declaration.py,sha256=xlNLzVsU_Kz
|
|
247
247
|
classiq/interface/generator/functions/port_declaration.py,sha256=ESJE_19jOg_zS1reFN5dq0xgobZ6J3C3DsIs6EME1c4,1100
|
248
248
|
classiq/interface/generator/functions/qmod_python_interface.py,sha256=DVHHTMtbWn38nN5XrTMrfJHkIzeKRU54AWfLymLppvs,66
|
249
249
|
classiq/interface/generator/functions/type_name.py,sha256=3Xzo11Wbe3azNfoATBiKMcHK5xPm-0R0-oN3CifF-QI,2593
|
250
|
-
classiq/interface/generator/generated_circuit_data.py,sha256=
|
250
|
+
classiq/interface/generator/generated_circuit_data.py,sha256=h2CdXuvBD1xiJfGMQcAS45afSJMjynTrLj2RNldEiAQ,5897
|
251
251
|
classiq/interface/generator/grover_diffuser.py,sha256=aqamtljo986D5k-DTh2B4yBlEH3F7DOJXjxS9hhrGps,3530
|
252
252
|
classiq/interface/generator/grover_operator.py,sha256=warGAu9gZH0WIWBLkKdfARMivxNnb8EuOWJrH71obyQ,3822
|
253
253
|
classiq/interface/generator/hadamard_transform.py,sha256=NI4oZBpDCGfaw2OTb5SL3iSGI_nDtyUgElTCO4pEKnk,673
|
@@ -330,7 +330,7 @@ classiq/interface/generator/validations/validator_functions.py,sha256=n-K4R903O2
|
|
330
330
|
classiq/interface/generator/visitor.py,sha256=4stDieh3p7JYuSL9bH_FqKrn0k0Nl8bMO72RQocZ8M8,2864
|
331
331
|
classiq/interface/grover/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
332
332
|
classiq/interface/grover/grover_modelling_params.py,sha256=eMXdjfuGlVq5qD3QyG-C8mAyIBAoxzkjF052M4b1i-k,390
|
333
|
-
classiq/interface/hardware.py,sha256=
|
333
|
+
classiq/interface/hardware.py,sha256=1ZXtKhkhpJo2-Fg7oqGMe-XDG9OBNIUj29gmukuJblQ,2007
|
334
334
|
classiq/interface/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
335
335
|
classiq/interface/helpers/classproperty.py,sha256=pt9A39GgEMzj2nbY5gjFp_CId_wom6lOQt_PADidT4Y,279
|
336
336
|
classiq/interface/helpers/custom_encoders.py,sha256=0-9DTHwQr-I_vP1Ie4Z9N4qfzDhFvGT4qsXP-EdDegs,107
|
@@ -498,8 +498,7 @@ classiq/qmod/symbolic_type.py,sha256=whMy3Uw4iE2SOVfHeyfTpDJ3BH6Rxlhk492ij-4QRU4
|
|
498
498
|
classiq/qmod/type_attribute_remover.py,sha256=dN9dcsmFQI1UXz_DllGKl2BP4XkyvGdNk8diPan-9RE,1236
|
499
499
|
classiq/qmod/utilities.py,sha256=z_VnIRmOYTWjJp2UlOcWK0rQRtMqysmP_Gr6WYY_nak,2734
|
500
500
|
classiq/qmod/write_qmod.py,sha256=SO7hdBdO31lTzyeaJ-Htyma-aJmrbBNtABNEB2llI4Q,1818
|
501
|
-
classiq/
|
502
|
-
classiq/
|
503
|
-
classiq-0.
|
504
|
-
classiq-0.
|
505
|
-
classiq-0.48.1.dist-info/RECORD,,
|
501
|
+
classiq/synthesis.py,sha256=s9-o3lzSxghx0YftQg3iZGvIreJ-H7DSTQYsevKcKw8,7374
|
502
|
+
classiq-0.49.0.dist-info/METADATA,sha256=ZeMVAHnOEaDZFOBes0DgEd7_Lz_RT8vpUEkKSSLxwAU,3458
|
503
|
+
classiq-0.49.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
504
|
+
classiq-0.49.0.dist-info/RECORD,,
|
classiq/show.py
DELETED
@@ -1,44 +0,0 @@
|
|
1
|
-
import re
|
2
|
-
|
3
|
-
import pydantic
|
4
|
-
|
5
|
-
from classiq.interface.analyzer.result import QasmCode
|
6
|
-
from classiq.interface.exceptions import ClassiqValueError
|
7
|
-
|
8
|
-
from classiq import QuantumProgram
|
9
|
-
from classiq._internals.api_wrapper import ApiWrapper
|
10
|
-
from classiq._internals.async_utils import syncify_function
|
11
|
-
from classiq.synthesis import SerializedQuantumProgram
|
12
|
-
|
13
|
-
QASM_VERSION_REGEX = re.compile("OPENQASM (\\d*.\\d*);")
|
14
|
-
|
15
|
-
|
16
|
-
async def qasm_show_interactive_async(qasm_code: str) -> None:
|
17
|
-
circuit = await ApiWrapper.get_generated_circuit_from_qasm(QasmCode(code=qasm_code))
|
18
|
-
circuit.show() # type: ignore[attr-defined]
|
19
|
-
|
20
|
-
|
21
|
-
qasm_show_interactive = syncify_function(qasm_show_interactive_async)
|
22
|
-
|
23
|
-
|
24
|
-
CANT_PARSE_QUANTUM_PROGRAM_MSG = (
|
25
|
-
"Can not parse quantum_program into GeneratedCircuit, \n"
|
26
|
-
)
|
27
|
-
|
28
|
-
|
29
|
-
def show(quantum_program: SerializedQuantumProgram) -> None:
|
30
|
-
"""
|
31
|
-
Displays the interactive representation of the quantum program in the Classiq IDE.
|
32
|
-
|
33
|
-
Args:
|
34
|
-
quantum_program:
|
35
|
-
The serialized quantum program to be displayed.
|
36
|
-
|
37
|
-
Links:
|
38
|
-
[Visualization tool](https://docs.classiq.io/latest/reference-manual/analyzer/quantum-program-visualization-tool/)
|
39
|
-
"""
|
40
|
-
try:
|
41
|
-
circuit = QuantumProgram.parse_raw(quantum_program)
|
42
|
-
except pydantic.error_wrappers.ValidationError as exc:
|
43
|
-
raise ClassiqValueError(CANT_PARSE_QUANTUM_PROGRAM_MSG) from exc
|
44
|
-
circuit.show() # type: ignore[attr-defined]
|
File without changes
|