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

Method _wrap_connection_method

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

Source from the content-addressed store, hash-verified

74
75 @staticmethod
76 def _wrap_connection_method(
77 meth_name: str, iscoroutine: bool
78 ) -> Callable[..., Any]:
79 def call_con_method(self: Any, *args: Any, **kwargs: Any) -> Any:
80 # This method will be owned by PoolConnectionProxy class.
81 if self._con is None:
82 raise exceptions.InterfaceError(
83 'cannot call Connection.{}(): '
84 'connection has been released back to the pool'.format(
85 meth_name))
86
87 meth = getattr(self._con.__class__, meth_name)
88 return meth(self._con, *args, **kwargs)
89
90 if iscoroutine:
91 compat.markcoroutinefunction(call_con_method)
92
93 return call_con_method
94
95
96class PoolConnectionProxy(connection._ConnectionProxy,

Callers 1

__new__Method · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected