示例#1
0
def unicode_startswith__RopeUnicode_Tuple_ANY_ANY(space, w_unistr, w_prefixes, w_start, w_end):
    unistr, start, end = _convert_idx_params(space, w_unistr, w_start, w_end)
    for w_prefix in space.fixedview(w_prefixes):
        prefix = ropeunicode_w(space, w_prefix)
        if rope.startswith(unistr, prefix, start, end):
            return space.w_True
    return space.w_False
示例#2
0
def unicode_startswith__RopeUnicode_RopeUnicode_ANY_ANY(space, w_self, w_substr, w_start, w_end):
    self, start, end = _convert_idx_params(space, w_self, w_start, w_end)
    # XXX this stuff can be waaay better for ootypebased backends if
    #     we re-use more of our rpython machinery (ie implement startswith
    #     with additional parameters as rpython)

    self, start, end = _convert_idx_params(space, w_self, w_start, w_end)
    return space.newbool(rope.startswith(self, w_substr._node, start, end))
示例#3
0
def unicode_startswith__RopeUnicode_Tuple_ANY_ANY(space, w_unistr, w_prefixes,
                                                  w_start, w_end):
    unistr, start, end = _convert_idx_params(space, w_unistr, w_start, w_end)
    for w_prefix in space.fixedview(w_prefixes):
        prefix = ropeunicode_w(space, w_prefix)
        if rope.startswith(unistr, prefix, start, end):
            return space.w_True
    return space.w_False
示例#4
0
def unicode_startswith__RopeUnicode_RopeUnicode_ANY_ANY(space, w_self, w_substr, w_start, w_end):
    self, start, end = _convert_idx_params(space, w_self, w_start, w_end)
    # XXX this stuff can be waaay better for ootypebased backends if
    #     we re-use more of our rpython machinery (ie implement startswith
    #     with additional parameters as rpython)

    self, start, end = _convert_idx_params(space, w_self, w_start, w_end)
    return space.newbool(rope.startswith(self, w_substr._node, start, end))
示例#5
0
def str_startswith__Rope_Tuple_ANY_ANY(space, w_self, w_prefixes, w_start, w_end):
    (self, _, start, end) = _convert_idx_params(space, w_self, W_RopeObject.EMPTY, w_start, w_end, True)
    for w_prefix in space.fixedview(w_prefixes):
        if space.isinstance_w(w_prefix, space.w_unicode):
            w_u = space.call_function(space.w_unicode, w_self)
            return space.call_method(w_u, "startswith", w_prefixes, w_start, w_end)
        prefix = rope_w(space, w_prefix)
        if rope.startswith(self, prefix, start, end):
            return space.w_True
    return space.w_False
示例#6
0
def str_startswith__Rope_Tuple_ANY_ANY(space, w_self, w_prefixes, w_start, w_end):
    (self, _, start, end) = _convert_idx_params(space, w_self, W_RopeObject.EMPTY,
                                                  w_start, w_end)
    for w_prefix in space.unpacktuple(w_prefixes):
        if space.is_true(space.isinstance(w_prefix, space.w_unicode)):
            w_u = space.call_function(space.w_unicode, w_self)
            return space.call_method(w_u, "startswith", w_prefixes, w_start,
                                     w_end)
        prefix = rope_w(space, w_prefix)
        if rope.startswith(self, prefix, start, end):
            return space.w_True
    return space.w_False
示例#7
0
def str_startswith__Rope_Rope_ANY_ANY(space, w_self, w_prefix, w_start, w_end):
    (self, prefix, start, end) = _convert_idx_params(space, w_self,
                                                     w_prefix, w_start, w_end)
    return space.newbool(rope.startswith(self, prefix, start, end))
示例#8
0
def str_startswith__Rope_Rope_ANY_ANY(space, w_self, w_prefix, w_start, w_end):
    (self, prefix, start, end) = _convert_idx_params(space, w_self,
                                                     w_prefix, w_start, w_end,
                                                     True)
    return space.newbool(rope.startswith(self, prefix, start, end))