json-repair 0.30.2__tar.gz → 0.30.3__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.30.2/src/json_repair.egg-info → json_repair-0.30.3}/PKG-INFO +1 -1
  2. {json_repair-0.30.2 → json_repair-0.30.3}/pyproject.toml +1 -1
  3. {json_repair-0.30.2 → json_repair-0.30.3}/src/json_repair/json_parser.py +7 -0
  4. {json_repair-0.30.2 → json_repair-0.30.3/src/json_repair.egg-info}/PKG-INFO +1 -1
  5. {json_repair-0.30.2 → json_repair-0.30.3}/tests/test_json_repair.py +1 -0
  6. {json_repair-0.30.2 → json_repair-0.30.3}/tests/test_performance.py +1 -1
  7. {json_repair-0.30.2 → json_repair-0.30.3}/LICENSE +0 -0
  8. {json_repair-0.30.2 → json_repair-0.30.3}/README.md +0 -0
  9. {json_repair-0.30.2 → json_repair-0.30.3}/setup.cfg +0 -0
  10. {json_repair-0.30.2 → json_repair-0.30.3}/src/json_repair/__init__.py +0 -0
  11. {json_repair-0.30.2 → json_repair-0.30.3}/src/json_repair/__main__.py +0 -0
  12. {json_repair-0.30.2 → json_repair-0.30.3}/src/json_repair/json_context.py +0 -0
  13. {json_repair-0.30.2 → json_repair-0.30.3}/src/json_repair/json_repair.py +0 -0
  14. {json_repair-0.30.2 → json_repair-0.30.3}/src/json_repair/py.typed +0 -0
  15. {json_repair-0.30.2 → json_repair-0.30.3}/src/json_repair/string_file_wrapper.py +0 -0
  16. {json_repair-0.30.2 → json_repair-0.30.3}/src/json_repair.egg-info/SOURCES.txt +0 -0
  17. {json_repair-0.30.2 → json_repair-0.30.3}/src/json_repair.egg-info/dependency_links.txt +0 -0
  18. {json_repair-0.30.2 → json_repair-0.30.3}/src/json_repair.egg-info/entry_points.txt +0 -0
  19. {json_repair-0.30.2 → json_repair-0.30.3}/src/json_repair.egg-info/top_level.txt +0 -0
  20. {json_repair-0.30.2 → json_repair-0.30.3}/tests/test_coverage.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.30.2
3
+ Version: 0.30.3
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.30.2"
6
+ version = "0.30.3"
7
7
  license = {file = "LICENSE"}
8
8
  authors = [
9
9
  { name="Stefano Baccianella", email="4247706+mangiucugna@users.noreply.github.com" },
@@ -362,6 +362,13 @@ class JSONParser:
362
362
  "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",
363
363
  )
364
364
  break
365
+ if char == "]" and ContextValues.ARRAY in self.context.context:
366
+ # We found the end of an array and we are in array context
367
+ # So let's check if we find a rstring_delimiter forward otherwise end early
368
+ i = self.skip_to_character(rstring_delimiter)
369
+ if not self.get_char_at(i):
370
+ # No delimiter found
371
+ break
365
372
  string_acc += char
366
373
  self.index += 1
367
374
  char = self.get_char_at()
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.30.2
3
+ Version: 0.30.3
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
@@ -119,6 +119,7 @@ def test_array_edge_cases():
119
119
  assert repair_json('{"employees":["John", "Anna",') == '{"employees": ["John", "Anna"]}'
120
120
  assert repair_json('{"employees":["John", "Anna", "Peter') == '{"employees": ["John", "Anna", "Peter"]}'
121
121
  assert repair_json('{"key1": {"key2": [1, 2, 3') == '{"key1": {"key2": [1, 2, 3]}}'
122
+ assert repair_json('{"key": ["value]}') == '{"key": ["value"]}'
122
123
 
123
124
  def test_escaping():
124
125
  assert repair_json("'\"'") == '""'
@@ -97,7 +97,7 @@ def test_false_false_incorrect(benchmark):
97
97
  mean_time = benchmark.stats.get("median")
98
98
 
99
99
  # Define your time threshold in seconds
100
- max_time = 1.8 / 10 ** 3 # 1.8 millisecond
100
+ max_time = 1.9 / 10 ** 3 # 1.9 millisecond
101
101
 
102
102
  # Assert that the average time is below the threshold
103
103
  assert mean_time < max_time, f"Benchmark exceeded threshold: {mean_time:.3f}s > {max_time:.3f}s"
File without changes
File without changes
File without changes