

def _set_buffering(self, grpos_range=0, frames=0, flag_mask=0):
    if (grpos_range > 0):
        self._buffer_grpos = grpos_range
        self._buffer_frames = 0
        if (flag_mask != 0):
            self._write_selected = self._write_buffering_with_index
            self._cut_selected = self._cut_grpos_flagmask
            self._buffer_flagmask = abs(flag_mask)
            self._init_index()
        else:
            self._write_selected = self._write_buffering_no_index
            self._cut_selected = self._cut_grpos
            self._buffer_flagmask = 0
            self._index = None
    elif (frames > 0):
        self._buffer_frames = grpos_range
        self._buffer_grpos = 0
        if (flag_mask != 0):
            self._write_selected = self._write_buffering_with_index
            self._cut_selected = self._cut_frames_flagmask
            self._buffer_flagmask = abs(flag_mask)
            self._init_index()
        else:
            self._write_selected = self._write_buffering_no_index
            self._cut_selected = self._cut_frames
            self._buffer_flagmask = 0
            self._index = None
    else:
        self._buffer_grpos = 0
        self._buffer_frames = 0
        self._buffer_flagmask = 0
        self._write_selected = self._write_no_buffering

dataset/ETHPy150Open arkadini/twimp/twimp/server/inmemory.py IMLiveStream._set_buffering/VarMisuse@131/196 `frames`->`grpos_range`