def __enter__(self): if self.result == 0: cmds.undoInfo(stateWithoutFlush=0) else: cmds.undoInfo(openChunk=1)