json-repair 0.29.10__py3-none-any.whl → 0.30.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.
json_repair/__init__.py CHANGED
@@ -1,4 +1,4 @@
1
- from .json_repair import repair_json as repair_json
2
- from .json_repair import loads as loads
3
- from .json_repair import load as load
4
1
  from .json_repair import from_file as from_file
2
+ from .json_repair import load as load
3
+ from .json_repair import loads as loads
4
+ from .json_repair import repair_json as repair_json
@@ -1,7 +1,7 @@
1
- from typing import Any, Dict, List, Optional, Union, TextIO, Tuple, Literal
1
+ from typing import Any, Dict, List, Literal, Optional, TextIO, Tuple, Union
2
2
 
3
+ from .json_context import ContextValues, JsonContext
3
4
  from .string_file_wrapper import StringFileWrapper
4
- from .json_context import JsonContext, ContextValues
5
5
 
6
6
  JSONReturnType = Union[Dict[str, Any], List[Any], str, float, int, bool, None]
7
7
 
@@ -329,6 +329,16 @@ class JSONParser:
329
329
  # Ok it's not right after the comma
330
330
  # Let's ignore
331
331
  rstring_delimiter_missing = False
332
+ # Check that j was not out of bound
333
+ elif self.get_char_at(j):
334
+ # Check for an unmatched opening brace in string_acc
335
+ for c in reversed(string_acc):
336
+ if c == "{":
337
+ # Ok then this is part of the string
338
+ rstring_delimiter_missing = False
339
+ break
340
+ elif c == "}":
341
+ break
332
342
  if rstring_delimiter_missing:
333
343
  self.log(
334
344
  "While parsing a string missing the left delimiter in object value context, we found a , or } and we couldn't determine that a right delimiter was present. Stopping here",
@@ -23,9 +23,10 @@ All supported use cases are in the unit tests
23
23
  """
24
24
 
25
25
  import argparse
26
- import sys
27
26
  import json
28
- from typing import Dict, List, Optional, Union, TextIO, Tuple
27
+ import sys
28
+ from typing import Dict, List, Optional, TextIO, Tuple, Union
29
+
29
30
  from .json_parser import JSONParser, JSONReturnType
30
31
 
31
32
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.29.10
3
+ Version: 0.30.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
@@ -0,0 +1,13 @@
1
+ json_repair/__init__.py,sha256=c4L2kZrHvWEKfj_ODU2naliNuvU6FlFVxtF0hbLe6s8,178
2
+ json_repair/__main__.py,sha256=EsJb-y89uZEvGQQg1GdIDWzfDwfOMvVekKEtdguQXCM,67
3
+ json_repair/json_context.py,sha256=DdJu3DJR-ANvr8KrWfJqdtOE3uI6_B0VQidKvE3PjJA,1080
4
+ json_repair/json_parser.py,sha256=UQgXtXTRo0oLb4N7GhPAELWtS0E9zGSPBXfnnGOCgfo,27527
5
+ json_repair/json_repair.py,sha256=Er6klw5GgmdnLmNM9GXD9gfTi8Mn9cvvTUiVITFA-1E,6101
6
+ json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
+ json_repair/string_file_wrapper.py,sha256=EHLhNBWoyUitzT08thytYJiNZh_klEFwfT8zutPSdb4,3905
8
+ json_repair-0.30.0.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
9
+ json_repair-0.30.0.dist-info/METADATA,sha256=72pBek4v2f-1zqIwWXjaPcG8reqdX9zpy1dkjT9yspI,10686
10
+ json_repair-0.30.0.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
11
+ json_repair-0.30.0.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
12
+ json_repair-0.30.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
13
+ json_repair-0.30.0.dist-info/RECORD,,
@@ -1,13 +0,0 @@
1
- json_repair/__init__.py,sha256=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
2
- json_repair/__main__.py,sha256=EsJb-y89uZEvGQQg1GdIDWzfDwfOMvVekKEtdguQXCM,67
3
- json_repair/json_context.py,sha256=DdJu3DJR-ANvr8KrWfJqdtOE3uI6_B0VQidKvE3PjJA,1080
4
- json_repair/json_parser.py,sha256=C15JIu28XXpXM5U7s4uZoa_iy8eJmRubpGptX5qbr-c,26998
5
- json_repair/json_repair.py,sha256=GTg3OAXRbAJAHWs8oiQDqUHh4h6qKDVvWPXcrqafzLY,6100
6
- json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
7
- json_repair/string_file_wrapper.py,sha256=EHLhNBWoyUitzT08thytYJiNZh_klEFwfT8zutPSdb4,3905
8
- json_repair-0.29.10.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
9
- json_repair-0.29.10.dist-info/METADATA,sha256=ggtmL_tOk6LpzcdHXB-zLsYudsZima5MHQcdnprfLDc,10687
10
- json_repair-0.29.10.dist-info/WHEEL,sha256=GV9aMThwP_4oNCtvEC2ec3qUYutgWeAzklro_0m4WJQ,91
11
- json_repair-0.29.10.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
12
- json_repair-0.29.10.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
13
- json_repair-0.29.10.dist-info/RECORD,,