json-repair 0.29.10__tar.gz → 0.30.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (20) hide show
  1. {json_repair-0.29.10/src/json_repair.egg-info → json_repair-0.30.0}/PKG-INFO +1 -1
  2. {json_repair-0.29.10 → json_repair-0.30.0}/pyproject.toml +1 -1
  3. {json_repair-0.29.10 → json_repair-0.30.0}/src/json_repair/json_parser.py +12 -2
  4. {json_repair-0.29.10 → json_repair-0.30.0}/src/json_repair/json_repair.py +3 -2
  5. {json_repair-0.29.10 → json_repair-0.30.0/src/json_repair.egg-info}/PKG-INFO +1 -1
  6. {json_repair-0.29.10 → json_repair-0.30.0}/tests/test_json_repair.py +2 -0
  7. {json_repair-0.29.10 → json_repair-0.30.0}/LICENSE +0 -0
  8. {json_repair-0.29.10 → json_repair-0.30.0}/README.md +0 -0
  9. {json_repair-0.29.10 → json_repair-0.30.0}/setup.cfg +0 -0
  10. {json_repair-0.29.10 → json_repair-0.30.0}/src/json_repair/__init__.py +3 -3
  11. {json_repair-0.29.10 → json_repair-0.30.0}/src/json_repair/__main__.py +0 -0
  12. {json_repair-0.29.10 → json_repair-0.30.0}/src/json_repair/json_context.py +0 -0
  13. {json_repair-0.29.10 → json_repair-0.30.0}/src/json_repair/py.typed +0 -0
  14. {json_repair-0.29.10 → json_repair-0.30.0}/src/json_repair/string_file_wrapper.py +0 -0
  15. {json_repair-0.29.10 → json_repair-0.30.0}/src/json_repair.egg-info/SOURCES.txt +0 -0
  16. {json_repair-0.29.10 → json_repair-0.30.0}/src/json_repair.egg-info/dependency_links.txt +0 -0
  17. {json_repair-0.29.10 → json_repair-0.30.0}/src/json_repair.egg-info/entry_points.txt +0 -0
  18. {json_repair-0.29.10 → json_repair-0.30.0}/src/json_repair.egg-info/top_level.txt +0 -0
  19. {json_repair-0.29.10 → json_repair-0.30.0}/tests/test_coverage.py +0 -0
  20. {json_repair-0.29.10 → json_repair-0.30.0}/tests/test_performance.py +0 -0
@@ -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
@@ -3,7 +3,7 @@ requires = ["setuptools>=61.0"]
3
3
  build-backend = "setuptools.build_meta"
4
4
  [project]
5
5
  name = "json_repair"
6
- version = "0.29.10"
6
+ version = "0.30.0"
7
7
  license = {file = "LICENSE"}
8
8
  authors = [
9
9
  { name="Stefano Baccianella", email="4247706+mangiucugna@users.noreply.github.com" },
@@ -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
@@ -146,6 +146,8 @@ def test_object_edge_cases():
146
146
  assert repair_json('{"key":value, " key2":"value2" }') == '{"key": "value", " key2": "value2"}'
147
147
  assert repair_json('{"key":value "key2":"value2" }') == '{"key": "value", "key2": "value2"}'
148
148
  assert repair_json("{'text': 'words{words in brackets}more words'}") == '{"text": "words{words in brackets}more words"}'
149
+ assert repair_json('{text:words{words in brackets}}') == '{"text": "words{words in brackets}"}'
150
+ assert repair_json('{text:words{words in brackets}m}') == '{"text": "words{words in brackets}m"}'
149
151
 
150
152
  def test_number_edge_cases():
151
153
  assert repair_json(' - { "test_key": ["test_value", "test_value2"] }') == '{"test_key": ["test_value", "test_value2"]}'
File without changes
File without changes
File without changes
@@ -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