Improved error checking in create_extended_attributes
@@ -26,6 +26,7 @@ import swat as sw
import string
import warnings
import struct
+from dlpy.model import DataSpec
def create_extended_attributes(conn, model_name, layers, data_spec, label_file_name=None):
@@ -58,10 +59,16 @@ def create_extended_attributes(conn, model_name, layers, data_spec, label_file_n
# ensure list of strings
if not isinstance(layers,list):
raise TypeError('layers must be a list of strings.')
+ else:
+ if not all(isinstance(x,str) for x in layers):
+ raise TypeError('all layers elements must be strings.')
# ensure list of data specs
if not isinstance(data_spec,list):
raise TypeError('data_spec must be a list of DataSpec objects.')
+ else:
+ if not all(isinstance(x,DataSpec) for x in data_spec):
+ raise TypeError('all data_spec elements must be DataSpec objects.')
# read user-supplied labels
if label_file_name is None:
