コード例 #1
0
ファイル: ReformatAction.py プロジェクト: goc9000/baon
    def _compile_function(self):
        if self.specifier == 'd':
            if self.width is None:
                return wrap_simple_text_function(strip_zeroes)
            if self.width <= 0:
                raise WidthMustBeAtLeast1ForSpecifierError(self.specifier)

            return wrap_simple_text_function(lambda text: pad_with_zeroes(text, self.width))

        raise UnrecognizedFormatSpecifierError(self.specifier)
コード例 #2
0
ファイル: ApplyFunctionAction.py プロジェクト: goc9000/baon
 def _compile_function(self):
     if self.function_name in SIMPLE_FUNC_DICT:
         return wrap_simple_text_function(SIMPLE_FUNC_DICT[self.function_name])
     elif self.function_name in FUNC_DICT:
         return FUNC_DICT[self.function_name]
     else:
         raise UnsupportedFunctionError(self.function_name)