json-repair 0.47.8__py3-none-any.whl → 0.48.0__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.
@@ -213,8 +213,7 @@ def parse_string(self: "JSONParser") -> str | bool | None:
213
213
  while char and string_acc[-1] == "\\" and char in [rstring_delimiter, "\\"]:
214
214
  # this is a bit of a special case, if I don't do this it will close the loop or create a train of \\
215
215
  # I don't love it though
216
- string_acc = string_acc[:-1]
217
- string_acc += char
216
+ string_acc = string_acc[:-1] + char
218
217
  self.index += 1
219
218
  char = self.get_char_at()
220
219
  continue
@@ -224,11 +223,16 @@ def parse_string(self: "JSONParser") -> str | bool | None:
224
223
  next_chars = self.json_str[self.index + 1 : self.index + 1 + num_chars]
225
224
  if len(next_chars) == num_chars and all(c in "0123456789abcdefABCDEF" for c in next_chars):
226
225
  self.log("Found a unicode escape sequence, normalizing it")
227
- string_acc = string_acc[:-1]
228
- string_acc += chr(int(next_chars, 16))
226
+ string_acc = string_acc[:-1] + chr(int(next_chars, 16))
229
227
  self.index += 1 + num_chars
230
228
  char = self.get_char_at()
231
229
  continue
230
+ elif char in STRING_DELIMITERS and char != rstring_delimiter:
231
+ self.log("Found a delimiter that was escaped but shouldn't be escaped, removing the escape")
232
+ string_acc = string_acc[:-1] + char
233
+ self.index += 1
234
+ char = self.get_char_at()
235
+ continue
232
236
  # If we are in object key context and we find a colon, it could be a missing right quote
233
237
  if char == ":" and not missing_quotes and self.context.current == ContextValues.OBJECT_KEY:
234
238
  # Ok now we need to check if this is followed by a value like "..."
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_repair
3
- Version: 0.47.8
3
+ Version: 0.48.0
4
4
  Summary: A package to repair broken json strings
5
5
  Author-email: Stefano Baccianella <4247706+mangiucugna@users.noreply.github.com>
6
6
  License: MIT License
@@ -10,12 +10,12 @@ json_repair/parse_boolean_or_null.py,sha256=WMSkvvxsp4wvauBcDqtt9WnLMD5SMoxeRfZF
10
10
  json_repair/parse_comment.py,sha256=JHtQ_QlxOvPNnMh7lhUaoTjFGelqjhTNq7qn9xUE7SU,2648
11
11
  json_repair/parse_number.py,sha256=33zAtkbuVzi9Lqjxu7cXn9WlVzd3WjRx9Ln_LFzVL4o,1259
12
12
  json_repair/parse_object.py,sha256=UzkY0C5NSE2CtVnZwugMyhhtUJPgs0MwBb4kF4l2ftU,4563
13
- json_repair/parse_string.py,sha256=QTMHdc9_tLwzFwYMVrSJbkWoeV6-mQK7e2RDbJR_JJM,22677
13
+ json_repair/parse_string.py,sha256=Ju1txvEWrOQnncigBOnlkEdVwXYGz4jaKr9QOpjAx5o,22947
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.47.8.dist-info/licenses/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
17
- json_repair-0.47.8.dist-info/METADATA,sha256=S63nu7L4zgNPB3HzlA4uaJtb3204R_b1pCAUrShwyjU,12411
18
- json_repair-0.47.8.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
- json_repair-0.47.8.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
20
- json_repair-0.47.8.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
21
- json_repair-0.47.8.dist-info/RECORD,,
16
+ json_repair-0.48.0.dist-info/licenses/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
17
+ json_repair-0.48.0.dist-info/METADATA,sha256=--ltEVHVgM9Jh9wxa--Ad22rM34kXNO5faj1oHtBIO8,12411
18
+ json_repair-0.48.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
19
+ json_repair-0.48.0.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
20
+ json_repair-0.48.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
21
+ json_repair-0.48.0.dist-info/RECORD,,