Code Duplication    Length = 15-18 lines in 2 locations

skchem/features/atom.py 1 location

@@ 269-286 (lines=18) @@
266
    def features(self):
267
        return self._features
268
269
    @features.setter
270
    def features(self, features):
271
        if isinstance(features, str):
272
            if features == 'all':
273
                features = ATOM_FEATURES
274
            else:
275
                features = {features: ATOM_FEATURES[features]}
276
        elif isinstance(features, list):
277
            features = {feature: ATOM_FEATURES[feature]
278
                        for feature in features}
279
        elif isinstance(features, (dict, pd.Series)):
280
            features = features
281
        else:
282
            raise NotImplementedError('Cannot use features {}'.format(
283
                features))
284
285
        self._features = pd.Series(features)
286
        self._features.index.name = 'atom_features'
287
288
    @property
289
    def minor_axis(self):

skchem/features/physicochemical.py 1 location

@@ 43-57 (lines=15) @@
40
    def features(self):
41
        return self._features
42
43
    @features.setter
44
    def features(self, features):
45
        if features == 'all':
46
            features = DESCRIPTORS
47
        elif isinstance(features, str):
48
            features = {features: DESCRIPTORS[features]}
49
        elif isinstance(features, list):
50
            features = {feature: DESCRIPTORS[feature] for feature in features}
51
        elif isinstance(features, (dict, pd.Series)):
52
            features = features
53
        else:
54
            raise NotImplementedError('Cannot use features {}'.format(features))
55
56
        self._features = pd.Series(features)
57
        self._features.index.name = 'physicochemical_features'
58
59
    @property
60
    def name(self):