def unicode_endswith__Unicode_Tuple_ANY_ANY(space, w_unistr, w_suffixes, w_start, w_end): unistr, _, start, end = _convert_idx_params(space, w_unistr, space.wrap(u""), w_start, w_end, True) for w_suffix in space.fixedview(w_suffixes): suffix = space.unicode_w(w_suffix) if stringendswith(unistr, suffix, start, end): return space.w_True return space.w_False
def str_endswith__StringSlice_Tuple_ANY_ANY(space, w_self, w_suffixes, w_start, w_end): (u_self, _, start, end) = _convert_idx_params(space, w_self, space.wrap(''), w_start, w_end) for w_suffix in space.viewiterable(w_suffixes): suffix = space.str_w(w_suffix) if stringendswith(u_self, suffix, start, end): return space.w_True return space.w_False
def unicode_endswith__Unicode_Tuple_ANY_ANY(space, w_unistr, w_suffixes, w_start, w_end): unistr, start, end = _convert_idx_params(space, w_unistr, w_start, w_end, True) for w_suffix in space.fixedview(w_suffixes): suffix = space.unicode_w(w_suffix) if stringendswith(unistr, suffix, start, end): return space.w_True return space.w_False
def PyUnicode_Tailmatch(space, w_str, w_substr, start, end, direction): """Return 1 if substr matches str[start:end] at the given tail end (direction == -1 means to do a prefix match, direction == 1 a suffix match), 0 otherwise. Return -1 if an error occurred.""" str = space.unicode_w(w_str) substr = space.unicode_w(w_substr) if rffi.cast(lltype.Signed, direction) >= 0: return stringtype.stringstartswith(str, substr, start, end) else: return stringtype.stringendswith(str, substr, start, end)
def str_endswith__String_Tuple_ANY_ANY(space, w_self, w_suffixes, w_start, w_end): (u_self, _, start, end) = _convert_idx_params(space, w_self, space.wrap(""), w_start, w_end, True) for w_suffix in space.fixedview(w_suffixes): if space.is_true(space.isinstance(w_suffix, space.w_unicode)): w_u = space.call_function(space.w_unicode, w_self) return space.call_method(w_u, "endswith", w_suffixes, w_start, w_end) suffix = space.str_w(w_suffix) if stringendswith(u_self, suffix, start, end): return space.w_True return space.w_False
def PyUnicode_Tailmatch(space, w_str, w_substr, start, end, direction): """Return 1 if substr matches str[start:end] at the given tail end (direction == -1 means to do a prefix match, direction == 1 a suffix match), 0 otherwise. Return -1 if an error occurred.""" str = space.unicode_w(w_str) substr = space.unicode_w(w_substr) if rffi.cast(lltype.Signed, direction) <= 0: return stringtype.stringstartswith(str, substr, start, end) else: return stringtype.stringendswith(str, substr, start, end)
def str_endswith__String_Tuple_ANY_ANY(space, w_self, w_suffixes, w_start, w_end): (u_self, _, start, end) = _convert_idx_params(space, w_self, space.wrap(''), w_start, w_end) for w_suffix in space.unpacktuple(w_suffixes): if space.is_true(space.isinstance(w_suffix, space.w_unicode)): w_u = space.call_function(space.w_unicode, w_self) return space.call_method(w_u, "endswith", w_suffixes, w_start, w_end) suffix = space.str_w(w_suffix) if stringendswith(u_self, suffix, start, end): return space.w_True return space.w_False
def str_endswith__StringSlice_String_ANY_ANY(space, w_self, w_suffix, w_start, w_end): (u_self, suffix, start, end) = _convert_idx_params(space, w_self, w_suffix, w_start, w_end) return space.newbool(stringendswith(u_self, suffix, start, end))
def unicode_endswith__Unicode_Unicode_ANY_ANY(space, w_self, w_substr, w_start, w_end): self, start, end = _convert_idx_params(space, w_self, w_start, w_end, True) return space.newbool(stringendswith(self, w_substr._value, start, end))
def str_endswith__String_String_ANY_ANY(space, w_self, w_suffix, w_start, w_end): (u_self, suffix, start, end) = _convert_idx_params(space, w_self, w_suffix, w_start, w_end, True) return space.newbool(stringendswith(u_self, suffix, start, end))