libjam 0.0.12__tar.gz → 0.0.13__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.4
2
2
  Name: libjam
3
- Version: 0.0.12
3
+ Version: 0.0.13
4
4
  Summary: A library jam for Python.
5
5
  Project-URL: Homepage, https://github.com/philippkosarev/libjam
6
6
  Project-URL: Issues, https://github.com/philippkosarev/libjam/issues
@@ -107,16 +107,18 @@ class Notebook:
107
107
  parser.write(file)
108
108
 
109
109
  # Reads a given json file as a dictionary.
110
+ # Returns None if file doesn't exist.
110
111
  def read_json(self, json_file: str):
111
112
  if drawer.is_file(json_file) is False:
112
113
  return None
113
114
  json_file = drawer.absolute_path(json_file)
114
115
  json_string = open(json_file, 'r').read()
116
+ json_string = json_string.replace('null', 'None')
117
+ # Trying the sane method
115
118
  try:
116
119
  data = json.loads(json_string)
120
+ # Exception in case json contains multiline values
117
121
  except json.decoder.JSONDecodeError:
118
- json_string = json_string.replace('\n', ' ').strip()
122
+ json_string = ' '.join(json_string.split())
119
123
  data = ast.literal_eval(json_string)
120
- except:
121
- data = None
122
124
  return data
@@ -14,7 +14,7 @@ include = [
14
14
 
15
15
  [project]
16
16
  name = "libjam"
17
- version = "0.0.12"
17
+ version = "0.0.13"
18
18
  authors = [
19
19
  { name="Philipp Kosarev", email="philipp.kosarev@gmail.com" },
20
20
  ]
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes