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)
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)