Skip to content
Snippets Groups Projects

Py3 compatibility

Merged Samuel GAIST requested to merge py3_compatibility into 1.6.x
22 files
+ 112
87
Compare changes
  • Side-by-side
  • Inline
Files
22
@@ -187,14 +187,14 @@ class BaseExecutor(object):
if len(self.data['inputs']) != len(self.algorithm.input_map):
self.errors.append("The number of inputs of the algorithm doesn't correspond")
if self.data.has_key('outputs') and (len(self.data['outputs']) != len(self.algorithm.output_map)):
if 'outputs' in self.data and (len(self.data['outputs']) != len(self.algorithm.output_map)):
self.errors.append("The number of outputs of the algorithm doesn't correspond")
for name in self.data['inputs'].keys():
if name not in self.algorithm.input_map.keys():
self.errors.append("The input '%s' doesn't exist in the algorithm" % name)
if self.data.has_key('outputs'):
if 'outputs' in self.data:
for name in self.data['outputs'].keys():
if name not in self.algorithm.output_map.keys():
self.errors.append("The output '%s' doesn't exist in the algorithm" % name)
@@ -361,7 +361,8 @@ class BaseExecutor(object):
data = convert_experiment_configuration_to_container(self.data)
with open(os.path.join(directory, 'configuration.json'), 'wb') as f:
simplejson.dump(data, f, indent=2)
json_data = simplejson.dumps(data, indent=2)
f.write(json_data.encode('utf-8'))
tmp_prefix = os.path.join(directory, 'prefix')
if not os.path.exists(tmp_prefix):
@@ -374,7 +375,8 @@ class BaseExecutor(object):
"""Exports contents useful for a backend runner to run the algorithm"""
with open(os.path.join(directory, 'configuration.json'), 'wb') as f:
simplejson.dump(self.data, f, indent=2)
json_data = simplejson.dumps(self.data, indent=2)
f.write(json_data.encode('utf-8'))
tmp_prefix = os.path.join(directory, 'prefix')
if not os.path.exists(tmp_prefix): os.makedirs(tmp_prefix)
Loading