本文整理汇总了Python中kmip.core.primitives.Base.is_tag_next方法的典型用法代码示例。如果您正苦于以下问题:Python Base.is_tag_next方法的具体用法?Python Base.is_tag_next怎么用?Python Base.is_tag_next使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kmip.core.primitives.Base
的用法示例。
在下文中一共展示了Base.is_tag_next方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_is_tag_next_invalid
# 需要导入模块: from kmip.core.primitives import Base [as 别名]
# 或者: from kmip.core.primitives.Base import is_tag_next [as 别名]
def test_is_tag_next_invalid(self):
encoding = (b'\x42\x00\x01')
base = Base()
self.stream = BytearrayStream(encoding)
self.assertFalse(Base.is_tag_next(base.tag, self.stream),
self.bad_match.format('tag', 'mismatch', 'match'))
示例2: process
# 需要导入模块: from kmip.core.primitives import Base [as 别名]
# 或者: from kmip.core.primitives.Base import is_tag_next [as 别名]
def process(self, istream, ostream):
stream = istream.read()
if Base.is_tag_next(Tags.REQUEST_MESSAGE, stream):
message = RequestMessage()
message.read(stream)
try:
result = self._process_request(message)
except Exception as e:
raise e
tstream = BytearrayStream()
result.write(tstream)
ostream.write(tstream.buffer)
elif Base.is_tag_next(Tags.RESPONSE_MESSAGE, stream):
message = ResponseMessage()
message.read(stream)
self._process_response(message)
else:
raise ValueError('Processing error: stream contains unknown '
'message type')