Commit 5596655d authored by Martin Reinecke's avatar Martin Reinecke

avoid exec statements; they cause problems with Python 3

parent dd87b630
Pipeline #14884 passed with stage
in 6 minutes and 20 seconds
......@@ -18,6 +18,7 @@
from __future__ import division
import ast
import itertools
import numpy as np
......@@ -1519,7 +1520,8 @@ class Field(Loggable, Versionable, object):
temp_domain.append(repository.get('s_' + str(i), hdf5_group))
new_field.domain = tuple(temp_domain)
exec('new_field.domain_axes = ' + hdf5_group.attrs['domain_axes'])
new_field.domain_axes = ast.literal_eval(
hdf5_group.attrs['domain_axes'])
try:
new_field._val = repository.get('val', hdf5_group)
......
......@@ -16,6 +16,7 @@
# NIFTy is being developed at the Max-Planck-Institut fuer Astrophysik
# and financially supported by the Studienstiftung des deutschen Volkes.
import ast
import numpy as np
from d2o import distributed_data_object
......@@ -311,6 +312,6 @@ class PowerSpace(Space):
@classmethod
def _from_hdf5(cls, hdf5_group, repository):
hp = repository.get('harmonic_partner', hdf5_group)
exec("bb = " + hdf5_group.attrs['binbounds'])
bb = ast.literal_eval(hdf5_group.attrs['binbounds'])
ds = hdf5_group.attrs['distribution_strategy']
return PowerSpace(hp, ds, binbounds=bb)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment