QuLab 2.11.0__py3-none-any.whl → 2.11.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.
- qulab/cli/commands.py +12 -3
- qulab/executor/cli.py +77 -0
- qulab/version.py +1 -1
- {qulab-2.11.0.dist-info → qulab-2.11.1.dist-info}/METADATA +1 -1
- {qulab-2.11.0.dist-info → qulab-2.11.1.dist-info}/RECORD +9 -9
- {qulab-2.11.0.dist-info → qulab-2.11.1.dist-info}/WHEEL +0 -0
- {qulab-2.11.0.dist-info → qulab-2.11.1.dist-info}/entry_points.txt +0 -0
- {qulab-2.11.0.dist-info → qulab-2.11.1.dist-info}/licenses/LICENSE +0 -0
- {qulab-2.11.0.dist-info → qulab-2.11.1.dist-info}/top_level.txt +0 -0
qulab/cli/commands.py
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
import click
|
2
2
|
|
3
|
-
from ..executor.cli import boot, create,
|
3
|
+
from ..executor.cli import (boot, create, export, get, load, maintain,
|
4
|
+
reproduce, run, set)
|
4
5
|
from ..monitor.__main__ import main as monitor
|
5
6
|
from ..scan.server import server
|
6
7
|
from ..sys.net.cli import dht
|
@@ -18,6 +19,12 @@ def hello():
|
|
18
19
|
click.echo('hello, world')
|
19
20
|
|
20
21
|
|
22
|
+
@cli.group()
|
23
|
+
def reg():
|
24
|
+
"""Regestry operations."""
|
25
|
+
pass
|
26
|
+
|
27
|
+
|
21
28
|
cli.add_command(monitor)
|
22
29
|
cli.add_command(plot)
|
23
30
|
cli.add_command(dht)
|
@@ -26,6 +33,8 @@ cli.add_command(maintain)
|
|
26
33
|
cli.add_command(run)
|
27
34
|
cli.add_command(reproduce)
|
28
35
|
cli.add_command(create)
|
29
|
-
|
30
|
-
|
36
|
+
reg.add_command(set)
|
37
|
+
reg.add_command(get)
|
38
|
+
reg.add_command(load)
|
39
|
+
reg.add_command(export)
|
31
40
|
cli.add_command(boot)
|
qulab/executor/cli.py
CHANGED
@@ -163,6 +163,83 @@ def get(key, api):
|
|
163
163
|
click.echo(reg.get(key))
|
164
164
|
|
165
165
|
|
166
|
+
@click.command()
|
167
|
+
@click.argument('file')
|
168
|
+
@click.option('--api',
|
169
|
+
'-a',
|
170
|
+
default=lambda: get_config_value("api", str, 'get'),
|
171
|
+
help='The modlule name of the api.')
|
172
|
+
@click.option('--format',
|
173
|
+
'-f',
|
174
|
+
default='json',
|
175
|
+
help='The format of the config.')
|
176
|
+
@log_options('export')
|
177
|
+
def export(file, api, format):
|
178
|
+
"""
|
179
|
+
Export a config.
|
180
|
+
"""
|
181
|
+
logger.info(f'[CMD]: export {file} --api {api}')
|
182
|
+
reg = Registry()
|
183
|
+
if api is not None:
|
184
|
+
api = importlib.import_module(api)
|
185
|
+
set_config_api(api.query_config, api.update_config, api.delete_config,
|
186
|
+
api.export_config, api.clear_config)
|
187
|
+
cfg = reg.export()
|
188
|
+
if format == 'json':
|
189
|
+
import json
|
190
|
+
with open(file, 'w') as f:
|
191
|
+
json.dump(cfg, f, indent=4)
|
192
|
+
elif format == 'yaml':
|
193
|
+
import yaml
|
194
|
+
with open(file, 'w') as f:
|
195
|
+
yaml.dump(cfg, f)
|
196
|
+
elif format == 'pickle':
|
197
|
+
import pickle
|
198
|
+
with open(file, 'wb') as f:
|
199
|
+
pickle.dump(cfg, f)
|
200
|
+
else:
|
201
|
+
raise ValueError(f'Unknown format: {format}')
|
202
|
+
|
203
|
+
|
204
|
+
@click.command()
|
205
|
+
@click.argument('file')
|
206
|
+
@click.option('--api',
|
207
|
+
'-a',
|
208
|
+
default=lambda: get_config_value("api", str, 'get'),
|
209
|
+
help='The modlule name of the api.')
|
210
|
+
@click.option('--format',
|
211
|
+
'-f',
|
212
|
+
default='json',
|
213
|
+
help='The format of the config.')
|
214
|
+
@log_options('load')
|
215
|
+
def load(file, api, format):
|
216
|
+
"""
|
217
|
+
Load a config.
|
218
|
+
"""
|
219
|
+
logger.info(f'[CMD]: load {file} --api {api}')
|
220
|
+
reg = Registry()
|
221
|
+
if api is not None:
|
222
|
+
api = importlib.import_module(api)
|
223
|
+
set_config_api(api.query_config, api.update_config, api.delete_config,
|
224
|
+
api.export_config, api.clear_config)
|
225
|
+
if format == 'json':
|
226
|
+
import json
|
227
|
+
with open(file, 'r') as f:
|
228
|
+
cfg = json.load(f)
|
229
|
+
elif format == 'yaml':
|
230
|
+
import yaml
|
231
|
+
with open(file, 'r') as f:
|
232
|
+
cfg = yaml.load(f, Loader=yaml.FullLoader)
|
233
|
+
elif format == 'pickle':
|
234
|
+
import pickle
|
235
|
+
with open(file, 'rb') as f:
|
236
|
+
cfg = pickle.load(f)
|
237
|
+
else:
|
238
|
+
raise ValueError(f'Unknown format: {format}')
|
239
|
+
reg.clear()
|
240
|
+
reg.update(cfg)
|
241
|
+
|
242
|
+
|
166
243
|
@click.command()
|
167
244
|
@click.option('--bootstrap',
|
168
245
|
'-b',
|
qulab/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "2.11.
|
1
|
+
__version__ = "2.11.1"
|
@@ -2,14 +2,14 @@ qulab/__init__.py,sha256=hmf6R3jiM5NtJY1mSptogYnH5DMTR2dTzlXykqLxQzg,2027
|
|
2
2
|
qulab/__main__.py,sha256=fjaRSL_uUjNIzBGNgjlGswb9TJ2VD5qnkZHW3hItrD4,68
|
3
3
|
qulab/typing.py,sha256=vg62sGqxuD9CI5677ejlzAmf2fVdAESZCQjAE_xSxPg,69
|
4
4
|
qulab/utils.py,sha256=BdLdlfjpe6m6gSeONYmpAKTTqxDaYHNk4exlz8kZxTg,2982
|
5
|
-
qulab/version.py,sha256=
|
5
|
+
qulab/version.py,sha256=L1NLbAiqOvyeykqIP0sEpfnHOltZ_nm9qsrW3nkEmTk,22
|
6
6
|
qulab/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
7
|
-
qulab/cli/commands.py,sha256=
|
7
|
+
qulab/cli/commands.py,sha256=Ezop5CEOvvEMDaPmfGXF0JH-CifKuDMk9yLglpUK9Zs,781
|
8
8
|
qulab/cli/config.py,sha256=tZPSBLbf2x_Brb2UBuA1bsni8nC8WOPPGyWIi8m7j1I,5459
|
9
9
|
qulab/cli/decorators.py,sha256=oImteZVnDPPWdyhJ4kzf2KYGJLON7VsKGBvZadWLQZo,621
|
10
10
|
qulab/executor/__init__.py,sha256=LosPzOMaljSZY1thy_Fxtbrgq7uubJszMABEB7oM7tU,101
|
11
11
|
qulab/executor/analyze.py,sha256=4Hau5LrKUdpweh7W94tcG4ahgxucHOevbM0hm57T7zE,5649
|
12
|
-
qulab/executor/cli.py,sha256=
|
12
|
+
qulab/executor/cli.py,sha256=FZQY249VVSoMZm3lZGaVTAvgULKjMeC97YUe4hqi5Y0,17608
|
13
13
|
qulab/executor/load.py,sha256=eMlzOrrn8GpbP3J3uY5JJ8iO7tL5B1DWP1z2qiGyNhU,20385
|
14
14
|
qulab/executor/registry.py,sha256=gym9F5FIDY5eV-cSCZsP99wC4l-6jkx9VMjJMaPOLaQ,4730
|
15
15
|
qulab/executor/schedule.py,sha256=7gAJFwj13j1niGjVa1fSzwOS22eNFEN1hdrN3dfTY6A,21410
|
@@ -96,9 +96,9 @@ qulab/visualization/plot_seq.py,sha256=UWTS6p9nfX_7B8ehcYo6UnSTUCjkBsNU9jiOeW2ca
|
|
96
96
|
qulab/visualization/qdat.py,sha256=ZeevBYWkzbww4xZnsjHhw7wRorJCBzbG0iEu-XQB4EA,5735
|
97
97
|
qulab/visualization/rot3d.py,sha256=lMrEJlRLwYe6NMBlGkKYpp_V9CTipOAuDy6QW_cQK00,734
|
98
98
|
qulab/visualization/widgets.py,sha256=6KkiTyQ8J-ei70LbPQZAK35wjktY47w2IveOa682ftA,3180
|
99
|
-
qulab-2.11.
|
100
|
-
qulab-2.11.
|
101
|
-
qulab-2.11.
|
102
|
-
qulab-2.11.
|
103
|
-
qulab-2.11.
|
104
|
-
qulab-2.11.
|
99
|
+
qulab-2.11.1.dist-info/licenses/LICENSE,sha256=PRzIKxZtpQcH7whTG6Egvzl1A0BvnSf30tmR2X2KrpA,1065
|
100
|
+
qulab-2.11.1.dist-info/METADATA,sha256=NhaeCv-fsilTHypKCMhtX0vuBVH3nCCtE-4k4Ri8zKk,3868
|
101
|
+
qulab-2.11.1.dist-info/WHEEL,sha256=Nw36Djuh_5VDukK0H78QzOX-_FQEo6V37m3nkm96gtU,91
|
102
|
+
qulab-2.11.1.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
|
103
|
+
qulab-2.11.1.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
|
104
|
+
qulab-2.11.1.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|