當前位置: 首頁>>代碼示例>>Python>>正文


Python DbClient.calculateHash方法代碼示例

本文整理匯總了Python中dbclient.DbClient.calculateHash方法的典型用法代碼示例。如果您正苦於以下問題:Python DbClient.calculateHash方法的具體用法?Python DbClient.calculateHash怎麽用?Python DbClient.calculateHash使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dbclient.DbClient的用法示例。


在下文中一共展示了DbClient.calculateHash方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testProfileHash

# 需要導入模塊: from dbclient import DbClient [as 別名]
# 或者: from dbclient.DbClient import calculateHash [as 別名]
	def testProfileHash(self):
		# Clear out and reset own profile
		myTorId = "ABC123DEF456GH78"
		myprofile = {"name" : "Constantin Taylor", "keyid" : "someKeyId", "displayName" : "Me",
					"status" : "self", "ownprofile" : True, "description":"Some fairly descriptive text",
					"birthday":None, "interests":"chocolate pudding with fudge"}
		DbClient.updateContact(myTorId, myprofile)
		firstHash = DbClient.calculateHash(DbClient.getProfile())
		self.assertEqual(firstHash, "12ae5c8dc8e1c2186b4ed4918040bb16", "First hash not what I was expecting")
		# Now change interests and check that hash changes
		DbClient.updateContact(myTorId, {"interests":"roasted vegetables and hummus"})
		secondHash = DbClient.calculateHash(DbClient.getProfile())
		self.assertNotEqual(firstHash, secondHash, "Profile hash should have changed")
開發者ID:activityworkshop,項目名稱:Murmeli,代碼行數:15,代碼來源:databasetest.py

示例2: _createSubpayload

# 需要導入模塊: from dbclient import DbClient [as 別名]
# 或者: from dbclient.DbClient import calculateHash [as 別名]
	def _createSubpayload(self):
		'''Use the stored fields to pack the payload contents together'''
		if self.profileHash is None or self.profileHash == "":
			self.profileHash = DbClient.calculateHash(DbClient.getProfile())
		return self.packBytesTogether([
			self.encodeNumberToBytes(1 if self.online else 0, 1),
			self.encodeNumberToBytes(1 if self.ping else 0, 1),
			self.profileHash])
開發者ID:activityworkshop,項目名稱:Murmeli,代碼行數:10,代碼來源:message.py


注:本文中的dbclient.DbClient.calculateHash方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。