json-repair 0.36.1__tar.gz → 0.37.0__tar.gz

Sign up to get free protection for your applications and to get access to all the features.
Files changed (20) hide show
  1. {json_repair-0.36.1/src/json_repair.egg-info → json_repair-0.37.0}/PKG-INFO +1 -1
  2. {json_repair-0.36.1 → json_repair-0.37.0}/pyproject.toml +1 -1
  3. {json_repair-0.36.1 → json_repair-0.37.0}/src/json_repair/json_parser.py +8 -3
  4. {json_repair-0.36.1 → json_repair-0.37.0/src/json_repair.egg-info}/PKG-INFO +1 -1
  5. {json_repair-0.36.1 → json_repair-0.37.0}/LICENSE +0 -0
  6. {json_repair-0.36.1 → json_repair-0.37.0}/README.md +0 -0
  7. {json_repair-0.36.1 → json_repair-0.37.0}/setup.cfg +0 -0
  8. {json_repair-0.36.1 → json_repair-0.37.0}/src/json_repair/__init__.py +0 -0
  9. {json_repair-0.36.1 → json_repair-0.37.0}/src/json_repair/__main__.py +0 -0
  10. {json_repair-0.36.1 → json_repair-0.37.0}/src/json_repair/json_context.py +0 -0
  11. {json_repair-0.36.1 → json_repair-0.37.0}/src/json_repair/json_repair.py +0 -0
  12. {json_repair-0.36.1 → json_repair-0.37.0}/src/json_repair/py.typed +0 -0
  13. {json_repair-0.36.1 → json_repair-0.37.0}/src/json_repair/string_file_wrapper.py +0 -0
  14. {json_repair-0.36.1 → json_repair-0.37.0}/src/json_repair.egg-info/SOURCES.txt +0 -0
  15. {json_repair-0.36.1 → json_repair-0.37.0}/src/json_repair.egg-info/dependency_links.txt +0 -0
  16. {json_repair-0.36.1 → json_repair-0.37.0}/src/json_repair.egg-info/entry_points.txt +0 -0
  17. {json_repair-0.36.1 → json_repair-0.37.0}/src/json_repair.egg-info/top_level.txt +0 -0
  18. {json_repair-0.36.1 → json_repair-0.37.0}/tests/test_coverage.py +0 -0
  19. {json_repair-0.36.1 → json_repair-0.37.0}/tests/test_json_repair.py +0 -0
  20. {json_repair-0.36.1 → json_repair-0.37.0}/tests/test_performance.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: json_repair
3
- Version: 0.36.1
3
+ Version: 0.37.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
@@ -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.36.1"
6
+ version = "0.37.0"
7
7
  license = {file = "LICENSE"}
8
8
  authors = [
9
9
  { name="Stefano Baccianella", email="4247706+mangiucugna@users.noreply.github.com" },
@@ -438,7 +438,7 @@ class JSONParser:
438
438
  string_acc += char
439
439
  self.index += 1
440
440
  char = self.get_char_at()
441
- if char and len(string_acc) > 0 and string_acc[-1] == "\\":
441
+ if char and string_acc[-1] == "\\":
442
442
  # This is a special case, if people use real strings this might happen
443
443
  self.log("Found a stray escape sequence, normalizing it")
444
444
  if char in [rstring_delimiter, "t", "n", "r", "b", "\\"]:
@@ -646,10 +646,15 @@ class JSONParser:
646
646
  self.log(
647
647
  "While parsing a string, we missed the closing quote, ignoring",
648
648
  )
649
+ string_acc = string_acc.rstrip()
649
650
  else:
650
651
  self.index += 1
651
652
 
652
- return string_acc.rstrip()
653
+ if missing_quotes or (string_acc and string_acc[-1] == "\n"):
654
+ # Clean the whitespaces for some corner cases
655
+ string_acc = string_acc.rstrip()
656
+
657
+ return string_acc
653
658
 
654
659
  def parse_number(self) -> Union[float, int, str, JSONReturnType]:
655
660
  # <number> is a valid real number expressed in one of a number of given formats
@@ -661,7 +666,7 @@ class JSONParser:
661
666
  number_str += char
662
667
  self.index += 1
663
668
  char = self.get_char_at()
664
- if len(number_str) > 1 and number_str[-1] in "-eE/,":
669
+ if number_str and number_str[-1] in "-eE/,":
665
670
  # The number ends with a non valid character for a number/currency, rolling back one
666
671
  number_str = number_str[:-1]
667
672
  self.index -= 1
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: json_repair
3
- Version: 0.36.1
3
+ Version: 0.37.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
File without changes
File without changes
File without changes