json-repair 0.55.0__tar.gz → 0.55.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 (36) hide show
  1. {json_repair-0.55.0/src/json_repair.egg-info → json_repair-0.55.1}/PKG-INFO +9 -3
  2. {json_repair-0.55.0 → json_repair-0.55.1}/README.md +8 -2
  3. {json_repair-0.55.0 → json_repair-0.55.1}/pyproject.toml +2 -2
  4. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/parse_number.py +4 -4
  5. {json_repair-0.55.0 → json_repair-0.55.1/src/json_repair.egg-info}/PKG-INFO +9 -3
  6. {json_repair-0.55.0 → json_repair-0.55.1}/tests/test_parse_number.py +4 -0
  7. {json_repair-0.55.0 → json_repair-0.55.1}/LICENSE +0 -0
  8. {json_repair-0.55.0 → json_repair-0.55.1}/setup.cfg +0 -0
  9. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/__init__.py +0 -0
  10. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/__main__.py +0 -0
  11. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/json_parser.py +0 -0
  12. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/json_repair.py +0 -0
  13. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/parse_array.py +0 -0
  14. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/parse_comment.py +0 -0
  15. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/parse_object.py +0 -0
  16. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/parse_string.py +0 -0
  17. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/parse_string_helpers/parse_boolean_or_null.py +0 -0
  18. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/parse_string_helpers/parse_json_llm_block.py +0 -0
  19. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/py.typed +0 -0
  20. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/utils/constants.py +0 -0
  21. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/utils/json_context.py +0 -0
  22. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/utils/object_comparer.py +0 -0
  23. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair/utils/string_file_wrapper.py +0 -0
  24. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair.egg-info/SOURCES.txt +0 -0
  25. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair.egg-info/dependency_links.txt +0 -0
  26. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair.egg-info/entry_points.txt +0 -0
  27. {json_repair-0.55.0 → json_repair-0.55.1}/src/json_repair.egg-info/top_level.txt +0 -0
  28. {json_repair-0.55.0 → json_repair-0.55.1}/tests/test_json_repair.py +0 -0
  29. {json_repair-0.55.0 → json_repair-0.55.1}/tests/test_parse_array.py +0 -0
  30. {json_repair-0.55.0 → json_repair-0.55.1}/tests/test_parse_comment.py +0 -0
  31. {json_repair-0.55.0 → json_repair-0.55.1}/tests/test_parse_object.py +0 -0
  32. {json_repair-0.55.0 → json_repair-0.55.1}/tests/test_parse_string.py +0 -0
  33. {json_repair-0.55.0 → json_repair-0.55.1}/tests/test_performance.py +0 -0
  34. {json_repair-0.55.0 → json_repair-0.55.1}/tests/test_repair_json_cli.py +0 -0
  35. {json_repair-0.55.0 → json_repair-0.55.1}/tests/test_repair_json_from_file.py +0 -0
  36. {json_repair-0.55.0 → json_repair-0.55.1}/tests/test_strict_mode.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_repair
3
- Version: 0.55.0
3
+ Version: 0.55.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
@@ -22,14 +22,20 @@ Dynamic: license-file
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)
24
24
 
25
+ English | [中文](README.zh.md)
25
26
 
26
27
  This simple package can be used to fix an invalid json string. To know all cases in which this package will work, check out the unit test.
27
28
 
28
29
  ![banner](banner.png)
29
30
 
30
31
  ---
