def connect(
    database: Union[str, Path], *, loop: asyncio.AbstractEventLoop = None, **kwargs: Any
) -> Connection:
    """Create and return a connection proxy to the sqlite database."""
    if loop is None:
        loop = asyncio.get_event_loop()

    def connector() -> sqlite3.Connection:
        if isinstance(database, str):
            loc = database
        elif isinstance(database, bytes):
            loc = database.decode("utf-8")
        else:
            loc = str(database)

        return sqlite3.connect(loc, **kwargs)

    return Connection(connector, loop)
def connect ( database : Union [ str , Path ] , * , loop : asyncio . AbstractEventLoop = None , ** kwargs : Any ) -> Connection : if loop is None : loop = asyncio . get_event_loop ( ) def connector ( ) -> sqlite3 . Connection : if isinstance ( database , str ) : loc = database elif isinstance ( database , bytes ) : loc = database . decode ( "utf-8" ) else : loc = str ( database ) return sqlite3 . connect ( loc , ** kwargs ) return Connection ( connector , loop )
Create and return a connection proxy to the sqlite database.