json-repair 0.41.1__py3-none-any.whl → 0.42.0__py3-none-any.whl

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.
@@ -10,7 +10,6 @@ JSONReturnType = Union[Dict[str, Any], List[Any], str, float, int, bool, None]
10
10
  class JSONParser:
11
11
  # Constants
12
12
  STRING_DELIMITERS = ['"', "'", "“", "”"]
13
- NUMBER_CHARS = set("0123456789-.eE/,")
14
13
 
15
14
  def __init__(
16
15
  self,
@@ -663,7 +662,8 @@ class JSONParser:
663
662
  number_str = ""
664
663
  char = self.get_char_at()
665
664
  is_array = self.context.current == ContextValues.ARRAY
666
- while char and char in self.NUMBER_CHARS and (not is_array or char != ","):
665
+ NUMBER_CHARS = set("0123456789-.eE/,")
666
+ while char and char in NUMBER_CHARS and (not is_array or char != ","):
667
667
  number_str += char
668
668
  self.index += 1
669
669
  char = self.get_char_at()
@@ -671,6 +671,10 @@ class JSONParser:
671
671
  # The number ends with a non valid character for a number/currency, rolling back one
672
672
  number_str = number_str[:-1]
673
673
  self.index -= 1
674
+ elif (self.get_char_at() or "").isalpha():
675
+ # this was a string instead, sorry
676
+ self.index -= len(number_str)
677
+ return self.parse_string()
674
678
  try:
675
679
  if "," in number_str:
676
680
  return str(number_str)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: json_repair
3
- Version: 0.41.1
3
+ Version: 0.42.0
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
@@ -1,14 +1,14 @@
1
1
  json_repair/__init__.py,sha256=c4L2kZrHvWEKfj_ODU2naliNuvU6FlFVxtF0hbLe6s8,178
2
2
  json_repair/__main__.py,sha256=EsJb-y89uZEvGQQg1GdIDWzfDwfOMvVekKEtdguQXCM,67
3
3
  json_repair/json_context.py,sha256=mm6dOyrPJ1sDskTORZSXCW7W9-5veMlUKqXQ3Hw3EG4,971
4
- json_repair/json_parser.py,sha256=VnTlhPEuIynUt3gaAU2jpLJDddnPASxM941rYyMnGbo,38996
4
+ json_repair/json_parser.py,sha256=bu8FBxaazJ_tRJQmdZA7Me68HD7t3JuReVgjvyGWbmQ,39174
5
5
  json_repair/json_repair.py,sha256=k-5HRRlCqrxNmJi0u1KE3IUeL4HXqi1XZ7oAL-NFDLo,10314
6
6
  json_repair/object_comparer.py,sha256=SeicB6_N4BHAEPon7s2BELEaJc4oyR9ZhfX2RgPk6Bw,1682
7
7
  json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
8
8
  json_repair/string_file_wrapper.py,sha256=koZmdq2-Z5K7XF1bDqX6dEbNaVMJYcMTjq-aGe6NQvA,4526
9
- json_repair-0.41.1.dist-info/licenses/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
10
- json_repair-0.41.1.dist-info/METADATA,sha256=HnZgNiwsJJ3iwtFKgeccdm-yniRJnPq70kjcpQo6aw0,11860
11
- json_repair-0.41.1.dist-info/WHEEL,sha256=CmyFI0kx5cdEMTLiONQRbGQwjIoR1aIYB7eCAQ4KPJ0,91
12
- json_repair-0.41.1.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
13
- json_repair-0.41.1.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
14
- json_repair-0.41.1.dist-info/RECORD,,
9
+ json_repair-0.42.0.dist-info/licenses/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
10
+ json_repair-0.42.0.dist-info/METADATA,sha256=XJXQxqg6znbpuxK1hTY_0v3FB4KtH_8gOMPD-u_EdvY,11860
11
+ json_repair-0.42.0.dist-info/WHEEL,sha256=pxyMxgL8-pra_rKaQ4drOZAegBVuX-G_4nRHjjgWbmo,91
12
+ json_repair-0.42.0.dist-info/entry_points.txt,sha256=SNfge3zPSP-ASqriYU9r3NAPaXdseYr7ciPMKdV2uSw,57
13
+ json_repair-0.42.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
14
+ json_repair-0.42.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (78.1.0)
2
+ Generator: setuptools (79.0.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5