Default settings now transformed to the settings_types rather than copy
@@ -112,6 +112,13 @@ def to_custom_types(dictionary, types, default, no_ctype=False):
elif v == 'list(float)':
try:
+ dictionary[k]
+ except KeyError:
+ if default[k] is None:
+ raise exceptions.NoDefaultValueException(k)
+ dictionary[k] = default[k].copy()
+ notify_default_value(k, dictionary[k])
+
if isinstance(dictionary[k], np.ndarray):
continue
if isinstance(dictionary[k], list):
@@ -126,14 +133,16 @@ def to_custom_types(dictionary, types, default, no_ctype=False):
dictionary[k] = np.fromstring(dictionary[k].strip('[]'), sep=' ', dtype=ct.c_double)
else:
dictionary[k] = np.fromstring(dictionary[k].strip('[]'), sep=',', dtype=ct.c_double)
+
+ elif v == 'list(int)':
+ try:
+ dictionary[k]
except KeyError:
if default[k] is None:
raise exceptions.NoDefaultValueException(k)
dictionary[k] = default[k].copy()
notify_default_value(k, dictionary[k])
- elif v == 'list(int)':
- try:
if isinstance(dictionary[k], np.ndarray):
continue
if isinstance(dictionary[k], list):
@@ -148,14 +157,16 @@ def to_custom_types(dictionary, types, default, no_ctype=False):
dictionary[k] = np.fromstring(dictionary[k].strip('[]'), sep=' ').astype(ct.c_int)
else:
dictionary[k] = np.fromstring(dictionary[k].strip('[]'), sep=',').astype(ct.c_int)
+
+ elif v == 'list(complex)':
+ try:
+ dictionary[k]
except KeyError:
if default[k] is None:
raise exceptions.NoDefaultValueException(k)
dictionary[k] = default[k].copy()
notify_default_value(k, dictionary[k])
- elif v == 'list(complex)':
- try:
if isinstance(dictionary[k], np.ndarray):
continue
if isinstance(dictionary[k], list):
@@ -170,11 +181,6 @@ def to_custom_types(dictionary, types, default, no_ctype=False):
dictionary[k] = np.fromstring(dictionary[k].strip('[]'), sep=' ').astype(complex)
else:
dictionary[k] = np.fromstring(dictionary[k].strip('[]'), sep=',').astype(complex)
- except KeyError:
- if default[k] is None:
- raise exceptions.NoDefaultValueException(k)
- dictionary[k] = default[k].copy()
- notify_default_value(k, dictionary[k])
elif v == 'dict':
try:
