def __setitem__(self, idx, item):
if not isinstance(idx, slice):<EOL><INDENT>i = adjust_index(idx)<EOL>lines = [item] if item is not None else []<EOL>return self.request('<STR_LIT>', i, i + <NUM_LIT:1>, True, lines)<EOL><DEDENT>lines = item if item is not None else []<EOL>start = adjust_index(idx.start, <NUM_LIT:0>)<EOL>end = adjust_index(idx.stop, -<NUM_LIT:1>)<EOL>return self.request('<STR_LIT>', start, end, False, lines)<EOL>
Replace a buffer line or slice by integer index.

        Like with `__getitem__`, indexes may be negative.

        When replacing slices, omiting indexes(eg: `buffer[:]`) will replace
        the whole buffer.