Skip to content
Snippets Groups Projects
Commit 70ce1646 authored by Samuel GAIST's avatar Samuel GAIST
Browse files

[execution][base] Import simplejson as json to make it easy to swap

parent 0e362bc6
No related branches found
No related tags found
1 merge request!64Factorize simplejson
...@@ -47,7 +47,7 @@ import os ...@@ -47,7 +47,7 @@ import os
import glob import glob
import collections import collections
import logging import logging
import simplejson import simplejson as json
from .. import schema from .. import schema
from .. import database from .. import database
...@@ -417,7 +417,7 @@ class BaseExecutor(object): ...@@ -417,7 +417,7 @@ class BaseExecutor(object):
return stats.io_statistics(self.data, self.input_list, self.output_list) return stats.io_statistics(self.data, self.input_list, self.output_list)
def __str__(self): def __str__(self):
return simplejson.dumps(self.data, indent=4) return json.dumps(self.data, indent=4)
def write(self, path): def write(self, path):
"""Writes contents to precise filesystem location""" """Writes contents to precise filesystem location"""
...@@ -431,7 +431,7 @@ class BaseExecutor(object): ...@@ -431,7 +431,7 @@ class BaseExecutor(object):
data = convert_experiment_configuration_to_container(self.data) data = convert_experiment_configuration_to_container(self.data)
with open(os.path.join(directory, "configuration.json"), "wb") as f: with open(os.path.join(directory, "configuration.json"), "wb") as f:
json_data = simplejson.dumps(data, indent=2) json_data = json.dumps(data, indent=2)
f.write(json_data.encode("utf-8")) f.write(json_data.encode("utf-8"))
tmp_prefix = os.path.join(directory, "prefix") tmp_prefix = os.path.join(directory, "prefix")
...@@ -447,7 +447,7 @@ class BaseExecutor(object): ...@@ -447,7 +447,7 @@ class BaseExecutor(object):
"""Exports contents useful for a backend runner to run the algorithm""" """Exports contents useful for a backend runner to run the algorithm"""
with open(os.path.join(directory, "configuration.json"), "wb") as f: with open(os.path.join(directory, "configuration.json"), "wb") as f:
json_data = simplejson.dumps(self.data, indent=2) json_data = json.dumps(self.data, indent=2)
f.write(json_data.encode("utf-8")) f.write(json_data.encode("utf-8"))
tmp_prefix = os.path.join(directory, "prefix") tmp_prefix = os.path.join(directory, "prefix")
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment