本文整理汇总了Python中twisted.internet.defer.execute方法的典型用法代码示例。如果您正苦于以下问题:Python defer.execute方法的具体用法?Python defer.execute怎么用?Python defer.execute使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twisted.internet.defer
的用法示例。
在下文中一共展示了defer.execute方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __getattr__
# 需要导入模块: from twisted.internet import defer [as 别名]
# 或者: from twisted.internet.defer import execute [as 别名]
def __getattr__(self, name):
"""
Pass attributes through to the real L{BrokerServer}, after checking
that they're encodable with AMP.
"""
original = getattr(self.broker_server, name, None)
if (name in get_remote_methods(self.broker_server) and
original is not None and
callable(original)
):
def method(*args, **kwargs):
for arg in args:
assert MethodCallArgument.check(arg)
for k, v in iteritems(kwargs):
assert MethodCallArgument.check(v)
return execute(original, *args, **kwargs)
return method
else:
raise AttributeError(name)
示例2: listen
# 需要导入模块: from twisted.internet import defer [as 别名]
# 或者: from twisted.internet.defer import execute [as 别名]
def listen(self, stdioProtocolFactory):
"""
Implement L{IStreamServerEndpoint.listen} to listen on stdin/stdout
"""
return defer.execute(self._stdio,
stdioProtocolFactory.buildProtocol(PipeAddress()),
reactor=self._reactor)
示例3: listen
# 需要导入模块: from twisted.internet import defer [as 别名]
# 或者: from twisted.internet.defer import execute [as 别名]
def listen(self, factory):
"""Implement IStreamServerEndpoint.listen to listen on TCP.
Optionally configuring TLS behind the HAProxy protocol.
"""
if self._ssl_cf:
factory = TLSMemoryBIOFactory(self._ssl_cf, False, factory)
proxyf = self.wrapper_factory(factory)
return defer.execute(self._listen, self._port, proxyf, **self._kwargs)
示例4: listen
# 需要导入模块: from twisted.internet import defer [as 别名]
# 或者: from twisted.internet.defer import execute [as 别名]
def listen(self, protocolFactory):
"""
Implement L{IStreamServerEndpoint.listen} to listen on a TCP socket
"""
return defer.execute(self._reactor.listenTCP,
self._port,
protocolFactory,
backlog=self._backlog,
interface=self._interface)
示例5: loadModel
# 需要导入模块: from twisted.internet import defer [as 别名]
# 或者: from twisted.internet.defer import execute [as 别名]
def loadModel(self, path, request):
"""Load a model, for the given path and request.
@rtype: L{Deferred}
"""
from twisted.internet.defer import execute
return execute(self.loadModelNow, path, request)