31
- # Offer me a beer
32
- If you find this library useful, you can help me by donating toward my monthly beer budget here: https://github.com/sponsors/mangiucugna
32
+
33
+ # Think about sponsoring this library!
34
+ This library is free for everyone and it's maintained and developed as a side project so, if you find this library useful for your work, consider becoming a sponsor via this link: https://github.com/sponsors/mangiucugna
35
+
36
+ ## Premium sponsors
37
+ - [Icana-AI](https://github.com/Icana-AI) Makers of CallCoach, the world's best Call Centre AI Coach. Visit [https://www.icana.ai/](https://www.icana.ai/)
38
+ - [mjharte](https://github.com/mjharte)
33
39
 
34
40
  ---
35
41
 
@@ -5,14 +5,20 @@
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)
7
7
 
8
+ English | [中文](README.zh.md)
8
9
 
9
10
  This simple package can be used to fix an invalid json string. To know all cases in which this package will work, check out the unit test.
10
11
 
11
12
  ![banner](banner.png)
12
13
 
13
14
  ---
14
- # Offer me a beer
15
- If you find this library useful, you can help me by donating toward my monthly beer budget here: https://github.com/sponsors/mangiucugna
15
+
16
+ # Think about sponsoring this library!
17
+ This library is free for everyone and it's maintained and developed as a side project so, if you find this library useful for your work, consider becoming a sponsor via this link: https://github.com/sponsors/mangiucugna
18
+
19
+ ## Premium sponsors
20
+ - [Icana-AI](https://github.com/Icana-AI) Makers of CallCoach, the world's best Call Centre AI Coach. Visit [https://www.icana.ai/](https://www.icana.ai/)
21
+ - [mjharte](https://github.com/mjharte)
16
22
 
17
23
  ---
18
24
 
@@ -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.55.0"
6
+ version = "0.55.1"
7
7
  license = "MIT"
8
8
  license-files = ["LICENSE"]
9
9
  authors = [
@@ -118,4 +118,4 @@ line-ending = "auto"
118
118
  # Explicit re-exports is fine in __init__.py, still a code smell elsewhere.
119
119
  "__init__.py" = ["PLC0414"]
120
120
  [tool.mypy]
121
- strict = true
121
+ strict = true
@@ -20,14 +20,14 @@ def parse_number(self: "JSONParser") -> JSONReturnType:
20
20
  number_str += char
21
21
  self.index += 1
22
22
  char = self.get_char_at()
23
+ if (self.get_char_at() or "").isalpha():
24
+ # this was a string instead, sorry
25
+ self.index -= len(number_str)
26
+ return self.parse_string()
23
27
  if number_str and number_str[-1] in "-eE/,":
24
28
  # The number ends with a non valid character for a number/currency, rolling back one
25
29
  number_str = number_str[:-1]
26
30
  self.index -= 1
27
- elif (self.get_char_at() or "").isalpha():
28
- # this was a string instead, sorry
29
- self.index -= len(number_str)
30
- return self.parse_string()
31
31
  try:
32
32
  if "," in number_str:
33
33
  return number_str
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_repair
3
- Version: 0.55.0
3
+ Version: 0.55.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
@@ -22,14 +22,20 @@ Dynamic: license-file
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)
24
24
 
25
+ English | [中文](README.zh.md)
25
26
 
26
27
  This simple package can be used to fix an invalid json string. To know all cases in which this package will work, check out the unit test.
27
28
 
28
29
  ![banner](banner.png)
29
30
 
30
31
  ---
31
- # Offer me a beer
32
- If you find this library useful, you can help me by donating toward my monthly beer budget here: https://github.com/sponsors/mangiucugna
32
+
33
+ # Think about sponsoring this library!
34
+ This library is free for everyone and it's maintained and developed as a side project so, if you find this library useful for your work, consider becoming a sponsor via this link: https://github.com/sponsors/mangiucugna
35
+
36
+ ## Premium sponsors
37
+ - [Icana-AI](https://github.com/Icana-AI) Makers of CallCoach, the world's best Call Centre AI Coach. Visit [https://www.icana.ai/](https://www.icana.ai/)
38
+ - [mjharte](https://github.com/mjharte)
33
39
 
34
40
  ---
35
41
 
@@ -26,4 +26,8 @@ def test_parse_number_edge_cases():
26
26
  assert repair_json('{"key": 1e10 }') == '{"key": 10000000000.0}'
27
27
  assert repair_json('{"key": 1e }') == '{"key": 1}'
28
28
  assert repair_json('{"key": 1notanumber }') == '{"key": "1notanumber"}'
29
+ assert (
30
+ repair_json('{"rowId": 57eeeeb1-450b-482c-81b9-4be77e95dee2}')
31
+ == '{"rowId": "57eeeeb1-450b-482c-81b9-4be77e95dee2"}'
32
+ )
29
33
  assert repair_json("[1, 2notanumber]") == '[1, "2notanumber"]'
File without changes
File without changes