Skip to content

Commit bc982be

Browse files
committed
changed check to six string type #375
1 parent ef955d5 commit bc982be

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

openml/datasets/dataset.py

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -373,13 +373,17 @@ def get_features_by_type(self, data_type, exclude=None,
373373
result : list
374374
a list of indices that have the specified data type
375375
'''
376-
assert data_type in OpenMLDataFeature.LEGAL_DATA_TYPES, "Illegal feature type requested"
376+
if data_type not in OpenMLDataFeature.LEGAL_DATA_TYPES:
377+
raise TypeError("Illegal feature type requested")
377378
if self.ignore_attributes is not None:
378-
assert type(self.ignore_attributes) is list, "ignore_attributes should be a list"
379+
if not isinstance(self.ignore_attributes, list):
380+
raise TypeError("ignore_attributes should be a list")
379381
if self.row_id_attribute is not None:
380-
assert type(self.row_id_attribute) is str, "row id attribute should be a str"
382+
if not isinstance(self.row_id_attribute, six.string_types):
383+
raise TypeError("row id attribute should be a str")
381384
if exclude is not None:
382-
assert type(exclude) is list, "Exclude should be a list"
385+
if not isinstance(exclude, list):
386+
raise TypeError("Exclude should be a list")
383387
# assert all(isinstance(elem, str) for elem in exclude), "Exclude should be a list of strings"
384388
to_exclude = []
385389
if exclude is not None:

0 commit comments

Comments
 (0)