json-repair 0.52.4__py3-none-any.whl → 0.52.5__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.
- json_repair/json_parser.py +25 -16
- {json_repair-0.52.4.dist-info → json_repair-0.52.5.dist-info}/METADATA +1 -1
- {json_repair-0.52.4.dist-info → json_repair-0.52.5.dist-info}/RECORD +7 -7
- {json_repair-0.52.4.dist-info → json_repair-0.52.5.dist-info}/WHEEL +0 -0
- {json_repair-0.52.4.dist-info → json_repair-0.52.5.dist-info}/entry_points.txt +0 -0
- {json_repair-0.52.4.dist-info → json_repair-0.52.5.dist-info}/licenses/LICENSE +0 -0
- {json_repair-0.52.4.dist-info → json_repair-0.52.5.dist-info}/top_level.txt +0 -0
json_repair/json_parser.py
CHANGED
|
@@ -158,23 +158,32 @@ class JSONParser:
|
|
|
158
158
|
|
|
159
159
|
def skip_to_character(self, character: str | list[str], idx: int = 0) -> int:
|
|
160
160
|
"""
|
|
161
|
-
|
|
161
|
+
Advance from (self.index + idx) until we hit an *unescaped* target character.
|
|
162
|
+
Returns the offset (idx) from self.index to that position, or the distance to the end if not found.
|
|
162
163
|
"""
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
while
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
164
|
+
targets = set(character) if isinstance(character, list) else {character}
|
|
165
|
+
i = self.index + idx
|
|
166
|
+
n = len(self.json_str)
|
|
167
|
+
backslashes = 0 # count of consecutive '\' immediately before current char
|
|
168
|
+
|
|
169
|
+
while i < n:
|
|
170
|
+
ch = self.json_str[i]
|
|
171
|
+
|
|
172
|
+
if ch == "\\":
|
|
173
|
+
backslashes += 1
|
|
174
|
+
i += 1
|
|
175
|
+
continue
|
|
176
|
+
|
|
177
|
+
# ch is not a backslash; if it's a target and not escaped (even backslashes), we're done
|
|
178
|
+
if ch in targets and (backslashes % 2 == 0):
|
|
179
|
+
return i - self.index
|
|
180
|
+
|
|
181
|
+
# reset backslash run when we see a non-backslash
|
|
182
|
+
backslashes = 0
|
|
183
|
+
i += 1
|
|
184
|
+
|
|
185
|
+
# not found; return distance to end
|
|
186
|
+
return n - self.index
|
|
178
187
|
|
|
179
188
|
def _log(self, text: str) -> None:
|
|
180
189
|
window: int = 10
|
|
@@ -2,7 +2,7 @@ json_repair/__init__.py,sha256=JdJIZNCKV3MfIviryqK8NH8yGssCta2-192CekcwH-o,174
|
|
|
2
2
|
json_repair/__main__.py,sha256=EsJb-y89uZEvGQQg1GdIDWzfDwfOMvVekKEtdguQXCM,67
|
|
3
3
|
json_repair/constants.py,sha256=cv2gvyosuq0me0600WyTysM9avrtfXPuXYR26tawcuo,158
|
|
4
4
|
json_repair/json_context.py,sha256=WsMOjqpGSr6aaDONcrk8UFtTurzWon2Qq9AoBBYseoI,934
|
|
5
|
-
json_repair/json_parser.py,sha256=
|
|
5
|
+
json_repair/json_parser.py,sha256=vy5Z8aiJUVhVmvYEgy0dkYy5WgUmyOeS6PEFiR3cW44,7948
|
|
6
6
|
json_repair/json_repair.py,sha256=sDhXzDZxu0QmaFzICPTtf_q7yOY1A1Lf_iQG6Potsco,11572
|
|
7
7
|
json_repair/object_comparer.py,sha256=XKV3MRab8H7_v4sm-wpEa5le0XX9OeycWo5S-MFm-GI,1716
|
|
8
8
|
json_repair/parse_array.py,sha256=-rh65JcfT-FtXiR6s8RYlMfI-6LzVr08ytlDh6Z2CFE,2181
|
|
@@ -13,9 +13,9 @@ json_repair/parse_object.py,sha256=xMpO64sYW0JmUtW75BTD0EdPQjY7PYVgu4tHVXrWB6s,5
|
|
|
13
13
|
json_repair/parse_string.py,sha256=banF0nNbONvO4C_SDQMDuCZO99UIQvKzRVki9xWVpfU,25686
|
|
14
14
|
json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
15
15
|
json_repair/string_file_wrapper.py,sha256=tGkWBEUPE-CZPf4uSM5NE9oSDTpskX0myJiXsl-gbds,4333
|
|
16
|
-
json_repair-0.52.
|
|
17
|
-
json_repair-0.52.
|
|
18
|
-
json_repair-0.52.
|
|
19
|
-
json_repair-0.52.
|
|
20
|
-
json_repair-0.52.
|
|
21
|
-
json_repair-0.52.
|
|
16
|
+
json_repair-0.52.5.dist-info/licenses/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
|
|
17
|
+
json_repair-0.52.5.dist-info/METADATA,sha256=KcP9eWpjKssTAXdp8VSyVzzRnCgpGmK6AcdBnlZAT84,11027
|
|
18
|
+
json_repair-0.52.5.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
19
|
+
json_repair-0.52.5.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
|
|
20
|
+
json_repair-0.52.5.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
|
|
21
|
+
json_repair-0.52.5.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|