def _apply_transformations(self, config): transformer = configsuite.Transformer(self._schema, MK.Transformation, ()) trans_res = transformer.transform(config) self._errors += trans_res.errors self._valid &= len(trans_res.errors) == 0 return trans_res.result
def _build_transformed_layers(self): layer_transformer = configsuite.Transformer(self._schema, MK.LayerTransformation, (), bottom_up=False) layers = [] for layer in self._layers: trans_layer = layer_transformer.transform(layer) self._errors += trans_layer.errors layers.append(trans_layer.result) self._valid &= len(self._errors) == 0 return layers
def _apply_context_transformations(self, config): prelim_snapshot = self._build_snapshot(config, self._schema) try: context = self._extract_transformation_context(prelim_snapshot) # pylint: disable=broad-except except Exception as e: self._valid = False self._errors += (configsuite.ContextExtractionError(str(e), ()), ) return config context_transformer = configsuite.Transformer(self._schema, MK.ContextTransformation, (context, )) trans_res = context_transformer.transform(config) self._errors += trans_res.errors self._valid &= len(trans_res.errors) == 0 return trans_res.result