json-repair 0.27.2__py3-none-any.whl → 0.28.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
@@ -51,9 +51,6 @@ class StringFileWrapper:
51
51
  self.fd.seek(current_position)
52
52
  return self.length
53
53
 
54
- def __setitem__(self) -> None:
55
- raise Exception("This is read-only!")
56
-
57
54
 
58
55
  class LoggerConfig:
59
56
  # This is a type class to simplify the declaration
@@ -310,8 +307,7 @@ class JSONParser:
310
307
  if self.get_context() == "object_key" and self.get_char_at(1) == ":":
311
308
  self.index += 1
312
309
  return ""
313
-
314
- # This is a valid exception only if it's closed by a double delimiter again
310
+ # Find the next delimiter
315
311
  i = 1
316
312
  next_c = self.get_char_at(i)
317
313
  while next_c and next_c != rstring_delimiter:
@@ -442,7 +438,7 @@ class JSONParser:
442
438
  ]:
443
439
  # This is a bit of a weird workaround, essentially in object_value context we don't always break on commas
444
440
  # This is because the routine after will make sure to correct any bad guess and this solves a corner case
445
- if next_c.isalpha():
441
+ if check_comma_in_object_value and next_c.isalpha():
446
442
  check_comma_in_object_value = False
447
443
  # If we are in an object context, let's check for the right delimiters
448
444
  if (
@@ -615,16 +611,10 @@ class JSONParser:
615
611
  self.context.append(value)
616
612
 
617
613
  def reset_context(self) -> None:
618
- try:
619
- self.context.pop()
620
- except Exception:
621
- return
614
+ self.context.pop()
622
615
 
623
616
  def get_context(self) -> str:
624
- try:
625
- return self.context[-1]
626
- except Exception:
627
- return ""
617
+ return self.context[-1]
628
618
 
629
619
  def log(self, text: str, level: str) -> None:
630
620
  if level == self.logger.log_level:
json_repair/py.typed ADDED
File without changes
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: json_repair
3
- Version: 0.27.2
3
+ Version: 0.28.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
@@ -27,6 +27,7 @@ License: MIT License
27
27
 
28
28
  Project-URL: Homepage, https://github.com/mangiucugna/json_repair/
29
29
  Project-URL: Bug Tracker, https://github.com/mangiucugna/json_repair/issues
30
+ Project-URL: Live demo, https://mangiucugna.github.io/json_repair/
30
31
  Keywords: JSON,REPAIR,LLM,PARSER
31
32
  Classifier: Programming Language :: Python :: 3
32
33
  Classifier: License :: OSI Approved :: MIT License
@@ -0,0 +1,8 @@
1
+ json_repair/__init__.py,sha256=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
2
+ json_repair/json_repair.py,sha256=5WjVoNO7Grdq9wfnbSjggiVlDv2XVcvWbCIQVmREP38,30109
3
+ json_repair/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
4
+ json_repair-0.28.0.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
5
+ json_repair-0.28.0.dist-info/METADATA,sha256=rPrWno-My7ZQt7EJIR0BodmpLQ84fr0vjJwBM4XYmYU,8043
6
+ json_repair-0.28.0.dist-info/WHEEL,sha256=HiCZjzuy6Dw0hdX5R3LCFPDmFS4BWl8H-8W39XfmgX4,91
7
+ json_repair-0.28.0.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
8
+ json_repair-0.28.0.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: setuptools (72.1.0)
2
+ Generator: setuptools (72.2.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1,7 +0,0 @@
1
- json_repair/__init__.py,sha256=IIzSm1DsCRrr8seF3UeMZXwxcq-tE3j-8d1WBxvEJvE,178
2
- json_repair/json_repair.py,sha256=599pWb3Wn7Lltvy8X3eWN9u7ccnSGdAaHt5De_L219s,30337
3
- json_repair-0.27.2.dist-info/LICENSE,sha256=wrjQo8MhNrNCicXtMe3MHmS-fx8AmQk1ue8AQwiiFV8,1076
4
- json_repair-0.27.2.dist-info/METADATA,sha256=yTnkoMdKmX0_E48cLHflA8grpL00MQJb91yLfWpgxdA,7976
5
- json_repair-0.27.2.dist-info/WHEEL,sha256=R0nc6qTxuoLk7ShA2_Y-UWkN8ZdfDBG2B6Eqpz2WXbs,91
6
- json_repair-0.27.2.dist-info/top_level.txt,sha256=7-VZwZN2CgB_n0NlSLk-rEUFh8ug21lESbsblOYuZqw,12
7
- json_repair-0.27.2.dist-info/RECORD,,