I don't think that the _connect method that's getting called here needs to accept both async= and async_= keyword arguments, so there's an opportunity to avoid the creation of a dict. We can just pass a bool into the _connect method directly.
Note that _connect is already careful to not pass on an async_ argument unless async_'s value is True:
def _connect(dsn, connection_factory=None, async_=False):
if connection_factory is None:
connection_factory = Connection
# Mimic the construction method as used by psycopg2, which notes:
# Here we are breaking the connection.__init__ interface defined
# by psycopg2. So, if not requiring an async conn, avoid passing
# the async_ parameter.
if async_:
return connection_factory(dsn, async_=True)
else:
return connection_factory(dsn)
I don't think that the
_connect
method that's getting called here needs to accept bothasync=
andasync_=
keyword arguments, so there's an opportunity to avoid the creation of a dict. We can just pass a bool into the_connect
method directly.Note that
_connect
is already careful to not pass on anasync_
argument unlessasync_
's value is True: