本文整理汇总了Python中contact.Contact.from_tuple方法的典型用法代码示例。如果您正苦于以下问题:Python Contact.from_tuple方法的具体用法?Python Contact.from_tuple怎么用?Python Contact.from_tuple使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类contact.Contact
的用法示例。
在下文中一共展示了Contact.from_tuple方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: got_forward_message
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import from_tuple [as 别名]
def got_forward_message(self, contact, obj):
self.forward(
key=obj.key,
message=obj.message,
raw_key=obj.raw_key,
requester=Contact.from_tuple(obj.requester, self)
)
示例2: got_leave_message
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import from_tuple [as 别名]
def got_leave_message(self, contact, obj):
# special case: only one node in the system
if contact == self.contacts.me():
# don't bother doing anything, just call the callback
self.callback_manager.call(obj.request_id, contact)
return
for key in obj.data:
self.data[key] = self.value_from_wire(obj.data[key])
self.contacts.set_successor(Contact.from_tuple(obj.successor, self))
self.contacts.get_successor().send(LeaveUpdateSuccessor(leaving=contact.to_tuple()))
self.contacts.remove(contact)
contact.send(LeaveResponse(request_id=obj.request_id))
示例3: get_requester
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import from_tuple [as 别名]
def get_requester(self, contact, obj):
if hasattr(obj, 'requester'):
return Contact.from_tuple(obj.requester, self)
return contact
示例4: stabilize_got_successor_predecessor
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import from_tuple [as 别名]
def stabilize_got_successor_predecessor(self, contact, obj):
x = Contact.from_tuple(obj.predecessor, self)
if keyspace_compare(self.id, self.contacts.get_successor().id, x.id):
self.contacts.set_successor(x)
self.contacts.get_successor().send(StabilizeNotify())
示例5: got_leave_update_successor
# 需要导入模块: from contact import Contact [as 别名]
# 或者: from contact.Contact import from_tuple [as 别名]
def got_leave_update_successor(self, contact, obj):
self.contacts.remove(Contact.from_tuple(obj.leaving, self))
self.contacts.set_predecessor(contact)