json-repair 0.54__py3-none-any.whl → 0.54.2__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.
@@ -84,10 +84,13 @@ class JSONParser:
84
84
  while self.index < len(self.json_str):
85
85
  self.context.reset()
86
86
  j = self.parse_json()
87
- if j != "":
87
+ if j:
88
88
  if ObjectComparer.is_same_object(json[-1], j):
89
89
  # replace the last entry with the new one since the new one seems an update
90
90
  json.pop()
91
+ else:
92
+ if not json[-1]:
93
+ json.pop()
91
94
  json.append(j)
92
95
  else:
93
96
  # this was a bust, move the index
@@ -3,7 +3,7 @@ from typing import TYPE_CHECKING
3
3
  from .utils.constants import JSONReturnType
4
4
  from .utils.json_context import ContextValues
5
5
 
6
- NUMBER_CHARS: set[str] = set("0123456789-.eE/,")
6
+ NUMBER_CHARS: set[str] = set("0123456789-.eE/,_")
7
7
 
8
8
 
9
9
  if TYPE_CHECKING:
@@ -16,7 +16,8 @@ def parse_number(self: "JSONParser") -> JSONReturnType:
16
16
  char = self.get_char_at()
17
17
  is_array = self.context.current == ContextValues.ARRAY
18
18
  while char and char in NUMBER_CHARS and (not is_array or char != ","):
19
- number_str += char
19
+ if char != "_":
20
+ number_str += char
20
21
  self.index += 1
21
22
  char = self.get_char_at()
22
23
  if number_str and number_str[-1] in "-eE/,":
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_repair
3
- Version: 0.54
3
+ Version: 0.54.2
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-Expression: MIT
@@ -1,10 +1,10 @@
1
1
  json_repair/__init__.py,sha256=JQ4Nm8YzR8Id2a527Ql0Az-rKapTp8DCMPKybLtQ620,180
2
2
  json_repair/__main__.py,sha256=EsJb-y89uZEvGQQg1GdIDWzfDwfOMvVekKEtdguQXCM,67
3
- json_repair/json_parser.py,sha256=nATFDlcEnPD8G2NDSKj2nme_v1la_cCcFZrdQvEjTZs,8495
3
+ json_repair/json_parser.py,sha256=1C24BNRNOg-hwJzLsCWuW75xYctm0haSynrDsGCy3d8,8595
4
4
  json_repair/json_repair.py,sha256=iT-OJgpBnKUJVIV4IUlXmMUkOyW6bNnKCZLB7Fys8hk,12758
5
5
  json_repair/parse_array.py,sha256=rZfnRiS86vBATOUHqSx2T5fE79Ndlk2NoTsg9Wek7l4,2239
6
6
  json_repair/parse_comment.py,sha256=MUDxrx8BFfAaKvx6x4gWviJNvwRi2yv5qnrR6honmas,2660
7
- json_repair/parse_number.py,sha256=Ddv3Dih1VYfdasUe5DxQWAqy7YAE3aZJ7iePCfdi1EQ,1292
7
+ json_repair/parse_number.py,sha256=XCx5ygGuliFn0T9sFqTFggTrDMNlV2uAIE2PYdt5Hao,1321
8
8
  json_repair/parse_object.py,sha256=noaiP10kzl-jA-1jc6tMmtFoJMIputpB3zFxcAuYQvY,6986
9
9
  json_repair/parse_string.py,sha256=L4McLWzRkbW_7Xx_hSGOmfpoPMwbYTGEKBAjqwanLEs,26146
10
10
  json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -14,9 +14,9 @@ json_repair/utils/constants.py,sha256=cv2gvyosuq0me0600WyTysM9avrtfXPuXYR26tawcu
14
14
  json_repair/utils/json_context.py,sha256=WsMOjqpGSr6aaDONcrk8UFtTurzWon2Qq9AoBBYseoI,934
15
15
  json_repair/utils/object_comparer.py,sha256=XKV3MRab8H7_v4sm-wpEa5le0XX9OeycWo5S-MFm-GI,1716
16
16
  json_repair/utils/string_file_wrapper.py,sha256=Zlm0ZfJAw_VPlIy-QldL_OKYrPk3TYGq1JVAFPv7SnQ,6862
17
- json_repair-0.54.dist-info/licenses/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
18
- json_repair-0.54.dist-info/METADATA,sha256=xoD5G1EZ7muIRVbzdjsgD10OQbxS-K06sNGqlNDvvdQ,12220
19
- json_repair-0.54.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
- json_repair-0.54.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
21
- json_repair-0.54.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
22
- json_repair-0.54.dist-info/RECORD,,
17
+ json_repair-0.54.2.dist-info/licenses/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
18
+ json_repair-0.54.2.dist-info/METADATA,sha256=veZ0in3wmnzG3BzWsiTjSMd2GvPbFbwn6nC9Vimw0II,12222
19
+ json_repair-0.54.2.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
20
+ json_repair-0.54.2.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
21
+ json_repair-0.54.2.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
22
+ json_repair-0.54.2.dist-info/RECORD,,