json-repair 0.50.0__tar.gz → 0.50.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 (35) hide show
  1. {json_repair-0.50.0/src/json_repair.egg-info → json_repair-0.50.1}/PKG-INFO +2 -2
  2. {json_repair-0.50.0 → json_repair-0.50.1}/README.md +1 -1
  3. {json_repair-0.50.0 → json_repair-0.50.1}/pyproject.toml +1 -1
  4. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/parse_string.py +12 -9
  5. {json_repair-0.50.0 → json_repair-0.50.1/src/json_repair.egg-info}/PKG-INFO +2 -2
  6. {json_repair-0.50.0 → json_repair-0.50.1}/LICENSE +0 -0
  7. {json_repair-0.50.0 → json_repair-0.50.1}/setup.cfg +0 -0
  8. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/__init__.py +0 -0
  9. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/__main__.py +0 -0
  10. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/constants.py +0 -0
  11. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/json_context.py +0 -0
  12. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/json_parser.py +0 -0
  13. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/json_repair.py +0 -0
  14. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/object_comparer.py +0 -0
  15. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/parse_array.py +0 -0
  16. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/parse_boolean_or_null.py +0 -0
  17. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/parse_comment.py +0 -0
  18. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/parse_number.py +0 -0
  19. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/parse_object.py +0 -0
  20. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/py.typed +0 -0
  21. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair/string_file_wrapper.py +0 -0
  22. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair.egg-info/SOURCES.txt +0 -0
  23. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair.egg-info/dependency_links.txt +0 -0
  24. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair.egg-info/entry_points.txt +0 -0
  25. {json_repair-0.50.0 → json_repair-0.50.1}/src/json_repair.egg-info/top_level.txt +0 -0
  26. {json_repair-0.50.0 → json_repair-0.50.1}/tests/test_json_repair.py +0 -0
  27. {json_repair-0.50.0 → json_repair-0.50.1}/tests/test_parse_array.py +0 -0
  28. {json_repair-0.50.0 → json_repair-0.50.1}/tests/test_parse_boolean_or_null.py +0 -0
  29. {json_repair-0.50.0 → json_repair-0.50.1}/tests/test_parse_comment.py +0 -0
  30. {json_repair-0.50.0 → json_repair-0.50.1}/tests/test_parse_number.py +0 -0
  31. {json_repair-0.50.0 → json_repair-0.50.1}/tests/test_parse_object.py +0 -0
  32. {json_repair-0.50.0 → json_repair-0.50.1}/tests/test_parse_string.py +0 -0
  33. {json_repair-0.50.0 → json_repair-0.50.1}/tests/test_performance.py +0 -0
  34. {json_repair-0.50.0 → json_repair-0.50.1}/tests/test_repair_json_cli.py +0 -0
  35. {json_repair-0.50.0 → json_repair-0.50.1}/tests/test_repair_json_from_file.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_repair
3
- Version: 0.50.0
3
+ Version: 0.50.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-Expression: MIT
@@ -17,7 +17,7 @@ Dynamic: license-file
17
17
 
