QuLab 2.7.18__cp310-cp310-macosx_10_9_universal2.whl → 2.7.19__cp310-cp310-macosx_10_9_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/executor/load.py +11 -24
- qulab/executor/storage.py +17 -1
- qulab/fun.cpython-310-darwin.so +0 -0
- qulab/version.py +1 -1
- {qulab-2.7.18.dist-info → qulab-2.7.19.dist-info}/METADATA +1 -1
- {qulab-2.7.18.dist-info → qulab-2.7.19.dist-info}/RECORD +10 -10
- {qulab-2.7.18.dist-info → qulab-2.7.19.dist-info}/LICENSE +0 -0
- {qulab-2.7.18.dist-info → qulab-2.7.19.dist-info}/WHEEL +0 -0
- {qulab-2.7.18.dist-info → qulab-2.7.19.dist-info}/entry_points.txt +0 -0
- {qulab-2.7.18.dist-info → qulab-2.7.19.dist-info}/top_level.txt +0 -0
qulab/executor/load.py
CHANGED
@@ -81,16 +81,6 @@ class SetConfigWorkflow():
|
|
81
81
|
WorkflowType = ModuleType | SetConfigWorkflow
|
82
82
|
|
83
83
|
|
84
|
-
def get_source(workflow: WorkflowType, code_path: str | Path) -> str:
|
85
|
-
if isinstance(code_path, str):
|
86
|
-
code_path = Path(code_path)
|
87
|
-
try:
|
88
|
-
with open(code_path / workflow.__workflow_id__, 'r') as f:
|
89
|
-
return f.read()
|
90
|
-
except:
|
91
|
-
return ''
|
92
|
-
|
93
|
-
|
94
84
|
def can_call_without_args(func):
|
95
85
|
if not callable(func):
|
96
86
|
return False
|
@@ -320,6 +310,8 @@ def load_workflow_from_file(file_name: str,
|
|
320
310
|
module = module_from_spec(spec)
|
321
311
|
spec.loader.exec_module(module)
|
322
312
|
module.__mtime__ = (base_path / path).stat().st_mtime
|
313
|
+
source_code = (base_path / path).read_text()
|
314
|
+
module.__source__ = source_code
|
323
315
|
|
324
316
|
if hasattr(module, 'entries'):
|
325
317
|
verify_entries(module, base_path)
|
@@ -347,11 +339,11 @@ def load_workflow_from_template(template_path: str,
|
|
347
339
|
path = Path(template_path)
|
348
340
|
|
349
341
|
with open(base_path / path) as f:
|
350
|
-
|
342
|
+
template = f.read()
|
351
343
|
|
352
344
|
mtime = max((base_path / template_path).stat().st_mtime, mtime)
|
353
345
|
|
354
|
-
content, hash_str = inject_mapping(
|
346
|
+
content, hash_str = inject_mapping(template, mapping, str(path))
|
355
347
|
|
356
348
|
if target_path is None:
|
357
349
|
if path.stem == 'template':
|
@@ -365,22 +357,19 @@ def load_workflow_from_template(template_path: str,
|
|
365
357
|
path = target_path
|
366
358
|
|
367
359
|
file = base_path / path
|
368
|
-
if not file.exists():
|
360
|
+
if not file.exists() or file.stat().st_mtime < mtime:
|
369
361
|
file.parent.mkdir(parents=True, exist_ok=True)
|
370
362
|
with open(file, 'w') as f:
|
371
363
|
f.write(content)
|
372
|
-
|
373
|
-
|
374
|
-
|
375
|
-
|
376
|
-
else:
|
377
|
-
if file.read_text() != content:
|
378
|
-
logger.warning(
|
379
|
-
f"`{file}` already exists and is different from the new one generated from template `{template_path}`"
|
380
|
-
)
|
364
|
+
elif file.read_text() != content:
|
365
|
+
logger.warning(
|
366
|
+
f"`{file}` already exists and is different from the new one generated from template `{template_path}`"
|
367
|
+
)
|
381
368
|
|
382
369
|
module = load_workflow_from_file(str(path), base_path, package)
|
383
370
|
module.__mtime__ = max(mtime, module.__mtime__)
|
371
|
+
if module.__source__ == content:
|
372
|
+
module.__source__ = template, mapping, str(template_path)
|
384
373
|
|
385
374
|
return module
|
386
375
|
|
@@ -422,8 +411,6 @@ def load_workflow(workflow: str | tuple[str, dict],
|
|
422
411
|
w.__workflow_id__ = str(Path(w.__file__).relative_to(base_path))
|
423
412
|
else:
|
424
413
|
raise TypeError(f"Invalid workflow: {workflow}")
|
425
|
-
|
426
|
-
w.__source__ = get_source(w, base_path)
|
427
414
|
|
428
415
|
return w
|
429
416
|
|
qulab/executor/storage.py
CHANGED
@@ -36,6 +36,20 @@ class Report():
|
|
36
36
|
config_path: Path | None = field(default=None, repr=False)
|
37
37
|
script_path: Path | None = field(default=None, repr=False)
|
38
38
|
|
39
|
+
def __getstate__(self):
|
40
|
+
state = self.__dict__.copy()
|
41
|
+
state.pop('base_path')
|
42
|
+
for k in ['path', 'previous_path', 'config_path', 'script_path']:
|
43
|
+
if state[k] is not None:
|
44
|
+
state[k] = str(state[k])
|
45
|
+
return state
|
46
|
+
|
47
|
+
def __setstate__(self, state):
|
48
|
+
for k in ['path', 'previous_path', 'config_path', 'script_path']:
|
49
|
+
if state[k] is not None:
|
50
|
+
state[k] = Path(state[k])
|
51
|
+
self.__dict__.update(state)
|
52
|
+
|
39
53
|
@property
|
40
54
|
def previous(self):
|
41
55
|
if self.previous_path is not None and self.base_path is not None:
|
@@ -84,7 +98,9 @@ class Report():
|
|
84
98
|
@property
|
85
99
|
def script(self):
|
86
100
|
if self.script_path is not None and self.base_path is not None:
|
87
|
-
|
101
|
+
source = load_item(self.script_path, self.base_path)
|
102
|
+
if isinstance(source, str):
|
103
|
+
return source
|
88
104
|
else:
|
89
105
|
return None
|
90
106
|
|
qulab/fun.cpython-310-darwin.so
CHANGED
Binary file
|
qulab/version.py
CHANGED
@@ -1 +1 @@
|
|
1
|
-
__version__ = "2.7.
|
1
|
+
__version__ = "2.7.19"
|
@@ -1,18 +1,18 @@
|
|
1
1
|
qulab/__init__.py,sha256=KJcUcZ5qXY6wlAoirzK_B-dgtDjsLmOE671v3gcXO_c,286
|
2
2
|
qulab/__main__.py,sha256=fjaRSL_uUjNIzBGNgjlGswb9TJ2VD5qnkZHW3hItrD4,68
|
3
3
|
qulab/dicttree.py,sha256=tRRMpGZYVOLw0TEByE3_2Ss8FdOmzuGL9e1DWbs8qoY,13684
|
4
|
-
qulab/fun.cpython-310-darwin.so,sha256=
|
4
|
+
qulab/fun.cpython-310-darwin.so,sha256=JNmhMFDYBLA9A5KZ-ozH7Bl8z9GpyYoy2BgVjKDszC4,126864
|
5
5
|
qulab/typing.py,sha256=vg62sGqxuD9CI5677ejlzAmf2fVdAESZCQjAE_xSxPg,69
|
6
6
|
qulab/utils.py,sha256=_0gm0sHwwIhk0tYRCLu4oNaS6Tt8meGWt6byu7Kk95Y,2993
|
7
|
-
qulab/version.py,sha256=
|
7
|
+
qulab/version.py,sha256=l3aREioriZeXEjFmLR4Dbu7Nj408gevOUOElKwDjjD4,22
|
8
8
|
qulab/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
9
9
|
qulab/cli/commands.py,sha256=tgDIkkeIoasQXAifJZ6NU8jDgpNgb2a-B0C4nF0evrE,559
|
10
10
|
qulab/cli/config.py,sha256=Ei7eSYnbwPPlluDnm8YmWONYiI4g7WtvlZGQdr1Z6vo,3688
|
11
11
|
qulab/executor/__init__.py,sha256=LosPzOMaljSZY1thy_Fxtbrgq7uubJszMABEB7oM7tU,101
|
12
12
|
qulab/executor/cli.py,sha256=z8W1RivKdABQSOGy2viNUvG73QvOBpE9gSKjw45vSVA,9794
|
13
|
-
qulab/executor/load.py,sha256=
|
13
|
+
qulab/executor/load.py,sha256=YndvzagvWR8Sg6WHZ-gP-Of0FrFOyh_E_a3VXsjDf1Q,17502
|
14
14
|
qulab/executor/schedule.py,sha256=0BV5LGxhqdIlGwW6-o5_5mljAtdtL1La8EDNBFi8pzU,18585
|
15
|
-
qulab/executor/storage.py,sha256=
|
15
|
+
qulab/executor/storage.py,sha256=jFUXYcBFyH2vVzrSzmXtyLtEgIMRczfk27Yb95pV5JM,12217
|
16
16
|
qulab/executor/template.py,sha256=1c7xd0U82fLaqb8O0NQIVVd7aRLuCZNT11-heFw2n9Q,7540
|
17
17
|
qulab/executor/transform.py,sha256=BDx0c4nqTHMAOLVqju0Ydd91uxNm6EpVIfssjZse0bI,2284
|
18
18
|
qulab/executor/utils.py,sha256=l_b0y2kMwYKyyXeFtoblPYwKNU-wiFQ9PMo9QlWl9wE,6213
|
@@ -97,9 +97,9 @@ qulab/visualization/plot_seq.py,sha256=UWTS6p9nfX_7B8ehcYo6UnSTUCjkBsNU9jiOeW2ca
|
|
97
97
|
qulab/visualization/qdat.py,sha256=ZeevBYWkzbww4xZnsjHhw7wRorJCBzbG0iEu-XQB4EA,5735
|
98
98
|
qulab/visualization/rot3d.py,sha256=lMrEJlRLwYe6NMBlGkKYpp_V9CTipOAuDy6QW_cQK00,734
|
99
99
|
qulab/visualization/widgets.py,sha256=6KkiTyQ8J-ei70LbPQZAK35wjktY47w2IveOa682ftA,3180
|
100
|
-
qulab-2.7.
|
101
|
-
qulab-2.7.
|
102
|
-
qulab-2.7.
|
103
|
-
qulab-2.7.
|
104
|
-
qulab-2.7.
|
105
|
-
qulab-2.7.
|
100
|
+
qulab-2.7.19.dist-info/LICENSE,sha256=PRzIKxZtpQcH7whTG6Egvzl1A0BvnSf30tmR2X2KrpA,1065
|
101
|
+
qulab-2.7.19.dist-info/METADATA,sha256=5Xnc4iYsS7_SHRxyEwF9nXTeK9D6d4IZQ8pvWEsPMwc,3699
|
102
|
+
qulab-2.7.19.dist-info/WHEEL,sha256=PolFmPkBRqOxJCMvmNEJhcMPAgrWNQIyPvTInzN4IZk,114
|
103
|
+
qulab-2.7.19.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
|
104
|
+
qulab-2.7.19.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
|
105
|
+
qulab-2.7.19.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|