当前位置: 首页>>代码示例>>Python>>正文


Python Path.certificates方法代码示例

本文整理汇总了Python中Path.Path.certificates方法的典型用法代码示例。如果您正苦于以下问题:Python Path.certificates方法的具体用法?Python Path.certificates怎么用?Python Path.certificates使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Path.Path的用法示例。


在下文中一共展示了Path.certificates方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: readPubKeyFromCache

# 需要导入模块: from Path import Path [as 别名]
# 或者: from Path.Path import certificates [as 别名]
def readPubKeyFromCache(_keyHash):
	path = Path.certificates(_keyHash)
	if not os.path.isfile(path) : return ''
	with open(path, 'rb') as f :
		str_ = f.read()
	(head, sep, tail) = str_.partition('\n-----END PUBLIC KEY-----')
	return ''.join((head, sep)).encode('utf-8')
开发者ID:F1ash,项目名称:LightMight,代码行数:9,代码来源:Functions.py

示例2: saveContactPolicy

# 需要导入模块: from Path import Path [as 别名]
# 或者: from Path.Path import certificates [as 别名]
def saveContactPolicy(idx, fileName):
	path = Path.certificates(fileName)
	if not os.path.isfile(path) : return ''
	with open(path, 'rb') as f :
		str_ = f.read()
	(head, sep, tail) = str_.partition('\n-----END PUBLIC KEY-----\n')
	with open(path, 'wb') as f :
		str_ = ''.join((head, sep, str(idx)))
		f.write(str_)
开发者ID:F1ash,项目名称:LightMight,代码行数:11,代码来源:Functions.py

示例3: readCashPolicy

# 需要导入模块: from Path import Path [as 别名]
# 或者: from Path.Path import certificates [as 别名]
def readCashPolicy(str_, policy):
	fileName = hashKey(str_)
	path_ = Path.certificates(fileName)
	if os.path.isfile(path_) :
		with open(path_, 'rb') as f :
			data = f.read()
		chunks = data.split()
		policy = int(chunks[len(chunks) - 1])
	return policy
开发者ID:F1ash,项目名称:LightMight,代码行数:11,代码来源:Functions.py

示例4: addToCertCache

# 需要导入模块: from Path import Path [as 别名]
# 或者: from Path.Path import certificates [as 别名]
def addToCertCache(str_, policy):
	fileName = hashKey(str_)
	path_ = Path.certificates(fileName)
	if not os.path.isfile(path_) :
		with open(path_, 'wb') as f :
			f.write(''.join((str_.encode('utf-8'), str(policy))))
	else :
		with open(path_, 'rb') as f :
			data = f.read()
		chunks = data.split()
		policy = int(chunks[len(chunks) - 1])
	return policy
开发者ID:F1ash,项目名称:LightMight,代码行数:14,代码来源:Functions.py


注:本文中的Path.Path.certificates方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。