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