def format(space, w_fmt, values_w, w_valuedict=None, do_unicode=False): "Entry point" if not do_unicode: fmt = space.str_w(w_fmt) formatter = StringFormatter(space, fmt, values_w, w_valuedict) try: result = formatter.format() except NeedUnicodeFormattingError: # fall through to the unicode case fmt = unicode(fmt) else: check_annotation(result, is_list_of_chars_or_unichars) return space.wrap(''.join(result)) else: fmt = space.unicode_w(w_fmt) formatter = UnicodeFormatter(space, fmt, values_w, w_valuedict) result = formatter.format() check_annotation(result, is_list_of_chars_or_unichars) return space.wrap(u''.join(result))
def g(x): check_annotation(x, checker) return x
def f(x): result = [x] check_annotation(result, checker) return result