MCPcopy Create free account
hub / github.com/MagicStack/asyncpg / _wrap_connection_method

Method _wrap_connection_method

asyncpg/pool.py:58–75  ·  view source on GitHub ↗
(
        meth_name: str, iscoroutine: bool
    )

Source from the content-addressed store, hash-verified

56
57 @staticmethod
58 def _wrap_connection_method(
59 meth_name: str, iscoroutine: bool
60 ) -> Callable[..., Any]:
61 def call_con_method(self: Any, *args: Any, **kwargs: Any) -> Any:
62 # This method will be owned by PoolConnectionProxy class.
63 if self._con is None:
64 raise exceptions.InterfaceError(
65 'cannot call Connection.{}(): '
66 'connection has been released back to the pool'.format(
67 meth_name))
68
69 meth = getattr(self._con.__class__, meth_name)
70 return meth(self._con, *args, **kwargs)
71
72 if iscoroutine:
73 compat.markcoroutinefunction(call_con_method)
74
75 return call_con_method
76
77
78class PoolConnectionProxy(connection._ConnectionProxy,

Callers 1

__new__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected