Skip to content

Commit 900676a

Browse files
committed
fixed string check with python 2 compatible code
1 parent 7de99ff commit 900676a

1 file changed

Lines changed: 4 additions & 3 deletions

File tree

openml/datasets/dataset.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
import scipy.sparse
1111
import xmltodict
1212

13+
from builtins import str
1314
from .data_feature import OpenMLDataFeature
1415
from ..exceptions import PyOpenMLError
1516

@@ -65,14 +66,14 @@ def __init__(self, dataset_id=None, name=None, version=None, description=None,
6566
self.default_target_attribute = default_target_attribute
6667
self.row_id_attribute = row_id_attribute
6768
self.ignore_attributes = None
68-
if type(ignore_attribute) == str:
69+
if isinstance(ignore_attribute, str):
6970
self.ignore_attributes = [ignore_attribute]
70-
elif type(ignore_attribute) == list:
71+
elif isinstance(ignore_attribute, list):
7172
self.ignore_attributes = ignore_attribute
7273
elif ignore_attribute is None:
7374
pass
7475
else:
75-
raise ValueError('wrong data type for ignore_attribute. Should be list (or string). ')
76+
raise ValueError('wrong data type for ignore_attribute. Should be list. ')
7677
self.version_label = version_label
7778
self.citation = citation
7879
self.tag = tag

0 commit comments

Comments
 (0)