python 2.6 compatibility tweak

replacing set literal {} with set() for python 2.6 compatibility (plus reformatting the line)
This commit is contained in:
antonymayi 2015-11-10 14:50:54 +01:00
parent d1969b4c03
commit 8c7b18daed

View File

@ -538,7 +538,8 @@ class DMatrix(object):
msg = 'feature_names must have the same length as data' msg = 'feature_names must have the same length as data'
raise ValueError(msg) raise ValueError(msg)
# prohibit to use symbols may affect to parse. e.g. []< # prohibit to use symbols may affect to parse. e.g. []<
if not all(isinstance(f, STRING_TYPES) and not any(x in f for x in {'[', ']', '<'}) if not all(isinstance(f, STRING_TYPES) and
not any(x in f for x in set(('[', ']', '<')))
for f in feature_names): for f in feature_names):
raise ValueError('feature_names may not contain [, ] or <') raise ValueError('feature_names may not contain [, ] or <')
else: else: