INNER CODE UNIT · Python
__init__
Xeron2000/openOii · backend/aiosqlite/__init__.py:130
def __init__(self, connector) -> None:
self._connector = connector
self._conn: sqlite3.Connection | None = None
def __await__(self):
return self._open().__await__()
async def __aenter__(self) -> "Connection":
return await self._open()
async def __aexit__(self, exc_type, exc_val, exc_tb) -> None:
await self.close()
async def _open(self) -> "Connection":
await asyncio.sleep(0)
if self._conn is None:
self._conn = self._connector()
return self