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

Method from_callable

asyncpg/connection.py:2682–2693  ·  view source on GitHub ↗
(cls, cb: typing.Callable[..., None])

Source from the content-addressed store, hash-verified

2680
2681 @classmethod
2682 def from_callable(cls, cb: typing.Callable[..., None]) -> '_Callback':
2683 if inspect.iscoroutinefunction(cb):
2684 is_async = True
2685 elif callable(cb):
2686 is_async = False
2687 else:
2688 raise exceptions.InterfaceError(
2689 'expected a callable or an `async def` function,'
2690 'got {!r}'.format(cb)
2691 )
2692
2693 return cls(cb, is_async)
2694
2695
2696class _Atomic:

Callers 8

add_listenerMethod · 0.80
remove_listenerMethod · 0.80
add_log_listenerMethod · 0.80
remove_log_listenerMethod · 0.80
add_query_loggerMethod · 0.80
remove_query_loggerMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected