本文整理汇总了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