QuLab 2.10.10__cp313-cp313-macosx_10_13_universal2.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.
- qulab/__init__.py +33 -0
- qulab/__main__.py +4 -0
- qulab/cli/__init__.py +0 -0
- qulab/cli/commands.py +30 -0
- qulab/cli/config.py +170 -0
- qulab/cli/decorators.py +28 -0
- qulab/dicttree.py +523 -0
- qulab/executor/__init__.py +5 -0
- qulab/executor/analyze.py +188 -0
- qulab/executor/cli.py +434 -0
- qulab/executor/load.py +563 -0
- qulab/executor/registry.py +185 -0
- qulab/executor/schedule.py +543 -0
- qulab/executor/storage.py +615 -0
- qulab/executor/template.py +259 -0
- qulab/executor/utils.py +194 -0
- qulab/expression.py +827 -0
- qulab/fun.cpython-313-darwin.so +0 -0
- qulab/monitor/__init__.py +1 -0
- qulab/monitor/__main__.py +8 -0
- qulab/monitor/config.py +41 -0
- qulab/monitor/dataset.py +77 -0
- qulab/monitor/event_queue.py +54 -0
- qulab/monitor/mainwindow.py +234 -0
- qulab/monitor/monitor.py +115 -0
- qulab/monitor/ploter.py +123 -0
- qulab/monitor/qt_compat.py +16 -0
- qulab/monitor/toolbar.py +265 -0
- qulab/scan/__init__.py +2 -0
- qulab/scan/curd.py +221 -0
- qulab/scan/models.py +554 -0
- qulab/scan/optimize.py +76 -0
- qulab/scan/query.py +387 -0
- qulab/scan/record.py +603 -0
- qulab/scan/scan.py +1166 -0
- qulab/scan/server.py +450 -0
- qulab/scan/space.py +213 -0
- qulab/scan/utils.py +234 -0
- qulab/storage/__init__.py +0 -0
- qulab/storage/__main__.py +51 -0
- qulab/storage/backend/__init__.py +0 -0
- qulab/storage/backend/redis.py +204 -0
- qulab/storage/base_dataset.py +352 -0
- qulab/storage/chunk.py +60 -0
- qulab/storage/dataset.py +127 -0
- qulab/storage/file.py +273 -0
- qulab/storage/models/__init__.py +22 -0
- qulab/storage/models/base.py +4 -0
- qulab/storage/models/config.py +28 -0
- qulab/storage/models/file.py +89 -0
- qulab/storage/models/ipy.py +58 -0
- qulab/storage/models/models.py +88 -0
- qulab/storage/models/record.py +161 -0
- qulab/storage/models/report.py +22 -0
- qulab/storage/models/tag.py +93 -0
- qulab/storage/storage.py +95 -0
- qulab/sys/__init__.py +2 -0
- qulab/sys/chat.py +688 -0
- qulab/sys/device/__init__.py +3 -0
- qulab/sys/device/basedevice.py +255 -0
- qulab/sys/device/loader.py +86 -0
- qulab/sys/device/utils.py +79 -0
- qulab/sys/drivers/FakeInstrument.py +68 -0
- qulab/sys/drivers/__init__.py +0 -0
- qulab/sys/ipy_events.py +125 -0
- qulab/sys/net/__init__.py +0 -0
- qulab/sys/net/bencoder.py +205 -0
- qulab/sys/net/cli.py +169 -0
- qulab/sys/net/dhcp.py +543 -0
- qulab/sys/net/dhcpd.py +176 -0
- qulab/sys/net/kad.py +1142 -0
- qulab/sys/net/kcp.py +192 -0
- qulab/sys/net/nginx.py +194 -0
- qulab/sys/progress.py +190 -0
- qulab/sys/rpc/__init__.py +0 -0
- qulab/sys/rpc/client.py +0 -0
- qulab/sys/rpc/exceptions.py +96 -0
- qulab/sys/rpc/msgpack.py +1052 -0
- qulab/sys/rpc/msgpack.pyi +41 -0
- qulab/sys/rpc/router.py +35 -0
- qulab/sys/rpc/rpc.py +412 -0
- qulab/sys/rpc/serialize.py +139 -0
- qulab/sys/rpc/server.py +29 -0
- qulab/sys/rpc/socket.py +29 -0
- qulab/sys/rpc/utils.py +25 -0
- qulab/sys/rpc/worker.py +0 -0
- qulab/sys/rpc/zmq_socket.py +227 -0
- qulab/tools/__init__.py +0 -0
- qulab/tools/connection_helper.py +39 -0
- qulab/typing.py +2 -0
- qulab/utils.py +95 -0
- qulab/version.py +1 -0
- qulab/visualization/__init__.py +188 -0
- qulab/visualization/__main__.py +71 -0
- qulab/visualization/_autoplot.py +464 -0
- qulab/visualization/plot_circ.py +319 -0
- qulab/visualization/plot_layout.py +408 -0
- qulab/visualization/plot_seq.py +242 -0
- qulab/visualization/qdat.py +152 -0
- qulab/visualization/rot3d.py +23 -0
- qulab/visualization/widgets.py +86 -0
- qulab-2.10.10.dist-info/METADATA +110 -0
- qulab-2.10.10.dist-info/RECORD +107 -0
- qulab-2.10.10.dist-info/WHEEL +5 -0
- qulab-2.10.10.dist-info/entry_points.txt +2 -0
- qulab-2.10.10.dist-info/licenses/LICENSE +21 -0
- qulab-2.10.10.dist-info/top_level.txt +1 -0
@@ -0,0 +1,185 @@
|
|
1
|
+
import importlib
|
2
|
+
import os
|
3
|
+
import sys
|
4
|
+
from typing import Any
|
5
|
+
|
6
|
+
from ..cli.config import get_config_value
|
7
|
+
from .storage import Report, save_item
|
8
|
+
|
9
|
+
__current_config_id = None
|
10
|
+
|
11
|
+
|
12
|
+
def _query_config(name: str, default=None):
|
13
|
+
import pickle
|
14
|
+
|
15
|
+
try:
|
16
|
+
with open('parameters.pkl', 'rb') as f:
|
17
|
+
parameters = pickle.load(f)
|
18
|
+
except:
|
19
|
+
parameters = {}
|
20
|
+
|
21
|
+
return parameters.get(name, default)
|
22
|
+
|
23
|
+
|
24
|
+
def _update_config(updates):
|
25
|
+
import pickle
|
26
|
+
|
27
|
+
try:
|
28
|
+
with open('parameters.pkl', 'rb') as f:
|
29
|
+
parameters = pickle.load(f)
|
30
|
+
except:
|
31
|
+
parameters = {}
|
32
|
+
|
33
|
+
for k, v in updates.items():
|
34
|
+
parameters[k] = v
|
35
|
+
|
36
|
+
with open('parameters.pkl', 'wb') as f:
|
37
|
+
pickle.dump(parameters, f)
|
38
|
+
|
39
|
+
|
40
|
+
def _delete_config(name: str):
|
41
|
+
import pickle
|
42
|
+
|
43
|
+
try:
|
44
|
+
with open('parameters.pkl', 'rb') as f:
|
45
|
+
parameters = pickle.load(f)
|
46
|
+
except:
|
47
|
+
parameters = {}
|
48
|
+
|
49
|
+
if name in parameters:
|
50
|
+
del parameters[name]
|
51
|
+
|
52
|
+
with open('parameters.pkl', 'wb') as f:
|
53
|
+
pickle.dump(parameters, f)
|
54
|
+
|
55
|
+
|
56
|
+
def _export_config() -> dict:
|
57
|
+
import pickle
|
58
|
+
|
59
|
+
try:
|
60
|
+
with open('parameters.pkl', 'rb') as f:
|
61
|
+
parameters = pickle.load(f)
|
62
|
+
except:
|
63
|
+
parameters = {}
|
64
|
+
|
65
|
+
return parameters
|
66
|
+
|
67
|
+
|
68
|
+
def _clear_config():
|
69
|
+
import pickle
|
70
|
+
|
71
|
+
try:
|
72
|
+
with open('parameters.pkl', 'rb') as f:
|
73
|
+
parameters = pickle.load(f)
|
74
|
+
except:
|
75
|
+
parameters = {}
|
76
|
+
|
77
|
+
parameters.clear()
|
78
|
+
|
79
|
+
with open('parameters.pkl', 'wb') as f:
|
80
|
+
pickle.dump(parameters, f)
|
81
|
+
|
82
|
+
|
83
|
+
def obey_the_oracle(report: Report, data_path):
|
84
|
+
global __current_config_id
|
85
|
+
update_config(report.oracle)
|
86
|
+
cfg = export_config()
|
87
|
+
__current_config_id = save_item(cfg, 'items', data_path)
|
88
|
+
|
89
|
+
|
90
|
+
def update_parameters(report: Report, data_path):
|
91
|
+
global __current_config_id
|
92
|
+
update_config(report.parameters)
|
93
|
+
cfg = export_config()
|
94
|
+
__current_config_id = save_item(cfg, 'items', data_path)
|
95
|
+
|
96
|
+
|
97
|
+
def current_config(data_path):
|
98
|
+
global __current_config_id
|
99
|
+
if __current_config_id is None:
|
100
|
+
cfg = export_config()
|
101
|
+
__current_config_id = save_item(cfg, 'items', data_path)
|
102
|
+
return __current_config_id
|
103
|
+
|
104
|
+
|
105
|
+
query_config = _query_config
|
106
|
+
update_config = _update_config
|
107
|
+
delete_config = _delete_config
|
108
|
+
export_config = _export_config
|
109
|
+
clear_config = _clear_config
|
110
|
+
|
111
|
+
|
112
|
+
def set_config_api(query_method,
|
113
|
+
update_method,
|
114
|
+
delete_method,
|
115
|
+
export_method,
|
116
|
+
clear_method=None):
|
117
|
+
"""
|
118
|
+
Set the query and update methods for the config.
|
119
|
+
|
120
|
+
Args:
|
121
|
+
query_method: The query method.
|
122
|
+
the method should take a key and return the value.
|
123
|
+
update_method: The update method.
|
124
|
+
the method should take a dict of updates.
|
125
|
+
delete_method: The delete method.
|
126
|
+
the method should take a key and delete it.
|
127
|
+
export_method: The export method.
|
128
|
+
the method should return a dict of the config.
|
129
|
+
clear_method: The clear method.
|
130
|
+
the method should clear the config.
|
131
|
+
"""
|
132
|
+
global query_config, update_config, delete_config, export_config, clear_config, _api
|
133
|
+
|
134
|
+
query_config = query_method
|
135
|
+
update_config = update_method
|
136
|
+
delete_config = delete_method
|
137
|
+
export_config = export_method
|
138
|
+
clear_config = clear_method
|
139
|
+
|
140
|
+
return query_config, update_config, delete_config, export_config, clear_config
|
141
|
+
|
142
|
+
|
143
|
+
def _init():
|
144
|
+
code = get_config_value("code", str, default=None)
|
145
|
+
if code is not None:
|
146
|
+
code = os.path.expanduser(code)
|
147
|
+
if code not in sys.path:
|
148
|
+
sys.path.insert(0, code)
|
149
|
+
|
150
|
+
api = get_config_value('api', str, None)
|
151
|
+
if api is not None:
|
152
|
+
api = importlib.import_module(api)
|
153
|
+
set_config_api(api.query_config, api.update_config, api.delete_config,
|
154
|
+
api.export_config, api.clear_config)
|
155
|
+
|
156
|
+
|
157
|
+
_init()
|
158
|
+
|
159
|
+
|
160
|
+
class Registry():
|
161
|
+
|
162
|
+
def __init__(self):
|
163
|
+
self.api = (query_config, update_config, delete_config, export_config,
|
164
|
+
clear_config)
|
165
|
+
|
166
|
+
def query(self, key: str) -> Any:
|
167
|
+
return self.api[0](key)
|
168
|
+
|
169
|
+
def get(self, key: str) -> Any:
|
170
|
+
return self.query(key)
|
171
|
+
|
172
|
+
def export(self) -> dict[str, dict[str, Any]]:
|
173
|
+
return self.api[3]()
|
174
|
+
|
175
|
+
def set(self, key: str, value: Any):
|
176
|
+
return self.api[1]({key: value})
|
177
|
+
|
178
|
+
def delete(self, key: str):
|
179
|
+
return self.api[2](key)
|
180
|
+
|
181
|
+
def clear(self):
|
182
|
+
return self.api[4]()
|
183
|
+
|
184
|
+
def update(self, parameters: dict[str, Any]):
|
185
|
+
return self.api[1](parameters)
|