QuLab 2.4.13__cp310-cp310-macosx_10_9_universal2.whl → 2.4.14__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: QuLab
3
- Version: 2.4.13
3
+ Version: 2.4.14
4
4
  Summary: contral instruments and manage data
5
5
  Author-email: feihoo87 <feihoo87@gmail.com>
6
6
  Maintainer-email: feihoo87 <feihoo87@gmail.com>
@@ -1,15 +1,15 @@
1
1
  qulab/__init__.py,sha256=P-Mx2p4TVmL91SoxoeXcj8Qm0x4xUf5Q_FLk0Yc_gIQ,138
2
2
  qulab/__main__.py,sha256=ThCRooT22_qpwFtbAvVOyHzpBCuGlfDVkXBXvApzgps,597
3
3
  qulab/dicttree.py,sha256=tRRMpGZYVOLw0TEByE3_2Ss8FdOmzuGL9e1DWbs8qoY,13684
4
- qulab/fun.cpython-310-darwin.so,sha256=E7G2FLvF6TCJtlPXbd6ShtFPFUi5PKNfPpQrGDj6mn8,126864
5
- qulab/version.py,sha256=_e118vufispiK25vPHegUtgNTXX7-QuWeU66JWddGAE,22
4
+ qulab/fun.cpython-310-darwin.so,sha256=q6JIrxGDqs4OebdUzbs1L3-_roWXrr_-VFmzFzIKrZo,126864
5
+ qulab/version.py,sha256=IPQCIOITfbX8l3dhIiuTYy89V7yOtf70dflfUCn6Dgk,22
6
6
  qulab/executor/__init__.py,sha256=LosPzOMaljSZY1thy_Fxtbrgq7uubJszMABEB7oM7tU,101
7
7
  qulab/executor/__main__.py,sha256=qgZcdmx1wBZInHf6ionpuuZytIJnaDje9WRv-a8o2OM,5870
8
- qulab/executor/load.py,sha256=2gpBUcVdrZcbVI-YqTAfyKhW9br4rO8gnQtoYv7AO6c,9167
9
- qulab/executor/schedule.py,sha256=Ww0HHRSJxk-V3FM-Qgwqn-l6qPyWjPNoCz9Yy8MVG4o,11663
8
+ qulab/executor/load.py,sha256=WNpJmHAxXaQKPkmycsqbqeuAuiudNi-4GscmBKfdKlw,9713
9
+ qulab/executor/schedule.py,sha256=SfMZys8WdmIvfW5fPM42g-F6XwewTdpC0-puhf5TA54,11721
10
10
  qulab/executor/storage.py,sha256=M66Q5_Uc5MMfc_QAuuaaexwAz7wxBPMkeleB5nRpQmI,4621
11
11
  qulab/executor/transform.py,sha256=inaOn6eqCs22ZZ0xAQl8s8YCoEACaXSwFNNu7jqdwAk,2148
12
- qulab/executor/utils.py,sha256=n3uCSKh-qdDFFeNvOpj7_es2_B4AaC-ASAlV9gPmSO0,3086
12
+ qulab/executor/utils.py,sha256=jp3F0swO9gpKhmTauxbgEK9WVorjI9FAL6zT60cYTdk,3106
13
13
  qulab/monitor/__init__.py,sha256=nTHelnDpxRS_fl_B38TsN0njgq8eVTEz9IAnN3NbDlM,42
14
14
  qulab/monitor/__main__.py,sha256=w3yUcqq195LzSnXTkQcuC1RSFRhy4oQ_PEBmucXguME,97
15
15
  qulab/monitor/config.py,sha256=fQ5JcsMApKc1UwANEnIvbDQZl8uYW0tle92SaYtX9lI,744
@@ -89,9 +89,9 @@ qulab/visualization/plot_seq.py,sha256=UWTS6p9nfX_7B8ehcYo6UnSTUCjkBsNU9jiOeW2ca
89
89
  qulab/visualization/qdat.py,sha256=ZeevBYWkzbww4xZnsjHhw7wRorJCBzbG0iEu-XQB4EA,5735
90
90
  qulab/visualization/rot3d.py,sha256=lMrEJlRLwYe6NMBlGkKYpp_V9CTipOAuDy6QW_cQK00,734
91
91
  qulab/visualization/widgets.py,sha256=6KkiTyQ8J-ei70LbPQZAK35wjktY47w2IveOa682ftA,3180
92
- QuLab-2.4.13.dist-info/LICENSE,sha256=PRzIKxZtpQcH7whTG6Egvzl1A0BvnSf30tmR2X2KrpA,1065
93
- QuLab-2.4.13.dist-info/METADATA,sha256=oq0Nmb1rdu0TDEPYZWZ9JbWT7-qrfRIWu0osA1W3eq0,3699
94
- QuLab-2.4.13.dist-info/WHEEL,sha256=Yd3eJSBM2hj8W-ouaiMfFUwQYAS-D6P73Ob9yN5MZd0,114
95
- QuLab-2.4.13.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
96
- QuLab-2.4.13.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
97
- QuLab-2.4.13.dist-info/RECORD,,
92
+ QuLab-2.4.14.dist-info/LICENSE,sha256=PRzIKxZtpQcH7whTG6Egvzl1A0BvnSf30tmR2X2KrpA,1065
93
+ QuLab-2.4.14.dist-info/METADATA,sha256=TThc_IP0lzmpuuWgCsvPExFvPQ7a-to9Zscte5sjtq8,3699
94
+ QuLab-2.4.14.dist-info/WHEEL,sha256=Yd3eJSBM2hj8W-ouaiMfFUwQYAS-D6P73Ob9yN5MZd0,114
95
+ QuLab-2.4.14.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
96
+ QuLab-2.4.14.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
97
+ QuLab-2.4.14.dist-info/RECORD,,
qulab/executor/load.py CHANGED
@@ -136,7 +136,7 @@ def find_unreferenced_workflows(path: str) -> list[str]:
136
136
  except ValueError:
