This avoids loading a FloatListSetting as a list of `numpy.float64`s,
which lead to problems if you attempted to serialize the resulting
config using `YAML_Storage`:
Traceback (most recent call last):
...
File ".../h5config/storage/yaml.py", line 140, in _save
default_flow_style=False)
File "/usr/lib64/python2.7/site-packages/yaml/__init__.py", line 202, in dump
return dump_all([data], stream, Dumper=Dumper, **kwds)
...
File "/usr/lib64/python2.7/site-packages/yaml/representer.py", line 247, in represent_undefined
raise RepresenterError("cannot represent an object: %s" % data)
yaml.representer.RepresenterError: cannot represent an object: 0.0
elif isinstance(s, _config.NumericSetting):
raise NotImplementedError(type(s))
elif isinstance(s, _config.ListSetting):
- v = list(v) # convert from numpy array
+ # convert from numpy array
+ if isinstance(s, _config.IntegerListSetting):
+ conv = int
+ elif isinstance(s, _config.FloatListSetting):
+ conv = float
+ v = list(conv(x) for x in v)
if _is_string(v):
# convert back from None, etc.
v = s.convert_from_text(v)