mutate a *and* return it. a as list, splice as diff.Delta.
192195
def apply_splice(a,splice):
  ""
  a[splice.a:splice.b]=splice.text # text isn't always text. See diff comments.
  return a
920682
def mutate_stream (instream, outstream):
    """"""

    chunk = None
    key = None
    data = None
    misclines = []

    for fullline in instream:
        line = fullline.split ('#', 1)[0]

        m = sectionre.match (line)
        if m is not None:
            # New chunk
            if chunk is not None:
                if key is not None:
                    chunk.data.set_one (key, data.strip ().decode ('utf8'))
                    key = data = None
                yield chunk
                chunk.emit (outstream)

            chunk = FileChunk ()
            for miscline in misclines:
                chunk._addLine (miscline, None)
            misclines = []
            chunk.data.section = m.group (1)
            chunk._addLine (fullline, None)
            continue

        if len (line.strip ()) == 0:
            if key is not None:
                chunk.data.set_one (key, data.strip ().decode ('utf8'))
                key = data = None
            if chunk is not None:
                chunk._addLine (fullline, None)
            else:
                misclines.append (fullline)
            continue

        m = escre.match (fullline)
        if m is not None:
            if chunk is None:
                raise InifileError ('key seen without section!')
            if key is not None:
                chunk.data.set_one (key, data.strip ().decode ('utf8'))
            key = m.group (1)
            data = m.group (2).replace (r'\"', '"').replace (r'\n', '\n').replace (r'\\', '\\')
            chunk.data.set_one (key, data.decode ('utf8'))
            chunk._addLine (fullline, key)
            key = data = None
            continue

        m = keyre.match (line)
        if m is not None:
            if chunk is None:
                raise InifileError ('key seen without section!')
            if key is not None:
                chunk.data.set_one (key, data.strip ().decode ('utf8'))
            key = m.group (1)
            data = m.group (2)
            if not data[-1].isspace ():
                data += ' '
            chunk._addLine (fullline, key)
            continue

        if line[0].isspace () and key is not None:
            data += line.strip () + ' '
            chunk._addLine (fullline, key)
            continue

        raise InifileError ('unparsable line: ' + line[:-1])

    if chunk is not None:
        if key is not None:
            chunk.data.set_one (key, data.strip ().decode ('utf8'))
        yield chunk
        chunk.emit (outstream)
807602
public void mutate(float amount) {
		for (int i = 0; i < numKnots; i++) {
			int rgb = yKnots[i];
			int r = ((rgb >> 16) & 0xff);
			int g = ((rgb >> 8) & 0xff);
			int b = (rgb & 0xff);
			r = PixelUtils.clamp( (int)(r + amount * 255 * (Math.random()-0.5)) );
			g = PixelUtils.clamp( (int)(g + amount * 255 * (Math.random()-0.5)) );
			b = PixelUtils.clamp( (int)(b + amount * 255 * (Math.random()-0.5)) );
			yKnots[i] = 0xff000000 | (r << 16) | (g << 8) | b;
			knotTypes[i] = RGB|SPLINE;
		}
		sortKnots();
		rebuildGradient();
	}
930299
def list_combiner(value, mutator, *args, **kwargs):
    
    value.append(mutator(*args, **kwargs))
    return value
910188
def _deduplicate(lst):
    """"""
    out = []
    for i in lst:
        if i not in out:
            out.append(i)
    return out
1315318
def copy(src, dst, merge, write_v1=True, excluded_tags=None, verbose=False):
    """"""

    if excluded_tags is None:
        excluded_tags = []

    try:
        id3 = mutagen.id3.ID3(src, translate=False)
    except mutagen.id3.ID3NoHeaderError:
        print_(u"No ID3 header found in ", src, file=sys.stderr)
        return 1
    except Exception as err:
        print_(str(err), file=sys.stderr)
        return 1

    if verbose:
        print_(u"File", src, u"contains:", file=sys.stderr)
        print_(id3.pprint(), file=sys.stderr)

    for tag in excluded_tags:
        id3.delall(tag)

    if merge:
        try:
            target = mutagen.id3.ID3(dst, translate=False)
        except mutagen.id3.ID3NoHeaderError:
            # no need to merge
            pass
        except Exception as err:
            print_(str(err), file=sys.stderr)
            return 1
        else:
            for frame in id3.values():
                target.add(frame)

            id3 = target

    # if the source is 2.3 save it as 2.3
    if id3.version < (2, 4, 0):
        id3.update_to_v23()
        v2_version = 3
    else:
        id3.update_to_v24()
        v2_version = 4

    try:
        id3.save(dst, v1=(2 if write_v1 else 0), v2_version=v2_version)
    except Exception as err:
        print_(u"Error saving", dst, u":\n%s" % text_type(err),
               file=sys.stderr)
        return 1
    else:
        if verbose:
            print_(u"Successfully saved", dst, file=sys.stderr)
        return 0
1092044
function mutable(/* a[, b[, ...]] */)
{
  var args   = Array.prototype.slice.call(arguments)
    , result = args.shift()
    ;

  while (args.length)
  {
    result = merge.call(this, result, args.shift());
  }

  return result;
}
576359
def batch_mutate(self, mutation_map, consistency_level):
    
    self._seqid += 1
    d = self._reqs[self._seqid] = defer.Deferred()
    self.send_batch_mutate(mutation_map, consistency_level)
    return d
383680
def _slice_replace(code, index, old, new):
        """"""
        nodes = [str(node) for node in code.get(index)]
        substring = "".join(nodes).replace(old, new)
        code.nodes[index] = parse_anything(substring).nodes
120149
def coerce(cls, key, value):
        """"""
        if not isinstance(value, MutationList):
            if isinstance(value, list):
                return MutationList(value)

            # this call will raise ValueError
            return Mutable.coerce(key, value)
        else:
            return value
1090373
def substitution_set(string, indexes):
    
    strlen = len(string)
    return {mutate_string(string, x) for x in indexes if valid_substitution(strlen, x)}
976410
def _diff(text_0, text_1):
    """"""
    diff = difflib.ndiff(text_0.splitlines(), text_1.splitlines())
    return _diff_removed_lines(diff)
896501
def mutable(function):
    ''''''

    def wrapper(self, *args, **kwargs):
        state = self._get_state()
        return function(self, state, *args, **kwargs)

    return wrapper
328728
function arraySpliceIn(mutate, at, v, arr) {
    var len = arr.length;
    if (mutate) {
        var _i = len;
        while (_i >= at) {
            arr[_i--] = arr[_i];
        }arr[at] = v;
        return arr;
    }
    var i = 0,
        g = 0;
    var out = new Array(len + 1);
    while (i < at) {
        out[g++] = arr[i++];
    }out[at] = v;
    while (i < len) {
        out[++g] = arr[i++];
    }return out;
}
1062377
def flatten(in_list):
    """"""
    out_list = []
    for val in in_list:
        if isinstance(val, list):
            out_list.extend(val)
        else:
            out_list.append(val)

    return out_list
991787
def trunc_list(s: List) -> List:
    """"""
    if len(s) > max_list_size:
        i = max_list_size // 2
        j = i - 1
        s = s[:i] + [ELLIPSIS] + s[-j:]
    return s
1105143
def mutate(self, field):
        
        new_val = self.next_val(field)
        field._pfp__set_value(new_val)
        return field