

def __getitem__(self, frame):
    if (frame in self):
        return super(GameState, self).__getitem__(frame)
    key = bisect_left(self._frames, frame)
    if ((key == len(self._frames)) or (self._frames[key] > frame)):
        prev_frame = self._frames[(key - 1)]
    else:
        prev_frame = self._frames[key]
    if self.locked:
        state = self[prev_frame]
    else:
        state = self[prev_frame]
        if hasattr(state, 'copy'):
            state = state.copy()
    self[frame] = state
    return state

dataset/ETHPy150Open GraylinKim/sc2reader/sc2reader/engine/utils.py GameState.__getitem__/original