18
18
  [![PyPI](https://img.shields.io/pypi/v/json-repair)](https://pypi.org/project/json-repair/)
19
19
  ![Python version](https://img.shields.io/badge/python-3.10+-important)
20
- [![PyPI Downloads](https://static.pepy.tech/badge/json-repair/month)](https://pepy.tech/projects/json-repair)
20
+ [![PyPI downloads](https://img.shields.io/pypi/dm/json-repair)](https://pypi.org/project/json-repair/)
21
21
  [![PyPI Downloads](https://static.pepy.tech/badge/json-repair)](https://pepy.tech/projects/json-repair)
22
22
  [![Github Sponsors](https://img.shields.io/github/sponsors/mangiucugna)](https://github.com/sponsors/mangiucugna)
23
23
  [![GitHub Repo stars](https://img.shields.io/github/stars/mangiucugna/json_repair?style=flat)](https://github.com/mangiucugna/json_repair/stargazers)
@@ -1,6 +1,6 @@
1
1
  [![PyPI](https://img.shields.io/pypi/v/json-repair)](https://pypi.org/project/json-repair/)
2
2
  ![Python version](https://img.shields.io/badge/python-3.10+-important)
3
- [![PyPI Downloads](https://static.pepy.tech/badge/json-repair/month)](https://pepy.tech/projects/json-repair)
3
+ [![PyPI downloads](https://img.shields.io/pypi/dm/json-repair)](https://pypi.org/project/json-repair/)
4
4
  [![PyPI Downloads](https://static.pepy.tech/badge/json-repair)](https://pepy.tech/projects/json-repair)
5
5
  [![Github Sponsors](https://img.shields.io/github/sponsors/mangiucugna)](https://github.com/sponsors/mangiucugna)
6
6
  [![GitHub Repo stars](https://img.shields.io/github/stars/mangiucugna/json_repair?style=flat)](https://github.com/mangiucugna/json_repair/stargazers)
@@ -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.50.0"
6
+ version = "0.50.1"
7
7
  license = "MIT"
8
8
  license-files = ["LICENSE"]
9
9
  authors = [
@@ -391,18 +391,21 @@ def parse_string(self: "JSONParser") -> str | bool | None:
391
391
  self.index += 1
392
392
  char = self.get_char_at()
393
393
  elif self.context.current == ContextValues.ARRAY:
394
- # Let's check if after this quote there are two quotes in a row followed by a comma or a closing bracket
395
- i = self.skip_to_character(character=[rstring_delimiter, "]"], idx=i + 1)
396
- next_c = self.get_char_at(i)
397
- even_delimiters = next_c and next_c == rstring_delimiter
398
- while even_delimiters and next_c and next_c == rstring_delimiter:
394
+ # So here we can have a few valid cases:
395
+ # ["bla bla bla "puppy" bla bla bla "kitty" bla bla"]
396
+ # ["value1" value2", "value3"]
397
+ # The basic idea is that if we find an even number of delimiters after this delimiter
398
+ # we ignore this delimiter as it should be fine
399
+ even_delimiters = next_c == rstring_delimiter
400
+ while next_c == rstring_delimiter:
399
401
  i = self.skip_to_character(character=[rstring_delimiter, "]"], idx=i + 1)
402
+ next_c = self.get_char_at(i)
403
+ if next_c != rstring_delimiter:
404
+ even_delimiters = False
405
+ break
400
406
  i = self.skip_to_character(character=[rstring_delimiter, "]"], idx=i + 1)
401
407
  next_c = self.get_char_at(i)
402
- # i = self.skip_whitespaces_at(idx=i + 1, move_main_index=False)
403
- # next_c = self.get_char_at(i)
404
- # if next_c in [",", "]"]:
405
- if even_delimiters and next_c != "]":
408
+ if even_delimiters:
406
409
  # If we got up to here it means that this is a situation like this:
407
410
  # ["bla bla bla "puppy" bla bla bla "kitty" bla bla"]
408
411
  # So we need to ignore this quote
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_repair
3
- Version: 0.50.0
3
+ Version: 0.50.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-Expression: MIT
@@ -17,7 +17,7 @@ Dynamic: license-file
17
17
 
18
18
  [![PyPI](https://img.shields.io/pypi/v/json-repair)](https://pypi.org/project/json-repair/)
19
19
  ![Python version](https://img.shields.io/badge/python-3.10+-important)
20
- [![PyPI Downloads](https://static.pepy.tech/badge/json-repair/month)](https://pepy.tech/projects/json-repair)
20
+ [![PyPI downloads](https://img.shields.io/pypi/dm/json-repair)](https://pypi.org/project/json-repair/)
21
21
  [![PyPI Downloads](https://static.pepy.tech/badge/json-repair)](https://pepy.tech/projects/json-repair)
22
22
  [![Github Sponsors](https://img.shields.io/github/sponsors/mangiucugna)](https://github.com/sponsors/mangiucugna)
23
23
  [![GitHub Repo stars](https://img.shields.io/github/stars/mangiucugna/json_repair?style=flat)](https://github.com/mangiucugna/json_repair/stargazers)
File without changes
File without changes