137
137
  continue
138
138
 
139
- module = load_workflow_from_module(str(rel_path), root)
139
+ module = load_workflow_from_file(str(rel_path), root)
140
140
 
141
141
  if is_workflow(module):
142
142
  rel_str = str(rel_path)
@@ -147,7 +147,7 @@ def find_unreferenced_workflows(path: str) -> list[str]:
147
147
 
148
148
  # Check dependencies for each workflow module
149
149
  for rel_str in workflows:
150
- module = load_workflow_from_module(rel_str, root)
150
+ module = load_workflow_from_file(rel_str, root)
151
151
 
152
152
  depends_func = getattr(module, "depends", None)
153
153
  if depends_func and callable(depends_func):
@@ -157,7 +157,9 @@ def find_unreferenced_workflows(path: str) -> list[str]:
157
157
  )
158
158
  continue
159
159
  try:
160
- depends_list = [n.__workflow_id__ for n in get_dependents(module, root)]
160
+ depends_list = [
161
+ n.__workflow_id__ for n in get_dependents(module, root)
162
+ ]
161
163
  except Exception as e:
162
164
  warnings.warn(f"Error calling depends() in {rel_str}: {e}")
163
165
  continue
@@ -183,9 +185,9 @@ def find_unreferenced_workflows(path: str) -> list[str]:
183
185
  return unreferenced
184
186
 
185
187
 
186
- def load_workflow_from_module(file_name: str,
187
- base_path: str | Path,
188
- package='workflows') -> WorkflowType:
188
+ def load_workflow_from_file(file_name: str,
189
+ base_path: str | Path,
190
+ package='workflows') -> WorkflowType:
189
191
  if file_name.startswith('cfg:'):
190
192
  return SetConfigWorkflow(file_name[4:])
191
193
  base_path = Path(base_path)
@@ -217,7 +219,23 @@ def load_workflow_from_template(file_name: str,
217
219
 
218
220
  with open(base_path / path) as f:
219
221
  content = f.read()
220
- template = string.Template(content)
222
+
223
+ def replace(text):
224
+ """
225
+ 将给定文本中的所有 _D_("var") 替换为 ${var}。
226
+
227
+ Args:
228
+ text (str): 包含 _D_ 调用的字符串。
229
+
230
+ Returns:
231
+ str: 已经替换的新字符串。
232
+ """
233
+ pattern = re.compile(r'_D_\s*\(\s*(["\'])(\w+)\1\s*\)')
234
+ replacement = r'${\2}'
235
+ new_text = re.sub(pattern, replacement, text)
236
+ return new_text
237
+
238
+ template = string.Template(replace(content))
221
239
  content = template.substitute(mappping)
222
240
 
223
241
  hash_str = hashlib.md5(pickle.dumps(mappping)).hexdigest()[:8]
@@ -234,10 +252,12 @@ def load_workflow_from_template(file_name: str,
234
252
  path = path.parent / path.stem.replace('_template',
235
253
  f'_{subtitle}.py')
236
254
 
237
- with open(base_path / path, 'w') as f:
238
- f.write(content)
255
+ file = base_path / path
256
+ if not file.exists():
257
+ with open(file, 'w') as f:
258
+ f.write(content)
239
259
 
240
- module = load_workflow_from_module(str(path), base_path, package)
260
+ module = load_workflow_from_file(str(path), base_path, package)
241
261
 
242
262
  return module
243
263
 
@@ -263,7 +283,7 @@ def load_workflow(workflow: str | tuple[str, dict],
263
283
  w = SetConfigWorkflow(key)
264
284
  w.__workflow_id__ = workflow
265
285
  else:
266
- w = load_workflow_from_module(workflow, base_path, package)
286
+ w = load_workflow_from_file(workflow, base_path, package)
267
287
  w.__workflow_id__ = str(Path(w.__file__).relative_to(base_path))
268
288
  else:
269
289
  raise TypeError(f"Invalid workflow: {workflow}")
@@ -289,8 +289,9 @@ def run(workflow: WorkflowType,
289
289
  code_path: str | Path,
290
290
  state_path: str | Path,
291
291
  plot: bool = False):
292
+ session_id = uuid.uuid4().hex
292
293
  logger.debug(f'run "{workflow.__workflow_id__}" without dependences.')
293
- result = calibrate(workflow, code_path, state_path, plot)
294
+ result = calibrate(workflow, code_path, state_path, plot, session_id=session_id)
294
295
  if result.bad_data or not result.in_spec:
295
296
  raise CalibrationFailedError(
296
297
  f'"{workflow.__workflow_id__}": All dependents passed, but calibration failed!'
qulab/executor/utils.py CHANGED
@@ -34,6 +34,8 @@ def workflow_template(deps: list[str]) -> str:
34
34
  return f"""
35
35
  from loguru import logger
36
36
 
37
+ def _D_(s): pass
38
+
37
39
  import numpy as np
38
40
 
39
41
 
Binary file
qulab/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.4.13"
1
+ __version__ = "2.4.14"
File without changes