@contextlib.contextmanager
def bayesdb_transaction(bdb):
    if bdb.txn_depth > 0:
        raise BayesDBTxnError(bdb, 'Already in a transaction!')
    bayesdb_txn_init(bdb)
    bdb.txn_depth = 1
    try:
        with sqlite3_transaction(bdb._sqlite3):
            yield
    finally:
        assert bdb.txn_depth == 1
        bdb.txn_depth = 0
        bayesdb_txn_fini(bdb)
dataset/ETHPy150Open probcomp/bayeslite/src/txn.py/bayesdb_transaction/operator `!=` -> `>`