def __call__(self, state, scope, pos, paramTypes, x, start, end, replacement): if isinstance(replacement, str): replacement = stringToBytes(replacement) if isinstance(x, str): x = stringToBytes(x) normStart, normEnd = startEnd(len(x), start, end) before = x[:normStart] after = x[normEnd:] return bytesToString(before + replacement + after)
def __call__(self, state, scope, pos, paramTypes, a, *where): if len(where) == 2: start, end = where normStart, normEnd = startEnd(len(a), start, end) before = a[:normStart] after = a[normEnd:] return before + after elif len(where) == 1: index, = where normIndex = negativeIndex(len(a), index) checkRange(len(a), normIndex, self.errcodeBase + 0, self.name, pos) before = a[:normIndex] after = a[(normIndex + 1):] return before + after
def __call__(self, state, scope, pos, paramTypes, a, start, end, replacement): normStart, normEnd = startEnd(len(a), start, end) before = a[:normStart] after = a[normEnd:] return before + replacement + after
def __call__(self, state, scope, pos, paramTypes, x, start, end, replacement): normStart, normEnd = startEnd(len(x), start, end) before = x[:normStart] after = x[normEnd:] return before + replacement + after