当前位置: 首页>>代码示例>>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;未经允许,请勿转载。