def __init__(self, service, outbounds=None, threadloop=None): self._rpc = AsyncRPC( service=service, inbounds=None, outbounds=outbounds, ) self._threadloop = threadloop or ThreadLoop()
class RPC(object): """YARPC from sync-python; can be used with outbounds only.""" __slots__ = ('_rpc', '_threadloop') def __init__(self, service, outbounds=None, threadloop=None): self._rpc = AsyncRPC( service=service, inbounds=None, outbounds=outbounds, ) self._threadloop = threadloop or ThreadLoop() @property def service(self): return self._rpc.service def channel(self, *args, **kwargs): channel = self._rpc.channel(*args, **kwargs) return Channel(channel, self._threadloop) def register(self, *args, **kwargs): raise SyncRegisterNotSupportedError( "Sync is client-only and does not support registration" )