コード例 #1
0
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))
コード例 #2
0
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))
コード例 #3
0
ファイル: ropeunicodeobject.py プロジェクト: alkorzt/pypy
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"))
コード例 #4
0
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"))