This commit is contained in:
Mario Bourgoin 2018-11-02 16:37:39 -04:00
Родитель 130e6d91f1
Коммит ba2bf781df
1 изменённых файлов: 3 добавлений и 4 удалений

Просмотреть файл

@ -37,11 +37,10 @@ class ItemSelector(BaseEstimator, TransformerMixin):
""" """
def __init__(self, keys): def __init__(self, keys):
if type(self.keys) is list: if type(keys) is list:
if not all([getattr(key, '__hash__', None) is not None if any([getattr(key, '__hash__', None) is None for key in keys]):
for key in keys]):
raise TypeError('Not all keys are hashable') raise TypeError('Not all keys are hashable')
elif not getattr(keys, '__hash__', None) is not None: elif getattr(keys, '__hash__', None) is None:
raise TypeError('keys is not hashable') raise TypeError('keys is not hashable')
self.keys = keys self.keys = keys