partialjson 0.0.2__tar.gz → 0.0.4__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: partialjson
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Parse incomplete or partial json
5
5
  Home-page: https://github.com/iw4p/partialjson
6
6
  Author: Nima Akbarzadeh
@@ -11,11 +11,13 @@ License-File: LICENSE
11
11
 
12
12
  # PartialJson
13
13
 
14
- ## Parse Partial and incomplete JSON in python
15
-
16
14
  [![Partialjson](https://github.com/iw4p/partialjson/raw/main/images/partialjson.png
17
15
  )](https://pypi.org/project/partialjson/)
18
16
 
17
+ ## Parse Partial and incomplete JSON in python
18
+
19
+ ![](https://github.com/iw4p/partialjson/raw/main/images/partialjson.gif)
20
+
19
21
  ### Parse Partial and incomplete JSON in python with just 3 lines of python code.
20
22
 
21
23
  [![PyPI version](https://img.shields.io/pypi/v/partialjson.svg)](https://pypi.org/project/partialjson)
@@ -1,10 +1,12 @@
1
1
  # PartialJson
2
2
 
3
- ## Parse Partial and incomplete JSON in python
4
-
5
3
  [![Partialjson](https://github.com/iw4p/partialjson/raw/main/images/partialjson.png
6
4
  )](https://pypi.org/project/partialjson/)
7
5
 
6
+ ## Parse Partial and incomplete JSON in python
7
+
8
+ ![](https://github.com/iw4p/partialjson/raw/main/images/partialjson.gif)
9
+
8
10
  ### Parse Partial and incomplete JSON in python with just 3 lines of python code.
9
11
 
10
12
  [![PyPI version](https://img.shields.io/pypi/v/partialjson.svg)](https://pypi.org/project/partialjson)
@@ -5,7 +5,7 @@ A great wrapped library for downloading from torrent.
5
5
  """
6
6
  from .json_parser import JSONParser
7
7
 
8
- __version__ = "0.0.2"
8
+ __version__ = "0.0.4"
9
9
  __author__ = 'Nima Akbarzadeh'
10
10
  __author_email__ = "iw4p@protonmail.com"
11
11
  __license__ = "MIT"
@@ -25,14 +25,17 @@ class JSONParser:
25
25
  print('Parsed JSON with extra tokens:', {'text': text, 'data': data, 'reminding': reminding})
26
26
 
27
27
  def parse(self, s):
28
- try:
29
- return json.loads(s)
30
- except json.JSONDecodeError as e:
31
- data, reminding = self.parse_any(s, e)
32
- self.last_parse_reminding = reminding
33
- if self.on_extra_token and reminding:
34
- self.on_extra_token(s, data, reminding)
35
- return json.dumps(data)
28
+ if len(s) >= 1:
29
+ try:
30
+ return json.loads(s)
31
+ except json.JSONDecodeError as e:
32
+ data, reminding = self.parse_any(s, e)
33
+ self.last_parse_reminding = reminding
34
+ if self.on_extra_token and reminding:
35
+ self.on_extra_token(s, data, reminding)
36
+ return json.loads(json.dumps(data))
37
+ else:
38
+ return json.loads({})
36
39
 
37
40
  def parse_any(self, s, e):
38
41
  if not s:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: partialjson
3
- Version: 0.0.2
3
+ Version: 0.0.4
4
4
  Summary: Parse incomplete or partial json
5
5
  Home-page: https://github.com/iw4p/partialjson
6
6
  Author: Nima Akbarzadeh
@@ -11,11 +11,13 @@ License-File: LICENSE
11
11
 
12
12
  # PartialJson
13
13
 
14
- ## Parse Partial and incomplete JSON in python
15
-
16
14
  [![Partialjson](https://github.com/iw4p/partialjson/raw/main/images/partialjson.png
17
15
  )](https://pypi.org/project/partialjson/)
18
16
 
17
+ ## Parse Partial and incomplete JSON in python
18
+
19
+ ![](https://github.com/iw4p/partialjson/raw/main/images/partialjson.gif)
20
+
19
21
  ### Parse Partial and incomplete JSON in python with just 3 lines of python code.
20
22
 
21
23
  [![PyPI version](https://img.shields.io/pypi/v/partialjson.svg)](https://pypi.org/project/partialjson)
File without changes
File without changes
File without changes