json-repair 0.46.0__tar.gz → 0.46.1__tar.gz

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.
Files changed (20) hide show
  1. {json_repair-0.46.0/src/json_repair.egg-info → json_repair-0.46.1}/PKG-INFO +3 -2
  2. {json_repair-0.46.0 → json_repair-0.46.1}/README.md +2 -1
  3. {json_repair-0.46.0 → json_repair-0.46.1}/pyproject.toml +3 -3
  4. {json_repair-0.46.0 → json_repair-0.46.1}/src/json_repair/json_parser.py +4 -1
  5. {json_repair-0.46.0 → json_repair-0.46.1}/src/json_repair/object_comparer.py +1 -1
  6. {json_repair-0.46.0 → json_repair-0.46.1/src/json_repair.egg-info}/PKG-INFO +3 -2
  7. {json_repair-0.46.0 → json_repair-0.46.1}/tests/test_performance.py +6 -6
  8. {json_repair-0.46.0 → json_repair-0.46.1}/LICENSE +0 -0
  9. {json_repair-0.46.0 → json_repair-0.46.1}/setup.cfg +0 -0
  10. {json_repair-0.46.0 → json_repair-0.46.1}/src/json_repair/__init__.py +0 -0
  11. {json_repair-0.46.0 → json_repair-0.46.1}/src/json_repair/__main__.py +0 -0
  12. {json_repair-0.46.0 → json_repair-0.46.1}/src/json_repair/json_context.py +0 -0
  13. {json_repair-0.46.0 → json_repair-0.46.1}/src/json_repair/json_repair.py +0 -0
  14. {json_repair-0.46.0 → json_repair-0.46.1}/src/json_repair/py.typed +0 -0
  15. {json_repair-0.46.0 → json_repair-0.46.1}/src/json_repair/string_file_wrapper.py +0 -0
  16. {json_repair-0.46.0 → json_repair-0.46.1}/src/json_repair.egg-info/SOURCES.txt +0 -0
  17. {json_repair-0.46.0 → json_repair-0.46.1}/src/json_repair.egg-info/dependency_links.txt +0 -0
  18. {json_repair-0.46.0 → json_repair-0.46.1}/src/json_repair.egg-info/entry_points.txt +0 -0
  19. {json_repair-0.46.0 → json_repair-0.46.1}/src/json_repair.egg-info/top_level.txt +0 -0
  20. {json_repair-0.46.0 → json_repair-0.46.1}/tests/test_json_repair.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_repair
3
- Version: 0.46.0
3
+ Version: 0.46.1
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
@@ -38,7 +38,7 @@ License-File: LICENSE
38
38
  Dynamic: license-file
39
39
 
