22import io
33import logging
44import os
5+ import pickle
56from collections import OrderedDict
67
78import arff
89import numpy as np
910import scipy .sparse
1011import xmltodict
11- import six
12- from six .moves import cPickle as pickle
1312from warnings import warn
1413
1514import openml ._api_calls
@@ -122,7 +121,7 @@ def __init__(self, name, description, format=None,
122121 self .default_target_attribute = default_target_attribute
123122 self .row_id_attribute = row_id_attribute
124123 self .ignore_attributes = None
125- if isinstance (ignore_attribute , six . string_types ):
124+ if isinstance (ignore_attribute , str ):
126125 self .ignore_attributes = [ignore_attribute ]
127126 elif isinstance (ignore_attribute , list ):
128127 self .ignore_attributes = ignore_attribute
@@ -159,10 +158,7 @@ def __init__(self, name, description, format=None,
159158
160159 if data_file is not None :
161160 if self ._data_features_supported ():
162- if six .PY2 :
163- self .data_pickle_file = data_file .replace ('.arff' , '.pkl.py2' )
164- else :
165- self .data_pickle_file = data_file .replace ('.arff' , '.pkl.py3' )
161+ self .data_pickle_file = data_file .replace ('.arff' , '.pkl.py3' )
166162
167163 if os .path .exists (self .data_pickle_file ):
168164 logger .debug ("Data pickle file already exists." )
@@ -327,7 +323,7 @@ def get_data(self, target=None,
327323 if not self .row_id_attribute :
328324 pass
329325 else :
330- if isinstance (self .row_id_attribute , six . string_types ):
326+ if isinstance (self .row_id_attribute , str ):
331327 to_exclude .append (self .row_id_attribute )
332328 else :
333329 to_exclude .extend (self .row_id_attribute )
@@ -336,7 +332,7 @@ def get_data(self, target=None,
336332 if not self .ignore_attributes :
337333 pass
338334 else :
339- if isinstance (self .ignore_attributes , six . string_types ):
335+ if isinstance (self .ignore_attributes , str ):
340336 to_exclude .append (self .ignore_attributes )
341337 else :
342338 to_exclude .extend (self .ignore_attributes )
@@ -354,7 +350,7 @@ def get_data(self, target=None,
354350 if target is None :
355351 rval .append (data )
356352 else :
357- if isinstance (target , six . string_types ):
353+ if isinstance (target , str ):
358354 if ',' in target :
359355 target = target .split (',' )
360356 else :
@@ -368,7 +364,7 @@ def get_data(self, target=None,
368364 )
369365 target_categorical = [
370366 cat for cat , column in
371- six . moves . zip (categorical , attribute_names )
367+ zip (categorical , attribute_names )
372368 if column in target
373369 ]
374370 target_dtype = int if target_categorical [0 ] else float
@@ -475,7 +471,7 @@ def get_features_by_type(self, data_type, exclude=None,
475471 if not isinstance (self .ignore_attributes , list ):
476472 raise TypeError ("ignore_attributes should be a list" )
477473 if self .row_id_attribute is not None :
478- if not isinstance (self .row_id_attribute , six . string_types ):
474+ if not isinstance (self .row_id_attribute , str ):
479475 raise TypeError ("row id attribute should be a str" )
480476 if exclude is not None :
481477 if not isinstance (exclude , list ):
0 commit comments