QuLab 2.7.14__cp310-cp310-macosx_10_9_universal2.whl → 2.7.16__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.
@@ -121,7 +121,10 @@ def inject_mapping(source: str, mapping: dict[str, Any],
121
121
  hash_str, mapping_code = encode_mapping(mapping)
122
122
 
123
123
  tree = ast.parse(source)
124
+
124
125
  lines = source.splitlines()
126
+ lines_offset = [0 for _ in range(len(lines))]
127
+
125
128
  extractor = TemplateVarExtractor(fname, mapping)
126
129
  extractor.visit(tree)
127
130
 
@@ -134,8 +137,10 @@ def inject_mapping(source: str, mapping: dict[str, Any],
134
137
  for (lineno, end_lineno, col_offset,
135
138
  end_col_offset), (kind, name, old_source,
136
139
  new_source) in extractor.replacements.items():
137
- head = lines[lineno - 1][:col_offset]
138
- tail = lines[end_lineno - 1][end_col_offset:]
140
+ head = lines[lineno - 1][:col_offset + lines_offset[lineno - 1]]
141
+ tail = lines[end_lineno - 1][end_col_offset +
142
+ lines_offset[end_lineno - 1]:]
143
+ length_of_last_line = len(lines[end_lineno - 1])
139
144
  content = lines[lineno - 1:end_lineno]
140
145
  content[0] = content[0].removeprefix(head)
141
146
  content[-1] = content[-1].removesuffix(tail)
@@ -148,8 +153,12 @@ def inject_mapping(source: str, mapping: dict[str, Any],
148
153
  formated_lines[-1] = formated_lines[-1] + tail
149
154
  if len(formated_lines) == 1:
150
155
  lines[lineno - 1] = formated_lines[0]
156
+ lines_offset[lineno -
157
+ 1] += len(lines[lineno - 1]) - length_of_last_line
151
158
  else:
152
159
  lines[lineno - 1:end_lineno] = formated_lines
160
+ lines_offset[end_lineno - 1] += len(
161
+ lines[end_lineno - 1]) - length_of_last_line
153
162
  else:
154
163
  pattern = re.compile(r'VAR\s*\(\s*(["\'])(\w+)\1\s*\)')
155
164
  replacement = f'__VAR_{hash_str}' + r'[\1\2\1]'
@@ -157,11 +166,15 @@ def inject_mapping(source: str, mapping: dict[str, Any],
157
166
 
158
167
  if lineno == end_lineno:
159
168
  lines[lineno - 1] = head + new_content + tail
169
+ lines_offset[lineno -
170
+ 1] += len(lines[lineno - 1]) - length_of_last_line
160
171
  else:
161
172
  lines[lineno - 1] = head + new_content[:-1]
162
173
  for i in range(lineno, end_lineno - 1):
163
174
  lines[i] = ''
164
175
  lines[end_lineno - 1] = ']' + tail
176
+ lines_offset[end_lineno - 1] += len(
177
+ lines[end_lineno - 1]) - length_of_last_line
165
178
 
166
179
  injected_code = '\n'.join([
167
180
  f"__QULAB_TEMPLATE__ = \"{fname}\"",
Binary file
qulab/version.py CHANGED
@@ -1 +1 @@
1
- __version__ = "2.7.14"
1
+ __version__ = "2.7.16"
@@ -388,7 +388,7 @@ def fill_layout(layout,
388
388
  else:
389
389
  layout['couplers'][coupler]['color'] = coupler_color
390
390
  if coupler_color is None:
391
- layout['couplers'][qubit]['lw'] = lw
391
+ layout['couplers'][coupler]['lw'] = lw
392
392
  layout['couplers'][coupler]['width'] = params[coupler].get(
393
393
  'width', coupler_size)
394
394
  layout['couplers'][coupler]['fontsize'] = params[coupler].get(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: QuLab
3
- Version: 2.7.14
3
+ Version: 2.7.16
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,10 +1,10 @@
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=W3aT6qUPlf85MH8KLthi351XlYytLc35x_Of3F_uSoY,126864
4
+ qulab/fun.cpython-310-darwin.so,sha256=z9KWbgRHNE0efjDgP-cO_sIBkFG2ZYGqYJjy4HkMpyo,126864
5
5
  qulab/typing.py,sha256=vg62sGqxuD9CI5677ejlzAmf2fVdAESZCQjAE_xSxPg,69
6
6
  qulab/utils.py,sha256=JIXMSmZU0uYfKG_tzawpK7vRNPRir_hJE8JlqkVLX2o,1260
7
- qulab/version.py,sha256=EOaPKhakr_sGt3kyeAuC9YO4wdeUpBRH8qGbweYomv8,22
7
+ qulab/version.py,sha256=FfSt311ISmWzNzgm6bVcGXURtNc74jJ8EU8zuODbm0g,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
@@ -13,7 +13,7 @@ qulab/executor/cli.py,sha256=z8W1RivKdABQSOGy2viNUvG73QvOBpE9gSKjw45vSVA,9794
13
13
  qulab/executor/load.py,sha256=_Zn4wtGGD8pBZwOfbJaaFVAr8riY2Bkhi67lX9Jy-hA,17427
14
14
  qulab/executor/schedule.py,sha256=9pTOVWzKiDc7ip8iuB_47poJcYOvoBI9eQwTrDTA3p0,19044
15
15
  qulab/executor/storage.py,sha256=gI6g28BmKKEZ_Pl-hFwvpiOj3mF8Su-yjj3hfMXs1VY,11630
16
- qulab/executor/template.py,sha256=goHwfPJsR_Zbc-YopRwDaBXBL_7myLmwwXmjQ-ykPbk,6864
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
19
19
  qulab/monitor/__init__.py,sha256=nTHelnDpxRS_fl_B38TsN0njgq8eVTEz9IAnN3NbDlM,42
@@ -92,14 +92,14 @@ qulab/visualization/__init__.py,sha256=26cuHt3QIJXUb3VaMxlJx3IQTOUVJFKlYBZr7WMP5
92
92
  qulab/visualization/__main__.py,sha256=9zKK3yZFy0leU40ou6BpRC1Fsetfc1gjjFzIZYIwP6Y,1639
93
93
  qulab/visualization/_autoplot.py,sha256=31B7pn1pK19abpQDGYBU9a_27cDL87LBpx9vKqlcYAo,14165
94
94
  qulab/visualization/plot_circ.py,sha256=qZS3auNG4qIyUvC-ijTce17xJwGBvpRvPUqPEx64KUY,8759
95
- qulab/visualization/plot_layout.py,sha256=clNw9QjE_kVNpIIx2Ob4YhAz2fucPGMuzkoIrOJo_Y8,13533
95
+ qulab/visualization/plot_layout.py,sha256=mfdKJUyjTNB3YyD6GcqM38GEwiae4g6Us9HJyAwen6Q,13535
96
96
  qulab/visualization/plot_seq.py,sha256=UWTS6p9nfX_7B8ehcYo6UnSTUCjkBsNU9jiOeW2calY,6751
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.14.dist-info/LICENSE,sha256=PRzIKxZtpQcH7whTG6Egvzl1A0BvnSf30tmR2X2KrpA,1065
101
- qulab-2.7.14.dist-info/METADATA,sha256=qN3n03Tq9bUJtk_nzhM9umjz8F5--J4DjegOIZgiNd0,3699
102
- qulab-2.7.14.dist-info/WHEEL,sha256=QgR3XCD-6bLIVi9XRH__kfiwMJXw7QeWoMWYRnaC8WY,114
103
- qulab-2.7.14.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
104
- qulab-2.7.14.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
105
- qulab-2.7.14.dist-info/RECORD,,
100
+ qulab-2.7.16.dist-info/LICENSE,sha256=PRzIKxZtpQcH7whTG6Egvzl1A0BvnSf30tmR2X2KrpA,1065
101
+ qulab-2.7.16.dist-info/METADATA,sha256=K-ApF5W09-9zYNdNKbUYx9dMa4C1vGko8TEL7FeLu2o,3699
102
+ qulab-2.7.16.dist-info/WHEEL,sha256=QgR3XCD-6bLIVi9XRH__kfiwMJXw7QeWoMWYRnaC8WY,114
103
+ qulab-2.7.16.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
104
+ qulab-2.7.16.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
105
+ qulab-2.7.16.dist-info/RECORD,,
File without changes