40
40
  [![PyPI](https://img.shields.io/pypi/v/json-repair)](https://pypi.org/project/json-repair/)
41
- ![Python version](https://img.shields.io/badge/python-3.9+-important)
41
+ ![Python version](https://img.shields.io/badge/python-3.10+-important)
42
42
  [![PyPI downloads](https://img.shields.io/pypi/dm/json-repair)](https://pypi.org/project/json-repair/)
43
43
  [![Github Sponsors](https://img.shields.io/github/sponsors/mangiucugna)](https://github.com/sponsors/mangiucugna)
44
44
  [![GitHub Repo stars](https://img.shields.io/github/stars/mangiucugna/json_repair?style=flat)](https://github.com/mangiucugna/json_repair/stargazers)
@@ -289,6 +289,7 @@ You will need owner access to this repository
289
289
  - Typescript: https://github.com/josdejong/jsonrepair
290
290
  - Go: https://github.com/RealAlexandreAI/json-repair
291
291
  - Ruby: https://github.com/sashazykov/json-repair-rb
292
+ - Rust: https://github.com/oramasearch/llm_json
292
293
  ---
293
294
  ## Star History
294
295
 
@@ -1,5 +1,5 @@
1
1
  [![PyPI](https://img.shields.io/pypi/v/json-repair)](https://pypi.org/project/json-repair/)
2
- ![Python version](https://img.shields.io/badge/python-3.9+-important)
2
+ ![Python version](https://img.shields.io/badge/python-3.10+-important)
3
3
  [![PyPI downloads](https://img.shields.io/pypi/dm/json-repair)](https://pypi.org/project/json-repair/)
4
4
  [![Github Sponsors](https://img.shields.io/github/sponsors/mangiucugna)](https://github.com/sponsors/mangiucugna)
5
5
  [![GitHub Repo stars](https://img.shields.io/github/stars/mangiucugna/json_repair?style=flat)](https://github.com/mangiucugna/json_repair/stargazers)
@@ -250,6 +250,7 @@ You will need owner access to this repository
250
250
  - Typescript: https://github.com/josdejong/jsonrepair
251
251
  - Go: https://github.com/RealAlexandreAI/json-repair
252
252
  - Ruby: https://github.com/sashazykov/json-repair-rb
253
+ - Rust: https://github.com/oramasearch/llm_json
253
254
  ---
254
255
  ## Star History
255
256
 
@@ -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.46.0"
6
+ version = "0.46.1"
7
7
  license = {file = "LICENSE"}
8
8
  authors = [
9
9
  { name="Stefano Baccianella", email="4247706+mangiucugna@users.noreply.github.com" },
@@ -72,7 +72,7 @@ target-version = "py313"
72
72
  # Simplifications (e.g., if x == True → if x) - SIM
73
73
  # Pyupgrade – safe modernization (e.g., str() → f"") - UP
74
74
 
75
- select = ['A', 'B', 'C90', 'E', 'F', 'I', 'PLC', 'PLE', 'PLW', 'S', 'SIM', 'TID', 'UP', 'W']
75
+ select = ['A', 'ARG', 'B', 'C4', 'C90', 'COM', 'E', 'F', 'I', 'PLC', 'PLE', 'PLW', 'Q', 'S', 'SIM', 'TID','UP', 'W']
76
76
  # Only enable these RUF rules
77
77
  extend-select = [
78
78
  "RUF001", # ambiguous Unicode
@@ -81,7 +81,7 @@ extend-select = [
81
81
  "RUF016", # unnecessary else after return (optional)
82
82
  "RUF018", # unnecessary else after raise (optional)
83
83
  ]
84
- ignore = ["E501", "C901", "S101"]
84
+ ignore = ["S101", "E501", "C901", "COM812"]
85
85
 
86
86
  # Allow fix for all enabled rules (when `--fix`) is provided.
87
87
  fixable = ["ALL"]
@@ -41,7 +41,7 @@ class JSONParser:
41
41
  self.log = self._log
42
42
  else:
43
43
  # No-op
44
- self.log = lambda *args, **kwargs: None
44
+ self.log = lambda *args, **kwargs: None # noqa: ARG005
45
45
  # When the json to be repaired is the accumulation of streaming json at a certain moment.
46
46
  # e.g. json obtained from llm response.
47
47
  # If this parameter to True will keep the repair results stable. For example:
@@ -67,6 +67,9 @@ class JSONParser:
67
67
  # replace the last entry with the new one since the new one seems an update
68
68
  json.pop()
69
69
  json.append(j)
70
+ else:
71
+ # this was a bust, move the index
72
+ self.index += 1
70
73
  # If nothing extra was found, don't return an array
71
74
  if len(json) == 1:
72
75
  self.log(
@@ -6,7 +6,7 @@ class ObjectComparer: # pragma: no cover
6
6
  pass # No operation performed in the constructor
7
7
 
8
8
  @staticmethod
9
- def is_same_object(obj1: Any, obj2: Any, path: str = "") -> bool:
9
+ def is_same_object(obj1: Any, obj2: Any) -> bool:
10
10
  """
11
11
  Recursively compares two objects and ensures that:
12
12
  - Their types match
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_repair
3
- Version: 0.46.0
3
+ Version: 0.46.1
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
@@ -38,7 +38,7 @@ License-File: LICENSE
38
38
  Dynamic: license-file
39
39
 
40
40
  [![PyPI](https://img.shields.io/pypi/v/json-repair)](https://pypi.org/project/json-repair/)
41
- ![Python version](https://img.shields.io/badge/python-3.9+-important)
41
+ ![Python version](https://img.shields.io/badge/python-3.10+-important)
42
42
  [![PyPI downloads](https://img.shields.io/pypi/dm/json-repair)](https://pypi.org/project/json-repair/)
43
43
  [![Github Sponsors](https://img.shields.io/github/sponsors/mangiucugna)](https://github.com/sponsors/mangiucugna)
44
44
  [![GitHub Repo stars](https://img.shields.io/github/stars/mangiucugna/json_repair?style=flat)](https://github.com/mangiucugna/json_repair/stargazers)
@@ -289,6 +289,7 @@ You will need owner access to this repository
289
289
  - Typescript: https://github.com/josdejong/jsonrepair
290
290
  - Go: https://github.com/RealAlexandreAI/json-repair
291
291
  - Ruby: https://github.com/sashazykov/json-repair-rb
292
+ - Rust: https://github.com/oramasearch/llm_json
292
293
  ---
293
294
  ## Star History
294
295
 
@@ -19,7 +19,7 @@ def test_true_true_correct(benchmark):
19
19
  mean_time = benchmark.stats.get("median")
20
20
 
21
21
  # Define your time threshold in seconds
22
- max_time = 2 / 10**3 # 2 millisecond
22
+ max_time = 3 / 10**3 # 3 millisecond
23
23
 
24
24
  # Assert that the average time is below the threshold
25
25
  assert mean_time < max_time, (
@@ -34,7 +34,7 @@ def test_true_true_incorrect(benchmark):
34
34
  mean_time = benchmark.stats.get("median")
35
35
 
36
36
  # Define your time threshold in seconds
37
- max_time = 2 / 10**3 # 2 millisecond
37
+ max_time = 3 / 10**3 # 3 millisecond
38
38
 
39
39
  # Assert that the average time is below the threshold
40
40
  assert mean_time < max_time, (
@@ -62,7 +62,7 @@ def test_true_false_incorrect(benchmark):
62
62
  mean_time = benchmark.stats.get("median")
63
63
 
64
64
  # Define your time threshold in seconds
65
- max_time = 2.1 / 10**3 # 2.1 millisecond
65
+ max_time = 3 / 10**3 # 3 millisecond
66
66
 
67
67
  # Assert that the average time is below the threshold
68
68
  assert mean_time < max_time, (
@@ -76,7 +76,7 @@ def test_false_true_correct(benchmark):
76
76
  mean_time = benchmark.stats.get("median")
77
77
 
78
78
  # Define your time threshold in seconds
79
- max_time = 2.1 / 10**3 # 2.1 millisecond
79
+ max_time = 3 / 10**3 # 3 millisecond
80
80
 
81
81
  # Assert that the average time is below the threshold
82
82
  assert mean_time < max_time, (
@@ -90,7 +90,7 @@ def test_false_true_incorrect(benchmark):
90
90
  mean_time = benchmark.stats.get("median")
91
91
 
92
92
  # Define your time threshold in seconds
93
- max_time = 2.1 / 10**3 # 2.1 millisecond
93
+ max_time = 3 / 10**3 # 3 millisecond
94
94
 
95
95
  # Assert that the average time is below the threshold
96
96
  assert mean_time < max_time, (
@@ -118,7 +118,7 @@ def test_false_false_incorrect(benchmark):
118
118
  mean_time = benchmark.stats.get("median")
119
119
 
120
120
  # Define your time threshold in seconds
121
- max_time = 2.1 / 10**3 # 2.1 millisecond
121
+ max_time = 3 / 10**3 # 3 millisecond
122
122
 
123
123
  # Assert that the average time is below the threshold
124
124
  assert mean_time < max_time, (
File without changes
File without changes