json-repair 0.54__tar.gz → 0.54.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.
- {json_repair-0.54/src/json_repair.egg-info → json_repair-0.54.1}/PKG-INFO +1 -1
- {json_repair-0.54 → json_repair-0.54.1}/pyproject.toml +1 -1
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/parse_number.py +3 -2
- {json_repair-0.54 → json_repair-0.54.1/src/json_repair.egg-info}/PKG-INFO +1 -1
- {json_repair-0.54 → json_repair-0.54.1}/tests/test_parse_number.py +2 -0
- {json_repair-0.54 → json_repair-0.54.1}/LICENSE +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/README.md +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/setup.cfg +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/__init__.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/__main__.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/json_parser.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/json_repair.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/parse_array.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/parse_comment.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/parse_object.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/parse_string.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/parse_string_helpers/parse_boolean_or_null.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/parse_string_helpers/parse_json_llm_block.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/py.typed +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/utils/constants.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/utils/json_context.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/utils/object_comparer.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair/utils/string_file_wrapper.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair.egg-info/SOURCES.txt +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair.egg-info/dependency_links.txt +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair.egg-info/entry_points.txt +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/src/json_repair.egg-info/top_level.txt +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/tests/test_json_repair.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/tests/test_parse_array.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/tests/test_parse_comment.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/tests/test_parse_object.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/tests/test_parse_string.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/tests/test_performance.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/tests/test_repair_json_cli.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/tests/test_repair_json_from_file.py +0 -0
- {json_repair-0.54 → json_repair-0.54.1}/tests/test_strict_mode.py +0 -0
|
@@ -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
|
-
|
|
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/,":
|
|
@@ -4,6 +4,8 @@ from src.json_repair.json_repair import repair_json
|
|
|
4
4
|
def test_parse_number():
|
|
5
5
|
assert repair_json("1", return_objects=True) == 1
|
|
6
6
|
assert repair_json("1.2", return_objects=True) == 1.2
|
|
7
|
+
assert repair_json('{"value": 82_461_110}', return_objects=True) == {"value": 82461110}
|
|
8
|
+
assert repair_json('{"value": 1_234.5_6}', return_objects=True) == {"value": 1234.56}
|
|
7
9
|
|
|
8
10
|
|
|
9
11
|
def test_parse_number_edge_cases():
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{json_repair-0.54 → json_repair-0.54.1}/src/json_repair/parse_string_helpers/parse_json_llm_block.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|