

def __enter__(self):
    with self._lock:
        if (not self._conn):
            assert callable(self.getconn), "You must set getconn if you                 don't specify a module."
            self._conn = self.getconn()
        cur = self.getcur(self._conn)
        self._cur_stack.append(cur)
        return cur

dataset/ETHPy150Open moskytw/mosql/mosql/db.py Database.__enter__/original