def unicode_expandtabs__RopeUnicode_ANY(space, w_self, w_tabsize): from pypy.objspace.std.ropeobject import _tabindent self = w_self._node tabsize = space.int_w(w_tabsize) splitted = rope.split(self, rope.LiteralStringNode.PREBUILT[ord('\t')]) last = splitted[0] expanded = [last] for i in range(1, len(splitted)): expanded.append(rope.multiply(rope.LiteralStringNode.PREBUILT[ord(" ")], _tabindent(last, tabsize))) last = splitted[i] expanded.append(last) return W_RopeUnicodeObject(rope.rebalance(expanded))
def unicode_expandtabs__RopeUnicode_ANY(space, w_self, w_tabsize): from pypy.objspace.std.ropeobject import _tabindent self = w_self._node tabsize = space.int_w(w_tabsize) splitted = rope.split(self, rope.LiteralStringNode.PREBUILT[ord('\t')]) last = splitted[0] expanded = [last] for i in range(1, len(splitted)): expanded.append( rope.multiply(rope.LiteralStringNode.PREBUILT[ord(" ")], _tabindent(last, tabsize))) last = splitted[i] expanded.append(last) return W_RopeUnicodeObject(rope.rebalance(expanded))
def unicode_expandtabs__RopeUnicode_ANY(space, w_self, w_tabsize): from pypy.objspace.std.ropeobject import _tabindent self = w_self._node tabsize = space.int_w(w_tabsize) splitted = rope.split(self, rope.LiteralStringNode.PREBUILT[ord("\t")]) last = splitted[0] expanded = [last] for i in range(1, len(splitted)): expanded.append(rope.multiply(rope.LiteralStringNode.PREBUILT[ord(" ")], _tabindent(last, tabsize))) last = splitted[i] expanded.append(last) try: return W_RopeUnicodeObject(rope.rebalance(expanded)) except OverflowError: raise OperationError(space.w_OverflowError, space.wrap("string too long"))
def unicode_expandtabs__RopeUnicode_ANY(space, w_self, w_tabsize): from pypy.objspace.std.ropeobject import _tabindent self = w_self._node tabsize = space.int_w(w_tabsize) splitted = rope.split(self, rope.LiteralStringNode.PREBUILT[ord('\t')]) last = splitted[0] expanded = [last] for i in range(1, len(splitted)): expanded.append(rope.multiply(rope.LiteralStringNode.PREBUILT[ord(" ")], _tabindent(last, tabsize))) last = splitted[i] expanded.append(last) try: return W_RopeUnicodeObject(rope.rebalance(expanded)) except OverflowError: raise OperationError(space.w_OverflowError, space.wrap("string too long"))