Source code for cioprocessor.lib.pytransform

"""Base class for py-tranform step."""

from .i18n import _, translate


# =============================================================================
[docs]class PyTransform(object): """This class manages a py-transform step. :type pbuild: .lib.pbuild.PBuild :param pbuild: Current processor build object. :param dict step: Dictionary defining the current step. """ # ------------------------------------------------------------------------- def __init__(self, pbuild, step): """Constructor method.""" self.pbuild = pbuild self.step = step # -------------------------------------------------------------------------
[docs] def run(self): """Execute the transformation. :rtype: pyramid.i18n.TranslationString :return: An error message or ``None``. """ self.pbuild.info(self._translate( _('Step ${s}: Python transformation', {'s': self.step['num']})))
# ------------------------------------------------------------------------- def _translate(self, text): """Return ``text`` translated. :param str text: Text to translate. :rtype: str """ return translate(text, lang=self.pbuild.lang)