def __exit__(self, exc_type, exc_val, exc_tb):

        with self._lock:

            # close the cursor
            cur = self._cur_stack.pop()
            self.putcur(cur)

            # rollback or commit
            if exc_type:
                self._conn.rollback()
            else:
                self._conn.commit()

            # close the connection if all cursors are closed and not to keep
            if self._conn and not self._cur_stack or not self.to_keep_conn:
                self.putconn(self._conn)
                self._conn = None
dataset/ETHPy150Open moskytw/mosql/mosql/db.py/Database.__exit__/operator `and` -> `or`