本文整理匯總了Python中Pyro4.expose方法的典型用法代碼示例。如果您正苦於以下問題:Python Pyro4.expose方法的具體用法?Python Pyro4.expose怎麽用?Python Pyro4.expose使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Pyro4
的用法示例。
在下文中一共展示了Pyro4.expose方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import Pyro4 [as 別名]
# 或者: from Pyro4 import expose [as 別名]
def __init__(self, locking=False, object_type=None,
instance_method=None, remote_nodes=False,
support_callback=False,
undo_method=None,
expose=True, # Determine whether the method is actually
# exposed to pyro
remote_method=None,
remote_undo_method=None):
"""Setup variables passed in via decorator as member variables."""
self.locking = locking
self.object_type = object_type
self.instance_method = instance_method
self.remote_nodes = remote_nodes
self.support_callback = support_callback
self.undo_method = undo_method
self.expose = expose
self.remote_method = remote_method
self.remote_undo_method = remote_undo_method
示例2: __call__
# 需要導入模塊: import Pyro4 [as 別名]
# 或者: from Pyro4 import expose [as 別名]
def __call__(self, callback):
"""Run when object is created.
The returned value is the method that is executed
"""
def inner(self_obj, *args, **kwargs):
"""Run when the wrapping method is called."""
# Create function object and run
function = Function(function=callback, obj=self_obj,
args=args, kwargs=kwargs,
locking=self.locking,
object_type=self.object_type,
instance_method=self.instance_method,
remote_nodes=self.remote_nodes,
support_callback=self.support_callback,
undo_method=self.undo_method,
remote_method=self.remote_method,
remote_undo_method=self.remote_undo_method)
return_val = function.run()
function.unregister()
return return_val
# Expose the function
if self.expose:
return Pyro4.expose(inner)
else:
return inner