<s> """<STR_LIT>""" <EOL> from copy import copy <EOL> from ramp . features . base import BaseFeature , ComboFeature <EOL> def inject_feature ( feature , feature_to_inject , ** kwargs ) : <EOL> feature = copy ( feature ) <EOL> if type ( feature ) == BaseFeature : <EOL> return feature_to_inject ( feature , ** kwargs ) <EOL> if not issubclass ( type ( feature ) , ComboFeature ) : <EOL> return feature <EOL> sub_features = [ ] <EOL> for sub_feature in feature . features : <EOL> if type ( sub_feature ) == BaseFeature : <EOL> sub_features . append ( feature_to_inject ( sub_feature , ** kwargs ) ) <EOL> else : <EOL> sub_features . append ( inject_feature ( sub_feature , feature_to_inject , ** kwargs ) ) <EOL> feature . set_features ( sub_features ) <EOL> return feature <EOL> def pre_transform_features ( features , transform_feature , ** kwargs ) : <EOL> transformed_features = [ ] <EOL> for feature in features : <EOL> transformed_features . append ( inject_feature ( feature , transform_feature , ** kwargs ) ) <EOL> return transformed_features </s>
