QuLab 2.7.14__cp310-cp310-win_amd64.whl → 2.7.15__cp310-cp310-win_amd64.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.15"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: QuLab
3
- Version: 2.7.14
3
+ Version: 2.7.15
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=RZme5maBSMZpP6ckXymqZpo2sRYttwEpTYCIzIvys1c,292
2
2
  qulab/__main__.py,sha256=FL4YsGZL1jEtmcPc5WbleArzhOHLMsWl7OH3O-1d1ss,72
3
3
  qulab/dicttree.py,sha256=ZoSJVWK4VMqfzj42gPb_n5RqLlM6K1Me0WmLIfLEYf8,14195
4
- qulab/fun.cp310-win_amd64.pyd,sha256=zx3KbueCm9OWr7QSEemnVlp-TWgYAYnanm5MiJUeCVo,31744
4
+ qulab/fun.cp310-win_amd64.pyd,sha256=5qV_rUSckfimqMj349fvZ8dV_Yyh5it3yIQD3I3gjF0,31744
5
5
  qulab/typing.py,sha256=PRtwbCHWY2ROKK8GHq4Bo8llXrIGo6xC73DrQf7S9os,71
6
6
  qulab/utils.py,sha256=UyZNPIyvis5t2MJBkXXLO5EmYP3mQZbt87zmYAHgoyk,1291
7
- qulab/version.py,sha256=EOaPKhakr_sGt3kyeAuC9YO4wdeUpBRH8qGbweYomv8,22
7
+ qulab/version.py,sha256=-hKvJfKSrJwPY8gXyRBQzkjU0b1wKGMX2qCqb_6ZsJU,22
8
8
  qulab/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
9
9
  qulab/cli/commands.py,sha256=6xd2eYw32k1NmfAuYSu__1kaP12Oz1QVqwbkYXdWno4,588
10
10
  qulab/cli/config.py,sha256=7h3k0K8FYHhI6LVWt8BoDdKrX2ApFDBAUAUuXhHwst4,3799
@@ -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=QlbZHUbz2QXqddyn081PPSfGCtpcejhYwZfaxSB_934,7037
16
+ qulab/executor/template.py,sha256=bKMoOBPfa3XMgTfGHQK6pDTswH1vcIjnopaWE3UKpP0,7726
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=xEVDkJF8issrsDeLqQmDsvtRmrf-UiViFcGTWuzdlFU,43
@@ -97,9 +97,9 @@ qulab/visualization/plot_seq.py,sha256=Uo1-dB1YE9IN_A9tuaOs9ZG3S5dKDQ_l98iD2Wbxp
97
97
  qulab/visualization/qdat.py,sha256=HubXFu4nfcA7iUzghJGle1C86G6221hicLR0b-GqhKQ,5887
98
98
  qulab/visualization/rot3d.py,sha256=jGHJcqj1lEWBUV-W4GUGONGacqjrYvuFoFCwPse5h1Y,757
99
99
  qulab/visualization/widgets.py,sha256=HcYwdhDtLreJiYaZuN3LfofjJmZcLwjMfP5aasebgDo,3266
100
- qulab-2.7.14.dist-info/LICENSE,sha256=b4NRQ-GFVpJMT7RuExW3NwhfbrYsX7AcdB7Gudok-fs,1086
101
- qulab-2.7.14.dist-info/METADATA,sha256=9bP1TvO4ZNPZuti43kpgXSV8GOKe7y23zFKR6G5ERto,3804
102
- qulab-2.7.14.dist-info/WHEEL,sha256=gMSPBFjPynvgFG2ofmeEoM1Uf9iH_GsJd2JBy-bxpiQ,101
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.15.dist-info/LICENSE,sha256=b4NRQ-GFVpJMT7RuExW3NwhfbrYsX7AcdB7Gudok-fs,1086
101
+ qulab-2.7.15.dist-info/METADATA,sha256=TX9LtH1PNfK8hz2Efdf2smnPtC0l2U4YHZxB_QCs3xA,3804
102
+ qulab-2.7.15.dist-info/WHEEL,sha256=gMSPBFjPynvgFG2ofmeEoM1Uf9iH_GsJd2JBy-bxpiQ,101
103
+ qulab-2.7.15.dist-info/entry_points.txt,sha256=b0v1GXOwmxY-nCCsPN_rHZZvY9CtTbWqrGj8u1m8yHo,45
104
+ qulab-2.7.15.dist-info/top_level.txt,sha256=3T886LbAsbvjonu_TDdmgxKYUn939BVTRPxPl9r4cEg,6
105
+ qulab-2.7.15.dist-info/RECORD,,
File without changes